Directory Structure PoSIX

Note: Files are grouped according to purpose. Ex: commands, data files, documentation.
Parts of a Unix directory tree. See the FSSTND standard (Filesystem standard)

/ Root
|—root The home directory for the root user
|—home Contains the user’s home directories
| |—-ftp Users include many services as listed here
| |—-httpd
| |—-samba
| |—-user1
| |—-user2
|—bin Commands needed during bootup that might be needed by normal users.
|—sbin Like bin but commands are not intended for normal users.
Commands run by LINUX.
|—proc This filesystem is not on a disk. Exists in the kernels imagination (virtual)
| | This Directory holds information about kernel parameters and system configuration.
| |—-1 A directory with info about process number 1 | Each process has a directory below proc.
|—usr Contains all commands, libraries, man pages, games and static files for normal operation
| |—-bin Almost all user commands. some commands are in /bin or /usr/local/bin.
| |—-sbin System admin commands not needed on the root filesystem. e.g., most server programes
| |—-include Header files for the C programming language. Should be below /user/lib for consistency
| |—-lib Unchanging data files for programs and subsystems
| |—-local The place for locally installed software and other files.
| |—-man Manual pages
| |—-info Info documents
| |—-doc Documentation for various packages
| |—-tmp
| |— X11R6 The X windows system files. There is a directory similar to usr below this directory
| |—-X386 Like X11R6 but for X11 release 5
|—boot Files used by the bootstrap loader, LILO. Kernel images are often kept here.
|—lib Shared libraries needed by the programs on the root filesystem
| |—-modules Loadable kernel modules, especially those needed to boot system after disasters.
|—dev Device files for devices such as disk drives, serial ports, etc.
|—etc Configuration files specific to the machine.
| |—-skel When a home directory is created it is initialized with files from this directory
| |—-sysconfig Files that configure the linux system for networking, keyboard, time, and more.
|—var Contains files that change for mail, news, printers log files, man pages, temp files
| |—-file
| |—-lib Files that change while the system is running normally
| |—-local Variable data for programs installed in /usr/local.
| |—-lock Lock files. Used by a program to indicate it is using a particular device or file
| |—-log Log files from programs such as login and syslog which logs all logins, logouts, and other
Systems messages.
| |—-run Files that contain information about the system that is valid until the system is next booted
| |—-spool Directories for mail, printer spools, news and other spooled work.
| |—-tmp Temporary files that are large or need to exist for longer than they should in /tmp.
| |—-catman A cache for man pages that are formatted on demand
|—mnt Mount points for temporary mounts by the system administrator.
|—tmp Temporary files. Programs running after bootup should use /var/tmp.

Locating OR Finding Files in GNU/Linux

There are three good methods of finding files in linux:

1. The slocate database
2. The whereis command
3. The find command

The slocate database

To use the locate command, you will need to have a slocate database set up on your system. On many systems it is updated periodically by the cron daemon. Try the slocate command to see if it will work on your system:
locate whereis

Will list all files that contain the string “whereis”. If that command did not work you will need to run the command:

slocate -u

This command will build the slocate database which will allow you to use the locate command. This command will take a few minutes to run.

The whereis command

This command will locate binary (or executable) programs and their respective man pages. The command:
whereis linuxconf will find all binaries and manpages with the name linuxconf.

The find command

The following are examples of the find command:
find /home -user mark Will find every file under the directory /home owned by the user mark.
find /usr -name *spec Will find every file under the directory /usr ending in “.spec”.
find /var/spool -mtime +40 Will find every file under the directory /var/spool that has data older than 40 days.

Find is a very powerful program and very useful for finding files with various characteristics. For more information, read the man page about find by typing “man find”.

Locating man pages by subject

There is a keyword option in the man command that can be used to find man pages that have specific words in their descriptions. An example is: man -k process
to find all man pages that talk about processes. Use the command:
man -k process |grep kernel
to find information on kernel processes. An equivalent command is the apropos command as follows:
apropos process

The which command

The which(1) program is a useful command for finding the full path of the executable program that would be executed if the name of the executable program is entered on the command line. The command:
which startx
Will show the full path of the startx command that will be run if “startx” is entered on the command line when an X session is started.

boot, root, var, etc, usr, bin, sbin, home, dev, tmp, mnt, proc

Share this post

Post Comment