List all files and directory
$ ls
List all files and directory with their detail like permission, owner and created date
$ ls $ ls -l
List all files and directory with more option (when list is more than 1 page)
$ ls -l | more
Remove directory
$ rmdir dirname
Remove a file
$ rm filename
Remove a file without "confirmation"
$ rm -f filename
Remove a directory
$ rmdir filename
Copy source to destination
$ cp sourceFile destinationFile
Move a file from one location to another
$ mv source destination
Online manual (help) about command
$ man ls
Find a text in file and return that line
$ grep searchText fileName
Change the File/Directory Permission
$ chmod 644 fileOrDir
List the preprocessor
$ ps
Find text in List of processor
$ ps | grep STIME
Kill the process
$ kill 45555
Zip a file
$ gzip filename
Unzip a file
$ ungzip filename.zip
List who is logged on your machine
$ who
List who is on the computer in the lab
$ finger
List of History you have done recently
$ history
Print the current Date
$ date
print the calendar for September 2000
$ cal 09 2013
See how much free disk space
$ df
Set the Alias for command
$ alias newc="ls -l";
Print system usage and top resource hogs
$ top
Logout from the putty/console
$ logout
$ exit
Progressively dump a file to the screen: ENTER = one line down SPACEBAR = page down q=quit$ more filename
Show the firest few lines of a file
$ head filename $ head -n filename
Show the last few lines of a file
$ tail filename $ tail -n filename
Search the text and store the output in file
$ grep string filename > newfile $ grep string filename >> existfile
Finds all the files named aaa.txt in the current directory or any subdirectory tree.
$ find . -name aaa.txt
Open a file in edit mode
$ vi filename
Open file in vi editor and go to line no 101 instant
$ vi +101 filename
Show the line number in front of each line in vi editor
:set number
Go to particular line number in vi editor
:14 :100 :5
Search text "searchme" in the vi editor
:/searchmeto search next press "n" and for previous "shift+n"
Come out from vi editor
"shift+:" and press "q" and then press "enter key"
i Insert before current cursor position
I Insert at beginning of current line
a Insert (append) after current cursor position
A Append to end of line
o Open and put text in a new line below current line
O Open and put text in a new line above current line
r Replace 1 character
R Replace mode
<ESC> Terminate insertion or overwrite mode
Deletion of text
x Delete single character
dd Delete current line and put in buffer
ndd Delete n lines (n is a number) and put them in buffer
J Attaches the next line to the end of the current line (deletes carriage return).
Cut and paste
yy Yank current line into buffer
nyy Yank n lines into buffer
p Put the contents of the buffer after the current line
P Put the contents of the buffer before the current line
Cursor positioning (symbol (^ )before a letter means that the <Ctrl> key should be held down while the letter key is pressed)
^d Page down
^u Page up
^f move forward one screen
^b move backward one screen
^g Display current line number
:n Position cursor at line n
:$ Position cursor at end of file
Give on which server you are on
$ unameLinux
Give your hostname
$ uname -n; $ hostname
Kill your task
$ kill 1202255
Command displays active processes
$ ps
Display today's CPU activity
$ sar
Change the File's timing (created, access and modification time);
$ touch file.txtIf file is not exist, If will create the file
set the access and modify timestamp
$ touch -t 06151330 f1.c;
Get file stats
$ stat file.txt
Change the owner of file/folder
$ chown vivek demo.txtOwner of demo.text is set to vivek
Change the owner & Group of file/folder
$ chown vivek:arun demo.txtOwner of demo.text is set to vivek
Group of demo.text is set to arun
Change the group of file/folder
$chown :ftp demo.txtGroup of demo.text is set to ftp
Change the owner of folder
$chown root /folderOwner of /folder set to root
Change the owner of folder and its subfolder
$chown -R root /folderOwner of /folder and its sub folder, set to root
List of user
$ w $ who
Number of files in folder
ls -l | wc -l
Number of files in folder including dot and hidden files
ls -lA | wc -l
List the files sort by date
ls -ltr
Execute URL in Lynx with credentials
lynx http://example.com/action.php -accept_all_cookies -auth=username:'password'
List the crontab in your application
$ crontab -l
Edit the crontab timings
$ crontab -e
Total files in Directory
ls -1 | wc -l
Get the Files size in MB (Mega bytes) in unix command
$ ls -lash
Show the list of files committed in revision 570 of SVN
svn log -r 570 -v
Show the list of previous 5 users who have commit the file in SVN
svn log -l 5
Show the previous 5 logs of AjaxController.php
svn log -l 5 AjaxController.php
Show the previous all logs of AjaxController.php
svn log AjaxController.php