You are on page 1of 5

UNIX COMMANDS

Files and Directories

 cat <filename> - To create a File

 CTRL-D - To save a File

 ls - To list all files in a directory

 ls <filename> - To list mentioned File

 lsf - To list all files with directories

 ll - To list names of files,its Directories and permissions


• if a file name starts with '.',that is invisible file

 ls -a - To list Invisible files also

In Unix file name is "Case sensitive" 'Money' and 'moneY' are treated as two files

 more <filename> - To view content of the textfile

 Press 'SPACE' to viwe content of longer file. Press 'Q' to quit or when
finished

 head <filename> - To display first 10 lines of file

 tail <filename> - To display last 10 lines of file

 head -25 <filename> - To display first 25 lines of file

 lp <filename>- To Print a file

 lpstat -t - To display the printjob information

 cancel <request_id> - To cancel the print

 mv <old filename> <new filename> - To rename oldfile to newfile

 mv </path1> </path2> - To rename file in path1 to path2

 mv -i <old filename> <new filename> - To ask confirmation if newfile is already


o existing

 mv -i </path1> </path2> - To rename file in path1 to path2 with confirmation

 cp <filename1> <filename2> - To copy file1 to file2

UNIX COMMANDS Page 1 of 5


 cp </path1> </path2> - To copy file in path1 to path2

 cp -i </path1> </path2> - To copy file in path1 to path2 with confirmation

 cp -i <filename1> <filename2> - To ask confirmation to overwrite

 cp -r <dir1> <dir2> - To copy directory

 rm <filename> - To remove a file

 rmdir <dir> - To remove a directory

 rm -rf <dir> - To remove directory and all of its contents

 rm -i <filename> - To remove a file with confirmation

 diff <filename1> <filename2> - To find difference b/w two file texts

 cat <filename1> >> <filename2> - To Append the file1 to file2

 pwd - To display absolute path in which we are in

 mkdir <directory name> - To create a Directory

 mkdir <dir1>/old - To create old in dir1

 cd - To change home directory

 cd <path> - To change directory

 grep <text> <filename> - To list the string contains <text> in file

 grep -i <text> <filename> - case sensitive

 grep <word> <file1> <file2> <file3> - To list the string contains <word> in multiple
files

 find -name <d*> - To find all files starting with letter D

 find <dir_path> -name <filename>- To find a file in mentioned directory

 cal - To display English calendar for current month

 cal 5 2010 - To Display 5th month of 2010

UNIX COMMANDS Page 2 of 5


VI (visual) Editor Commands

 vi <filename>- To edit a file

 i - To insert text before cursor

 I - To insert before the first character of line

 a - To append text after cursor

 A - To go at the end of line

• - To open a blank line to below cursor

• - To open a blank line to above cursor

 x - To delete one character

 dd - To delete current line

 ESC - To return to command mode

 :q! - To exit VI without saving changes

 :w - To save the current file

 :wq - To save the current file and exit VI

 :W <file1> - To save the current file to file1

 :w! <file1> - To overwrite contents of file1 with current file

 :r <file1> - To insert contents of file1 into current file

 :!<command> - To run a UNIX command while in VI

 u - To undo the last change made to text

 U - To undo the all the changes made to single line

File Transfer Protocol - ftp

 ftp <hostname> - To connect to remote host for doing ftp

 ? - To see a list of available commands in remote host

 get <remote file> <local file> - To transfer file from remote host to local host
<remote file> is the path of file to be transferred.

UNIX COMMANDS Page 3 of 5


<local file> is the path of file where to be Transferred.

 put - To transfer file from the local machine to the remote machine.

UNIX COMMANDS (SAP BASIS)

 ps -ef - To find what process are running

 kill <PID> - To stop a process

 kill -9 <pid> - To stop a Unresponsive process

 ps –ef | grep tp - To see the transport process is running or not......

 ps –ef | grep sap - To see the sap system is up or not..


Here we see the all the work process

 ps –ef | grep ora - To see the background process running or not

 BDF - View Overall Filesystems


 bdf . (Checking the particular filesystem you are currently in)

 PS - View overall running processes

 ps –eaf | grep dw (Checking SAP System running or not)

 ps –eaf | grep ora (Checking whether oracle DB is running)

 ps –eaf | grep webdisp (Checking if the Web Dispatcher is running)

 chmod - Changing access modes of a file. Read (4), Write (2) and Execute (1)
eg. chmod 775 filename (rwxrwxr-x)
chmod 755 filename (rwxr-xr-x)

 chown - Changing owner of file


eg. chown bw1adm filename

 chgrp - Changing group of file


eg.---- chgrp dba filename

 ls - Listing files in a particular directories


 ls -al (List of all Files)
 ls -lrt (Listing the filenames with respect to Timestamp)

 pwd - Checking the exact path where you are currently standing

 rm - Remove file
 rm -rf filename (Confirm Delete)

UNIX COMMANDS Page 4 of 5


 rm -i filename (Will prompt before deleting)

 Cntrl C -Terminating whatever is running on your screen

 clear - Clear the screen

UNIX COMMANDS Page 5 of 5

You might also like