UNIX COMMANDS


UNIX Commands

1.    To create a directory.
a.    Syntax : mkdir (directory name)
b.    Example : mkdir CIVIL
2.    To rename a directory.
a.    Syntax : mv (directory 1) (directory 2)
b.    Example : mv CIVIL IT
3.    To change the directory.
a.    Syntax : cd (directory name)
b.    Example : cd IT1
4.    To copy the directory and its file to another directory.
a.    Syntax : cp –r (source directory) (destination directory)
b.    Example : cp –r IT1/ IT2
5.    To remove directory.
a.    Syntax : rmdir (empty directory name)
b.    Example : rmdir IT1
c.     Syntax : rmdir –r (non-empty directory name)
d.    Example : rmdir –r IT2
6.    To print present working directory. / To display complete path of the working directory.
a.    Syntax : pwd
7.    To create a file.
a.    Syntax : vi (file name)
b.    Example : vi aa.txt
8.      To rename a file.
a.    Syntax : mv (old file name) (new file name)
b.    Example : mv aa.txt a1.txt
9.      To view / display a file.
a.    Syntax : cat (file name)
b.    Example : cat a1.txt
10.    To copy files.
a.    Syntax : cp (source filename) (destination filename)
b.    Example : cp a1.txt a2.txt
11.    To move files.
a.    Syntax : mv (filename 1) (filename 2)
b.    Example : mv a1.txt a2.txt
12.    To list the contents of a directory.
a.    Syntax : ls
13.    To view first 10 lines of a file / to display the beginning of a file
a.    Syntax : head (file)
b.    Example : head a1.txt



14.    To view last 10 lines of a file / to display the end of a  file
a.    Syntax : tail (file)
b.    Example : tail a1.txt
15.    To display a string.
a.    Syntax : echo (string)
b.    Example : echo “IRTT”
16.    To count the number of words, lines and characters in a file.
a.    Syntax : wc (file)
b.    Example : wc aa.txt
c.     Syntax : wc –w (file)         // Count number of words only
d.    Example : wc –w aa.txt
e.     Syntax : wc –l (file)           // Count number of lines in file
f.     Example : wc –l aa.txt
g.     Syntax : wc –m (file)         // Count number of characters in file
h.    Example : wc –m aa.txt
17.    To search for a specific word in a file.
a.    Syntax : grep (word) (file)
b.    Example : grep civil aa.txt
18.    To count the number of occurrence of a character in a file.
a.    Syntax : grep –c (word) (file)
b.    Example : grep –c civil aa.txt
19.    To view the commands which was executed
a.    Syntax : history
20.    Show manual for a command
a.    Syntax : man (command)
b.    Example : man cat
21.    To clear the screen.
a.    Syntax : clear
22.    To print the calendar
a.    Syntax : cal
b.    Syntax : cal (year)
c.     Example : cal 2013
d.    Syntax : cal (month) (year)
e.     Example : cal 3 2012
23.    To print date and time.
a.    Syntax : date
24.    To find out who is logged in. / To print who is using the system presently.
a.    Syntax : who
25.    Display user name.
a.    Syntax : whoami
26.    Display users full detail, user-id and group-id.
a.    Syntax : id


No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu