Search This Blog

Wednesday, April 27, 2011

Usefull Linux commands

1.copy a file from source location to destination:
cp source destination:
Ex: cp /root/qwertyt/doc.ppt  /root/qwertyt/test2
2.Lists the files in the present directory
ls
3.Lists the last few files created
ll -lrt 
4.Change Directory
cd
Ex: cd test2
5.Make Directory:
 mkdir
6.Remove file :
rm -rf filename
7.Change access permissions 
chmod -Rf 755 directory
8.Displays first n lines
head -n
Ex: head -5 test5 9.Displays last n linestail -n
Ex: tail -5 test5 
10.Print Working Directory:
pwd 
11.cat:
Display the contents of a file
12.Clear terminal screen:
clear
13.Compare two files: 
cmp 
14.Display or change the date & time:date 
15.Display the differences between two files:
diff
16.Exit the shell:
exit
17.Search file(s) for lines that match a given pattern:
grep
18.Print user and group id's;
id
19.List active jobs:
jobs 
20.Stop a process from running:
kill
21.Help manual:
man
22.Rename files;
rename
23.Reverse lines of a file:
rev
24.create a new file:
touch