P. 1
UNIX Basics

UNIX Basics


|Views: 454|Likes:
Published by sreenivasdw

More info:

Categories:Types, Brochures
Published by: sreenivasdw on Feb 07, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PPTX, PDF, TXT or read online from Scribd
See more
See less





cp file1 file2

copy file1 and call it file2
mv file1 file2 move or rename file1 to file2
rm file

remove a file
rmdir directory remove a directory
cat file

display a file

more file

display a file a page at a time

head file

display the first few lines of a file

tail file

display the last few lines of a file
grep keyword' file search a file for keywords
wc file

count number of lines/words/characters



Basic Unix Commands

ps report process status

-e Lists information about all process now running
-f Full listing

echo echo arguments

\c Continues the output on the same line
echo “Hello World!”

chmod change mode

chmod 755

ls directory listing

-a list all entries including those beginning with .
-l long listing

Basic Unix Commands Contd.

cat concatenate and display files

-b number the lines as in n but omit numbers for blank line
-s silent about non-existent files

find find files

-name True if pattern matches the current file name
-print causes current path name to be printed
find -name -print

grep search a file for a pattern

-l print only the name of the file with matching lines
-v print all lines except those that contain the pattern

date write the date and time

date ‘+%m%d%y’
-u display the date in GMT

Basic Unix Commands Contd.

cp copy files

-i interactive copy
-r copy files and subdirectories

mv move files

-i asks for confirmation before moving if file already exists
-f move without prompting

rm remove files

Same options as cp/mv

who who is on the system

-m output info about current terminal
-q display only names and number of users currently logged in

whoami display the effective current username

Basic Unix Commands Contd.

pwd print working directory

wc line, word and character count in a file

-l count number of lines
-w count number of words

more list file contents by screen

-c clear before displaying
-w prompts and waits for key to be hit before exiting

diff show difference between two files

-i ignore the case of the letters
-w ignore all blanks and spaces
diff w

Basic Unix Commands Contd.


-c list following c specifies char positions eq c1-72
-d delimiter
-f show fields separated by delimiter
cut c1-10


-d delimiter character
-s concatenate each separate line in a file into a single line
paste >

sort sort the file

-r reverse the sorting direction
-n restricts sort key to initial numeric value

Basic Unix Commands Contd.

tee send output to terminal and file

-a append the output to existing file

uniq show unique lines in a file

-d suppress the writing of lines that are not repeated in the


-u suppress the writing of lines that are repeated in the input

expr evaluate an expression

head output beginning of file

-n number the first number of lines will be shown on std

tail output end of file

Basic Unix Commands Contd.

ln link to other file

-f link files without questioning the user
-s create a symbolic link

file show the file type

-h do not follow symbolic links

tr translate characters

tr ‘[a-z]’ ‘[A-Z]’ <


alias display command aliases

Works in ksh and csh
alias dir=‘ls –l|grep ^d’

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->