Tuesday, November 10, 2009

Basic System Commands

# uname –a -> Gives all details about the system

# uname –m -> Displays H/W platform (sun4u)

# uname –p -> Machine processor architecture (sparc or i386)

# uname –i -> Machine model architecture (SUNW, Ultra 5_10)

# uname –X -> Detailed description

# mkdir –p /data/dir -> Creates directory and sub directory in one shot

# rmdir –r /data -> Deletes the directory and all its subdirectory and files

# cp –r /data /data1 -> It copies the directory

# echo $MANPATH
: /usr/local/samba/man:

# echo $PATH -> Shows environmental path
/usr/sbin:/usr/bin

Grep Command Options

-i -> Searches for both upper & lower case characters
-l -> Lists the names of files with matching lines
-n -> Proceeds each line with the relative line number in the file
-v -> Inverts the search to display lines that do not match the pattern
-w -> Searches for the expression as a complete word.

# find /kris –name file1 -> Searches for file file1 in /kris directory

# find /kris –name file1 –exec ls –l {} \; -> Search and display

# find /kris –type f –size 0 –exec ls –l {} \; -> Search for the file with size 0

# find /kris –user user1 -> Shows file used by user ‘user1’

$ PATH=$PATH:/usr/ccs/bin:/usr/ucb: -> It will get appended to the existing path

# ln –s -> Creating symbolic link

# ln -> Creating hard link

Unix File Permission

r – 4, w – 2, x – 1
_rw_ r_ _ r_ _ (644) -> Default file permission

drwx r_x r_x (755) -> Default directory permission

O G O -> Permission categories

# ls –n /var/adm

drwxrwxr_x 5 4 4 512 nov 15 14:55 file1

5 - No of hard link to the file or directory
4 – The UID of the owner
4 – The GID of the group
512 – Size