SES by degreeadvantage.com

Thursday, October 4, 2007

Linux File System & Common Commands



Root : it is an home directory of super user (root) administrator

Etc : it is the location of all configuration file and directory used for server

configuration or system configuration

dev : it is a location of the device file

home : it is a location of home directory or regular users

proc : it is a virtual file system or directory not actually store on the disk and

contain system information

# cat /proc/meminfo

# cat /proc/cpuinfo

boot : contain kernel and boot related files

sys : it is also a virtual directory and contain system information

media : it is a mount point of removable disk like cdrom floppy usb drive etc.

tmp : it contain all temporary file

usr : it is used for software installation

lib : it contain all library files

bin : it is the location of all executable files or command or user command

/usr/bin also contain user command

sbin : it contain all system command or super user command /usr/sbin

mnt : it is a mount point for physical hard-disk or partition

opt : optional directory and used for temporary working

var : it is a variable file system or directory and contain all log and error

message

Common Command

Some of the Common system command are as follow:

1. Date : to display date and time

2. Cal : to display the calendar

3. Cal 11 2006 : display the calendar of Month 11 and year 2006

4. Clear : To clear the screen

5. ls : to list directory contents

color identification

blue : Directories

White : Files

Green : Executable files

Red ; Zip files, rpm, tar file

Different switches used with “ls” command

ls –l or ll : used for long listing including file and directory permission

(-) : file

(d) : Directory

(l) : Symbolic link

ls –a : shows all hidden files and directory. Any file followed by (.) is hidden file

ls –al : show all hidden files and directory with long listing or whole description

ls –d : shows all the directory

6. pwd: Print working directory

7. who am I : display the information of current terminal

8. who : display all the terminal in a network

9. history : it shows all the command your have used.

By default history stores last 1000 command which u have run. If u want to change

# vi /etc/profile

HIST SIZE =10

Save and exit

# history –c ( to clear all the previous command reside in history)

Creating file and Directory:

  1. Creating file:

The ‘cat’ command is used to create a file

Syntax:

# cat > filename

example:

# cat > abc.txt

(Ctrl +D) is used to save the file.

  1. View the content of file

Syntax:

# cat filename

Example:

#cat abc.txt

#cat –b abc.txt

  1. Creating Directory

The ‘mkdir’ command is used to create directory

Syntax:

Mkdir [directory_name]

Example:

# mkdir abc

Option used:

cd : To change directory

cd .. : To come out from directory

cd : to jump to root directory

cd - : to jump to previous directory

Deleting Files and directory:

Syntax:

For file:

rm

example:

rm abc.txt

for directory

syntax:

rmdir

Note: Only empty directory will be deleted)

If we want to delete the tree structure of directory then we need to use the following command

Syntax:

rm –rf

where

r = recursively

f= force

in order to remove non empty directory

Syntax:

rm –r

example;

rm –r abc

this will remove directory step by step ,first remove sub directory and then finally main directory.



1 comment:

Unknown said...

Really thankful for this information. This is a good site for beginners. Do post more about Linux.

Sreejith Ravi

 
Free Search Engine Submission thanks to: Create a Website