The following table is a list of most frequently used commands in Linux/Unix.Table gives commands with the description on usage.
you can try below commands in web page based online Linux Terminal.
Command
|
Command description
|
pwd
|
prints working directory
|
who I am
|
prints user name
|
which shell/Perl
|
shows version or type of shell/Perl
|
alias c clear
|
to create alias
|
> file1
|
direct to file1,
ex: cat temp1 > file1
cat the file temp1 and creates file1,directs to it
|
>> file1
|
append to file1, ex: cat temp1 > >file1
cat the file temp1 and directs to existing file file1 and appends it,
if the file is not existing it creates and directs to it
|
sort file.txt
|
sort the file
|
sort -r file.txt
|
sort the file in descending order
|
cd –
|
toggle between two directories
|
tail file.txt
|
prints last 10 lines of file.txt
|
tail –n N file.txt
|
prints last N number of lines of file.txt
|
less big.log
|
Displays less contents of big file.
Ctrl+F Forward to next window
Ctrl+B Backward to one window
|
cp -pi file1 file2
|
copy file1 to file2
-p preserves Mode, Time stamp and Ownership Information
-i ask for confirmation before copying
|
rm -irf folder/*
|
remove folder,
-i ask for confirmation before copying
-r remove recursively
-f forcefully
|
chmod ug+rwx file1
|
give read, write and execute permission to file1
|
chmod g-rwx file1
|
revoke read, write and execute permission to file1
|
chmod –R ug+rwx folder/*
|
give read, write and execute permission to files recursively
|
diff folder1 folder2
|
difference between folder1 and folder2
|
gvimdiff file1 file2
|
diff the two files and show the result in gvim window
|
grep –ir “pattern” *
|
grep for pattern in all the files ,
-i insensitive
-r recursive
-w complete word
-A <N> prints matched lines and +N lines after matched line
-C <N> prints N lines around matches line
-v displays Invert match
-c Counts number of occurrence
-l displays only files name
-o shows only matched string
-n shows line number along with matched line
|
find . –name “filename.log”
|
finds for filename.log
|
find ~ -name “filename.log”
|
finds for filename.log in home directory
|
gzip file.txt
|
to create gzip,file.txt.gz
|
gzip –d file.txt.gz
|
to uncompress file.txt.gz and makes file.txt
|
tar cvf archive_name.tar directory_name/
|
creates new tar
|
tar xvf archive_name.tar
|
extracts from existing tar
|
tar tvf archive_name.tar
|
view an existing tar
|
su user_name
|
switch user to user_name
|
bjobs
|
list the ongoing jobs with job id
|
bkill <job_id>
|
kill <job_id> process
|
bqueues
|
list the available queues and queue details
|
du –sh folder1
|
check disk usage of folder1
|
find -type f \( -name ‘*.swp’ -o -name ‘*~’ -o -name ‘*.bak’ -o -name ‘.netrwhist’ \) -delete
|
to delete swap files
|
ln s hello.txt s_link
|
Creates a symbolic link named s_link that points to the file hello.txt
|
free
|
Displays the amount of used and free system memory
|
whoami
|
prints the user id
|
df h
|
report file system disk space usage
|
du h
|
disk usage of each file, recursively for directories
|
ps aux
|
ps (process status) command is used to provide information about currently running processes with process identification numbers
|
sed commands:
sed editor for filtering and transforming text.
sed i ‘1,10d’ hello.txt
|
deleted the first 10 lines from hello.txt
|
sed i ‘‘2’i hai’ hello.txt
|
Inserts the text ‘hai’ in the second line
|
sed i ‘/hello/d’ hello.txt
|
Deleted the line containing the pattern hello.
|
sed ‘s/hello/world/’ hello.txt
|
Replaces the first occurrence of hello on each line to world
|
sed ‘s/hello/world/g’ hello.txt
|
Replaces all the occurrences of hello on each line to world.
|
.cshrc file
awk commands