Where Data is Stored

«« Previous
Next »»

Looking at any Linux system you should be able to know what each directory is for and where data is stored in Linux. In this topic, we investigate the file structure in Linux and begin to understand the where are why data is stored in specific locations in Linux.

Essentially, the filesystem is broken down into data that needs to be:

◉ Only Read
◉ Read and Executed
◉ Written To

Directories with Purpose


To meet the needs of these different files, where possible, Linux likes to group them together by purpose. So we have the /var/log directory for log files, the /var/spool directory for print spools, mail, scheduled job. These directories all represent data that needs to be written to a lot.  Our programs, or binaries as they are often referred, will need to be read and executed. These files will be located in directories which include the /bin, /sbin and /lib. These directories are replicated additionally under /usr/. Incidentally, usr stands for Unix System Resources and not user!

◉ /usr/lib
◉ /usr/bin
◉ /usr/sbin

Configuration files are located in the /etc directory and are not often changed. So mainly we look at grouping read-only files in this location

Shared and Kernel Modules


Linux will make use of two types of shared library files or modules. These are often located in the /lib or /usr/lib directories. Shared modules are used by user programs. To see the shared modules that a user space program users we have the command ldd. To see the shared modules that are used by the program ls we can use ldd in this way:

ldd /bin/ls

Shared modules have the .so file name suffix.

Kernel modules are used by the Kernel is reserved memory and have a .ko suffix. We can list loaded modules with the lsmod command which weinvestigated in the previous objective.


«« Previous
Next »»

0 comments:

Post a Comment