You are on page 1of 5

UNIX COMMANDS

Files and Directories

cat <filename>

- To create a File

CTRL-D

- To save a File

ls

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

- To list all files in a directory

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>

lp <filename>- To Print a file

lpstat -t

cancel <request_id> - To cancel the print

mv <old filename> <new filename>

mv </path1> </path2>

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


o existing

mv -i </path1> </path2>

UNIX COMMANDS

- To display first 25 lines of file

- To display the printjob information

- To rename oldfile to newfile

- To rename file in path1 to path2

- To rename file in path1 to path2 with confirmation

Page 1 of 5

cp <filename1> <filename2>

- To copy file1 to file2

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>

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

rm <filename>

rmdir <dir>

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

rm -i <filename>

diff <filename1> <filename2>

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

pwd

mkdir <directory name>

mkdir <dir1>/old

cd

cd <path>

grep <text> <filename>

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

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

find -name <d*>

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

cal

cal 5 2010

- To ask confirmation to overwrite

- To remove a file

- To remove a directory

- To remove a file with confirmation


- To find difference b/w two file texts

- To display absolute path in which we are in


- To create a Directory

- To create old in dir1

- To change home directory


- To change directory
- To list the string contains <text> in file

- To find all files starting with letter D

- To display English calendar for current month

UNIX COMMANDS

- To Display 5th month of 2010

Page 2 of 5

VI (visual) Editor Commands

vi <filename>- To edit a file

- To insert text before cursor

- To insert before the first character of line

- To append text after cursor

- To go at the end of line

- To open a blank line to below cursor

- To open a blank line to above cursor

- 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 undo the last change made to text

- To undo the all the changes made to single line

- To run a UNIX command while in VI

File Transfer Protocol - ftp

ftp <hostname>

- To connect to remote host for doing ftp

- To see a list of available commands in remote host

UNIX COMMANDS

Page 3 of 5

get <remote file> <local file> - To transfer file from remote host to local host
<remote file> is the path of file to be transferred.
<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>

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

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

chown

chgrp

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

- To stop a process

- View overall running processes

- 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)
- Changing owner of file
eg. chown bw1adm filename
- Changing group of file
eg.---- chgrp dba filename

UNIX COMMANDS

Page 4 of 5

rm -rf filename
rm -i filename

(Confirm Delete)
(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