Pages

Thursday, January 24, 2013

Find Command variants

1. Find Files Using Name in Current Directory

Find all the files whose name is server.txt in a current working directory.

# find . -name server.txt

./server.txt

2. Find Files Under Home Directory

Find all the files under /home directory with name server.txt.

# find /home -name server.txt

/home/server.txt

3. Find Files Using Name and Ignoring Case

Find all the files whose name is server.txt and contains both capital and small letters in /home directory.

# find /home -iname server.txt

./server.txt
./server.txt

4. Find Directories Using Name

Find all directories whose name is server in / directory.

# find / -type d -name server

/server

5. Find PHP Files Using Name

Find all php files whose name is server.php in a current working directory.

# find . -type f -name server.php

./server.php

6. Find all PHP Files in Directory

Find all php files in a directory.

# find . -type f -name "*.php"

./server.php
./login.php
./index.php

Part II – Find Files Based on their Permissions
7. Find Files With 777 Permissions

Find all the files whose permissions are 777.

# find . -type f -perm 0777 -print

8. Find Files Without 777 Permissions

Find all the files without permission 777.

# find / -type f ! -perm 777

9. Find SGID Files with 644 Permissions

Find all the SGID bit files whose permissions set to 644.

# find / -perm 2644

10. Find Sticky Bit Files with 551 Permissions

Find all the Sticky Bit set files whose permission are 551.

# find / -perm 1551

11. Find SUID Files

Find all SUID set files.

# find / -perm /u=s

12. Find SGID Files

Find all SGID set files.

# find / -perm /g+s

13. Find Read Only Files

Find all Read Only files.

# find / -perm /u=r

14. Find Executable Files

Find all Executable files.

# find / -perm /a=x

15. Find Files with 777 Permissions and Chmod to 644

Find all 777 permission files and use chmod command to set permissions to 644.

# find / -type f -perm 0777 -print -exec chmod 644 {} \;

16. Find Directories with 777 Permissions and Chmod to 755

Find all 777 permission directories and use chmod command to set permissions to 755.

# find / -type d -perm 777 -print -exec chmod 755 {} \;

17. Find and remove single File

To find a single file called server.txt and remove it.

# find . -type f -name "server.txt" -exec rm -f {} \;

18. Find and remove Multiple File

To find and remove multiple files such as .mp3 or .txt, then use.

# find . -type f -name "*.txt" -exec rm -f {} \;

OR

# find . -type f -name "*.mp3" -exec rm -f {} \;

19. Find all Empty Files

To file all empty files under certain path.

# find /tmp -type f -empty

20. Find all Empty Directories

To file all empty directories under certain path.

# find /tmp -type d -empty

21. File all Hidden Files

To find all hidden files, use below command.

# find /tmp -type f -name ".*"

Part III – Search Files Based On Owners and Groups
22. Find Single File Based on User

To find all or single file called server.txt under /root directory of owner root.

# find / -user root -name server.txt

23. Find all Files Based on User

To find all files that belongs to user server under /home directory.

# find /home -user server

24. Find all Files Based on Group

To find all files that belongs to group Developer under /home directory.

# find /home -group developer

25. Find Particular Files of User

To find all .txt files of user server under /home directory.

# find /home -user server -iname "*.txt"

Part IV – Find Files and Directories Based on Date and Time
26. Find Last 50 Days Modified Files

To find all the files which are modified 50 days back.

# find / -mtime 50

27. Find Last 50 Days Accessed Files

To find all the files which are accessed 50 days back.

# find / -atime 50

28. Find Last 50-100 Days Modified Files

To find all the files which are modified more than 50 days back and less than 100 days.

# find / -mtime +50 –mtime -100

29. Find Changed Files in Last 1 Hour

To find all the files which are changed in last 1 hour.

# find / -cmin -60

30. Find Modified Files in Last 1 Hour

To find all the files which are modified in last 1 hour.

# find / -mmin -60

31. Find Accessed Files in Last 1 Hour

To find all the files which are accessed in last 1 hour.

# find / -amin -60

Part V – Find Files and Directories Based on Size
32. Find 50MB Files

To find all 50MB files, use.

# find / -size 50M

33. Find Size between 50MB – 100MB

To find all the files which are greater than 50MB and less than 100MB.

# find / -size +50M -size -100M

34. Find and Delete 100MB Files

To find all 100MB files and delete them using one single command.

# find / -size +100M -exec rm -rf {} \;

35. Find Specific Files and Delete

Find all .mp3 files with more than 10MB and delete them using one single command.

# find / -type f -name *.mp3 -size +10M -exec ls -l {} \;

 

Find all empty files (zero byte file) in your home directory and its subdirectory

Most files of the following command output will be lock-files and place holders created by other applications.

# find ~ -empty

List all the empty files only in your home directory.

# find . -maxdepth 1 -empty

List only the non-hidden empty files only in the current directory.

# find . -maxdepth 1 -empty -not -name ".*"

‘df‘ command stand for linux “disk filesystem“

Linux has a strong built in utility called ‘df‘. The ‘df‘ command stand for “disk filesystem“, it is used to get full summary of available and used disk space usage of file system on Linux system.

Using ‘-h‘ parameter with (df -h) will shows the file system disk space statistics in “human readable” format, means it gives the details in bytes, mega bytes and gigabyte.
How to Check Disk Space in Linux

Useful df Command Examples

This article explain a way to get the full information of Linux disk space usage with the help of ‘df‘ command with their practical examples. So, you could better understand the usage of df command in Linux.
1. Check File System Disk Space Usage

The “df” command displays the information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system.

[root@tecmint ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p2 78361192 23185840 51130588 32% /
/dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home
/dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data
/dev/cciss/c0d0p1 295561 21531 258770 8% /boot
tmpfs 257476 0 257476 0% /dev/shm

2. Display Information of all File System Disk Space Usage

The same as above, but it also displays information of dummy file systems along with all the file system disk usage and their memory utilization.

[root@tecmint ~]# df -a

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p2 78361192 23186116 51130312 32% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
/dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home
/dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data
/dev/cciss/c0d0p1 295561 21531 258770 8% /boot
tmpfs 257476 0 257476 0% /dev/shm
none 0 0 0 - /proc/sys/fs/binfmt_misc
sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs

3. Show Disk Space Usage in Human Readable Format

Have you noticed that above commands displays information in bytes, which is not readable yet all, because we are in a habit of reading the sizes in megabytes, gigabytes etc. as it makes very easy to understand and remember.

The df command provides an option to display sizes in Human Readable formats by using ‘-h’ (prints the results in human readable format (e.g., 1K 2M 3G)).

[root@tecmint ~]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p2 75G 23G 49G 32% /
/dev/cciss/c0d0p5 24G 22G 1.2G 95% /home
/dev/cciss/c0d0p3 29G 25G 2.6G 91% /data
/dev/cciss/c0d0p1 289M 22M 253M 8% /boot
tmpfs 252M 0 252M 0% /dev/shm

4. Display Information of /home File System

To see the information of only device /home file system in human readable format use the following command.

[root@tecmint ~]# df -hT /home

Filesystem Type Size Used Avail Use% Mounted on
/dev/cciss/c0d0p5 ext3 24G 22G 1.2G 95% /home

5. Display Information of File System in Bytes

To display all file system information and usage in 1024-byte blocks, use the option ‘-k‘ (e.g. –block-size=1K) as follows.

[root@tecmint ~]# df -k

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p2 78361192 23187212 51129216 32% /
/dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home
/dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data
/dev/cciss/c0d0p1 295561 21531 258770 8% /boot
tmpfs 257476 0 257476 0% /dev/shm

6. Display Information of File System in MB

To display information of all file system usage in MB (Mega Byte) use the option as ‘-m‘.

[root@tecmint ~]# df -m

Filesystem 1M-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p2 76525 22644 49931 32% /
/dev/cciss/c0d0p5 24217 21752 1215 95% /home
/dev/cciss/c0d0p3 29057 24907 2651 91% /data
/dev/cciss/c0d0p1 289 22 253 8% /boot
tmpfs 252 0 252 0% /dev/shm

7. Display Information of File System in GB

To display information of all file system statistics in GB (Gigabyte) use the option as ‘df -h‘.

[root@tecmint ~]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p2 75G 23G 49G 32% /
/dev/cciss/c0d0p5 24G 22G 1.2G 95% /home
/dev/cciss/c0d0p3 29G 25G 2.6G 91% /data
/dev/cciss/c0d0p1 289M 22M 253M 8% /boot
tmpfs 252M 0 252M 0% /dev/shm

8. Display File System Inodes

Using ‘-i‘ switch will display the information of number of used inodes and their percentage for the file system.

[root@tecmint ~]# df -i

Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/cciss/c0d0p2 20230848 133143 20097705 1% /
/dev/cciss/c0d0p5 6403712 798613 5605099 13% /home
/dev/cciss/c0d0p3 7685440 1388241 6297199 19% /data
/dev/cciss/c0d0p1 76304 40 76264 1% /boot
tmpfs 64369 1 64368 1% /dev/shm

9. Display File System Type

If you notice all the above commands output, you will see there is no file system type mentioned in the results. To check the file system type of your system use the option ‘T‘. It will display file system type along with other information.

[root@tecmint ~]# df -T

Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p2 ext3 78361192 23188812 51127616 32% /
/dev/cciss/c0d0p5 ext3 24797380 22273432 1243972 95% /home
/dev/cciss/c0d0p3 ext3 29753588 25503792 2713984 91% /data
/dev/cciss/c0d0p1 ext3 295561 21531 258770 8% /boot
tmpfs tmpfs 257476 0 257476 0% /dev/shm

10. Include Certain File System Type

If you want to display certain file system type use the ‘-t‘ option. For example, the following command will only display ext3 file system.

[root@tecmint ~]# df -t ext3

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p2 78361192 23190072 51126356 32% /
/dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home
/dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data
/dev/cciss/c0d0p1 295561 21531 258770 8% /boot

11. Exclude Certain File System Type

If you want to display file system type that doesn’t belongs to ext3 type use the option as ‘-x‘. For example, the following command will only display other file systems types other than ext3.

[root@tecmint ~]# df -x ext3

Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 257476 0 257476 0% /dev/shm

=====================
[root@tecmint ~]# df
[root@tecmint ~]# df -h
[root@tecmint ~]# df -a
[root@tecmint ~]# df -hT /home
[root@tecmint ~]# df -k
[root@tecmint ~]# df -m
[root@tecmint ~]# df -h
[root@tecmint ~]# df -i
[root@tecmint ~]# df -T
[root@tecmint ~]# df -t ext3
[root@tecmint ~]# df -x ext3

[root@tecmint ~]# df -aihT
=====================

(Disk Usage) “du” is a standard Unix/Linux command

The Linux “du” (Disk Usage) is a standard Unix/Linux command, used to check the information of disk usage of files and directories on a machine. The du command has many parameter options that can be used to get the results in many formats. The du command also displays the files and directory sizes in a recursively manner.
Check Disk Usage In Linux

Check Disk Usage of Files and Folders In Linux

1. To find out the disk usage summary of a /home/server directory tree and each of its sub directories. Enter the command as:

[root@]# du /home/server

40 /home/server/downloads
4 /home/server/.mozilla/plugins
4 /home/server/.mozilla/extensions
12 /home/server/.mozilla
12 /home/server/.ssh
689112 /home/server/Ubuntu-12.10
689360 /home/server

The output of the above command displays the number of disk blocks in the /home/server directory along with its sub-directories.

2. Using “-h” option with “du” command provides results in “Human Readable Format“. Means you can see sizes in Bytes, Kilobytes, Megabytes, Gigabytes etc.

[root@server]# du -h /home/server

40K /home/server/downloads
4.0K /home/server/.mozilla/plugins
4.0K /home/server/.mozilla/extensions
12K /home/server/.mozilla
12K /home/server/.ssh
673M /home/server/Ubuntu-12.10
674M /home/server

3. To get the summary of a grand total disk usage size of an directory use the option “-s” as follows.

[root@server]# du -sh /home/server

674M /home/server

4. Using “-a” flag with “du” command displays the disk usage of all the files and directories.

[root@server]# du -a /home/server

4 /home/server/.bash_logout
12 /home/server/downloads/uploadprogress-1.0.3.1.tgz
24 /home/server/downloads/Phpfiles-org.tar.bz2
40 /home/server/downloads
12 /home/server/uploadprogress-1.0.3.1.tgz
4 /home/server/.mozilla/plugins
4 /home/server/.mozilla/extensions
12 /home/server/.mozilla
4 /home/server/.bashrc
689108 /home/server/Ubuntu-12.10/ubuntu-12.10-server-i386.iso
689112 /home/server/Ubuntu-12.10
689360 /home/server

5. Using “-a” flag along with “-h” displays disk usage of all files and folders in human readeable format. The below output is more easy to understand as it shows the files in Kilobytes, Megabytes etc.

[root@server]# du -ah /home/server

4.0K /home/server/.bash_logout
12K /home/server/downloads/uploadprogress-1.0.3.1.tgz
24K /home/server/downloads/Phpfiles-org.tar.bz2
40K /home/server/downloads
12K /home/server/uploadprogress-1.0.3.1.tgz
4.0K /home/server/.mozilla/plugins
4.0K /home/server/.mozilla/extensions
12K /home/server/.mozilla
4.0K /home/server/.bashrc
673M /home/server/Ubuntu-12.10/ubuntu-12.10-server-i386.iso
673M /home/server/Ubuntu-12.10
674M /home/server

6. Find out the disk usage of a directory tree with its subtress in Kilobyte blcoks. Use the “-k” (displays size in 1024 bytes units).

[root@server]# du -k /home/server
40 /home/server/downloads
4 /home/server/.mozilla/plugins
4 /home/server/.mozilla/extensions
12 /home/server/.mozilla
12 /home/server/.ssh
689112 /home/server/Ubuntu-12.10
689360 /home/server

7. To get the summary of disk usage of directory tree along with its subtrees in Megabytes (MB) only. Use the option “-mh” as follows. The “-m” flag counts the blocks in MB units and “-h” stands for human readable format.

[root@server]# du -mh /home/server

40K /home/server/downloads
4.0K /home/server/.mozilla/plugins
4.0K /home/server/.mozilla/extensions
12K /home/server/.mozilla
12K /home/server/.ssh
673M /home/server/Ubuntu-12.10
674M /home/server

8. The “-c” flag provides a grand total usage disk space at the last line. If your directory taken 674MB space, then the last last two line of the output would be.

[root@server]# du -ch /home/server

40K /home/server/downloads
4.0K /home/server/.mozilla/plugins
4.0K /home/server/.mozilla/extensions
12K /home/server/.mozilla
12K /home/server/.ssh
673M /home/server/Ubuntu-12.10
674M /home/server
674M total

9. The below command calculates and displays the disk usage of all files and directories, but excludes the files that matches given pattern. The below command excludes the “.txt” files while calculating the total size of diretory. So, this way you can exclude any file formats by using flag “-–exclude“. See the output there is no txt files entry.

[root@server]# du -ah --exclude="*.txt" /home/server

4.0K /home/server/.bash_logout
12K /home/server/downloads/uploadprogress-1.0.3.1.tgz
24K /home/server/downloads/Phpfiles-org.tar.bz2
40K /home/server/downloads
12K /home/server/uploadprogress-1.0.3.1.tgz
4.0K /home/server/.bash_history
4.0K /home/server/.bash_profile
4.0K /home/server/.mozilla/plugins
4.0K /home/server/.mozilla/extensions
12K /home/server/.mozilla
4.0K /home/server/.bashrc
24K /home/server/Phpfiles-org.tar.bz2
4.0K /home/server/geoipupdate.sh
4.0K /home/server/.zshrc
120K /home/server/goaccess-0.4.2.tar.gz.1
673M /home/server/Ubuntu-12.10/ubuntu-12.10-server-i386.iso
673M /home/server/Ubuntu-12.10
674M /home/server

10. Display the disk usage based on modification of time, use the flag “–time” as shown below.

[root@server]# du -ha --time /home/server

4.0K 2012-10-12 22:32 /home/server/.bash_logout
12K 2013-01-19 18:48 /home/server/downloads/uploadprogress-1.0.3.1.tgz
24K 2013-01-19 18:48 /home/server/downloads/Phpfiles-org.tar.bz2
40K 2013-01-19 18:48 /home/server/downloads
12K 2013-01-19 18:32 /home/server/uploadprogress-1.0.3.1.tgz
4.0K 2012-10-13 00:11 /home/server/.bash_history
4.0K 2012-10-12 22:32 /home/server/.bash_profile
0 2013-01-19 18:32 /home/server/xyz.txt
0 2013-01-19 18:32 /home/server/abc.txt
4.0K 2012-10-12 22:32 /home/server/.mozilla/plugins
4.0K 2012-10-12 22:32 /home/server/.mozilla/extensions
12K 2012-10-12 22:32 /home/server/.mozilla
4.0K 2012-10-12 22:32 /home/server/.bashrc
24K 2013-01-19 18:32 /home/server/Phpfiles-org.tar.bz2
4.0K 2013-01-19 18:32 /home/server/geoipupdate.sh
4.0K 2012-10-12 22:32 /home/server/.zshrc
120K 2013-01-19 18:32 /home/server/goaccess-0.4.2.tar.gz.1
673M 2013-01-19 18:51 /home/server/Ubuntu-12.10/ubuntu-12.10-server-i386.iso
673M 2013-01-19 18:51 /home/server/Ubuntu-12.10
674M 2013-01-19 18:52 /home/server

=================
[root@server]# du /home/server
[root@server]# du -h /home/server
[root@server]# du -sh /home/server
[root@server]# du -a /home/server
[root@server]# du -ah /home/server
[root@server]# du -k /home/server
[root@server]# du -mh /home/server
[root@server]# du -ch /home/server
[root@server]# du -ah --exclude="*.txt" /home/server
[root@server]# du -ha --time /home/server
[root@server]# du -sach *
=================

Friday, January 11, 2013

Installing Nginx web-server

Nginx repo

CentOS:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
RHEL:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1


manual installation

wget http://nginx.org/download/nginx-1.0.5.tar.gz
tar xvfz nginx-1.0.5.tar.gz
cd nginx-1.0.5
Install nginx
There are lot of options that you can pass to ./configure. To identify list of all the configuration options do the following.
./configure –help


./configure
make
make install

By default, Nginx will be installed in /usr/local/nginx. You may change this and other options with the compile-time options.
During ./configure, you might get the “./configure: error: the HTTP rewrite module requires the PCRE library.” error message about missing PCRE library that is required by nginx http rewrite module.
To solve the problem, either install “pcre” and “pcre-devel” packages on your Linux, or disable
the rewrite module by doing “./configure –without-http_rewrite_module”
/usr/local/nginx/conf/nginx.conf
ls /usr/local/nginx/logs/
access.log
error.log
nginx.pid



Side by Side
In some cases you may need to run both Apache (httpd) and Nginx on port 80. Such a situation can be a server running Cpanel/Whm and as such doesn’t support nginx, so you wouldn’t want to mess with the apache configuration at all.
To do this you have to make sure Apache and Nginx are bound to their own IP adddress, In the event of WHM/Cpanel based webserver, you can Release an IP to be used for Nginx in WHM. At this time I am not aware of a method of reserving an IP, and automatically forcing Apache to listen on a specific set of IPs in a control panel such as DirectAdmin or Plesk. But the link above will show you how with WHM/Cpanel.
Normally Apache will be listening on all interfaces, and such you may see a line like this in your httpd.conf file:
Port 80
#or
Listen 80
Instead you’ll need to tell apache to listen on a specific IP (you can have multiple Listen lines for multiple IPs)
Listen 192.170.2.1:80

Once you have apache configured to listen on a specific set of IPs you can do the same with nginx.
server {
listen 192.170.2.2:80;
...
}
Now that both servers are bound to specific IPs, both can then be started up on port 80. From there you would simply point the IP of the domain to the server you wish to use. In the case of WHM/Cpanel you can either manually configure the DNS entry for the domain going to nginx in WHM, or you can use your own DNS such as with your registrar to point the domain to the specific IP.
Apache behind Nginx
First thing that needs to be done is to change the interface apache listens on:
Listen 127.0.0.1:8080

So that Nginx can listen on port 80
Example of nginx configurations

server {
listen 80;

root /var/www/;
index index.php index.html index.htm;

server_name example.com;

location / {
try_files $uri $uri/ /index.php;
}

location ~ \.php$ {

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;

}

location ~ /\.ht {
deny all;
}
}

Wednesday, January 9, 2013

Install / Compile Kernel 3.5

Install / Compile Kernel 3.5
Step 1: Installing Kernel 3.5 Dependencies
Let’s first install dependencies packages gcc, ncurses and then update the system.
# yum install gcc ncurses ncurses-devel

# yum update
Step 2: Downloading Kernel 3.5 Source
# cd /tmp
# wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.5.tar.bz2
Step 3: Extracting Kernel 3.5 Source
Once the file is downloaded extract it under /usr/src/ directory by running the below command.
# tar -jxvf linux-3.5.tar.bz2 -C /usr/src/
# cd /usr/src/linux-3.5/
Step 4: Configuring Kernel 3.5 Source
For New Kernel Configuration
Now run the make menuconfig command to configure the Linux kernel. Once you execute the below command a pop up window appears with all the menus. Here you can select your new kernel configuration. If you unfamiliar with these menus, just hit ESC key to exit.
# make menuconfig
Step 5: Compiling Kernel 3.5
Next, type the make command to compile the Kernel 3.5. The compilation would take at least 30-40 minutes depends on your system configuration.
# make
Step 5: Installing Kernel 3.5
Once the compliation completes cleanly, now install the Kernel 3.5 in your Linux system. The below command will create files under /boot directory and also make a new kernel entry in your grub.conf file.
# make modules_install install
Step 6: Verifying Kernel 3.5
To verify newly installed Kernel just type the following command on the terminal.
# uname -r
That’s it. We hope this article will be much helpful to you all. If you’re facing any problems or difficulties while compiling or installing feel free to ask or post your questions using our comment form below.

Friday, January 4, 2013

Linux Directory Structure

Linux filesystem structures and understand the meaning of individual high-level directories.
filesystem-structure
1. / – Root

Every single file and directory starts from the root directory.
Only root user has write privilege under this directory.
Please note that /root is root user’s home directory, which is not same as /.

2. /bin – User Binaries

Contains binary executables.
Common linux commands you need to use in single-user modes are located under this directory.
Commands used by all the users of the system are located here.
For example: ps, ls, ping, grep, cp.

3. /sbin – System Binaries

Just like /bin, /sbin also contains binary executables.
But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
For example: iptables, reboot, fdisk, ifconfig, swapon

4. /etc – Configuration Files

Contains configuration files required by all programs.
This also contains startup and shutdown shell scripts used to start/stop individual programs.
For example: /etc/resolv.conf, /etc/logrotate.conf

5. /dev – Device Files

Contains device files.
These include terminal devices, usb, or any device attached to the system.
For example: /dev/tty1, /dev/usbmon0

6. /proc – Process Information

Contains information about system process.
This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
This is a virtual filesystem with text information about system resources. For example: /proc/uptime

7. /var – Variable Files

var stands for variable files.
Content of the files that are expected to grow can be found under this directory.
This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);

8. /tmp – Temporary Files

Directory that contains temporary files created by system and users.
Files under this directory are deleted when system is rebooted.

9. /usr – User Programs

Contains binaries, libraries, documentation, and source-code for second level programs.
/usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
/usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
/usr/lib contains libraries for /usr/bin and /usr/sbin
/usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2

10. /home – Home Directories

Home directories for all users to store their personal files.
For example: /home/john, /home/nikita

11. /boot – Boot Loader Files

Contains boot loader related files.
Kernel initrd, vmlinux, grub files are located under /boot
For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic

12. /lib – System Libraries

Contains library files that supports the binaries located under /bin and /sbin
Library filenames are either ld* or lib*.so.*
For example: ld-2.11.1.so, libncurses.so.5.7

13. /opt – Optional add-on Applications

opt stands for optional.
Contains add-on applications from individual vendors.
add-on applications should be installed under either /opt/ or /opt/ sub-directory.

14. /mnt – Mount Directory

Temporary mount directory where sysadmins can mount filesystems.

15. /media – Removable Media Devices

Temporary mount directory for removable devices.
For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer

16. /srv – Service Data

srv stands for service.
Contains server specific services related data.
For example, /srv/cvs contains CVS related data.