Basic Unix Directory Structure
All the files in UNIX are attached in a directory structure.The top level of the directory structure is /(i.e root), So all the files are located below the / directory. In windows OS like c:\ drive, we have /(i.e root directory) in UNIX.
Basically, the Directories are divided in to two types:
Critical Directory: nothing but the folder which is holding some important data ‘s, For example in windows operating system when you click on c: drive you would see different folders each one holding sensitive files/programs/scripts that are needed to run the OS properly. Users are advised not edit or delete any files from those directories.These Directories are called as the critical directories.
Non-Critical Directory: Its nothing but the folder which contains the temporary data. Data’s inside this folder doesn’t contain any sensitive files, Example I would say temp folder.
In UNIX all the critical and non-critical directories fall below the / (root) directory.With (root) / at the base of the file system and all other directory spreading from there.
Unix Directory Structure
/ – With (root) / at the base of the file system and all other directory spreading from there.This is the root directory which should contain only the directories needed at the top level of the file structure.
/bin – It contains both admin and non-admin executable commands, for example, some of the commands like touch, mkdir, top, kill etc….
/sbin(Superuser binary Dir)– It holds only the root user executable commands, for example, commands like shutdown, reboot,fdisk.
/etc– This directory holds the entire server configuration files, like user related files, network related files, booting files and much more.If you need any configuration files you can get that from the /etc directory.
1. To check the user properties you would need to open the config file /etc/passwd (passwd is a config file which contains all the user properties)…..
2.If I want to add a remote server IP for name resolving purpose, I would need to open the network config file /etc/hosts(inside hosts file we will put the remote server IP address).
/dev(Device)- This Directory contains all the device files and the logical name of all the hardware devices that are connected to the server.
What is meant by logical name of a device?
- For example, if I give you a fresh hard-disk in your hand how you would call that drive? Technically if you want to say that means, you have to say it’s a
raw disk (i.e, A disk without any partition).
- Once you divided the disk in to individual partitions user can access that hard-disk by the partition numbers (example in windows you would use c:,d:,e:….)this c,d,e drive letters are called as a logical name of the hard disk.
Like this, you will have names to access the hardware that is connected to the server.If a user needs to access any hardware he must have to use the logical names.
Ex: For harddisk /dev/sda.(sda–if it is a SCSI disk)
/dev/hde (hde–if it is an IDE disk)
For tape-drive /dev/rmt0 (“rmt” means remote magnetic tape and 0 is tape no.1)
/proc(Process)-This directory contains all the ongoing process information and also it holds the hardware configuration details of your server.
For example: /proc/pid will contain information about the process with that particular PID(process identification number)
/var(Variable)-This is an important directory which contains all the server related log files, the path for the log files in /var/log inside this directory path you will have different types of individual log files.
- for example:
- which gives you the global error log information from your server
- which contains all the mail related logs from your mail server.
Note: If this directory size is not having sufficient space or gets full then users may have to face the login issues I will explain you in detail in our upcoming server troubleshooting topics.
/home-This is the default home directory for all normal user logins.you may have a question pops up in your mind why the home directory is required?
When a user logged in to the system all the initialization files which are required to create the user environment or desktop will load from your default home directory.
- For example, each and every user will have a home path like this,
/home/Vasanth /home/Priya /home/Hema
- inside this path, users can store all their own data’s.
/root-This is the default home directory for root login(the same like /home dir).
/usr(Unix System for Resources)- This directory contains all the executable files, programs, scripts that are run by all users.As we know the/bin and /sbin directory which contains normal user and root user commands, now the executable path for all the commands start from either /usr/bin or /usr/sbin..
when you run any commands say for instance,
“touch”(which is used to create an empty file), the shell will receive the command from the keyboard and the path for this command is /usr/bin/touch.
/boot- This directory contains all the booting files that are needed when you power on the server.
/mnt(Mount)-It contains all the currently mounted filesystem details (Mounting and unmounting I will explain in our Linux topic)
/media-Default mount point directory for the removable media like USB, CD-ROM etc.when you insert a CD or DVD in your Linux box the CD will get automatically mounted inside the /media directory,from this directory you can access all the data from the CD.
Kindly Subscribe here 👉🏿👉🏿Click this link to Subscribe