Wednesday, January 30, 2013

Basic UNIX commands



Below are the basic unix commands which may help you while using PUTTY to access the server. Move, copy, view the pages from folder to other destination. All other basic stuff syntax are given below


If there are images in this attachment, they will not be displayed.  Download the original attachment
Unix Basic Commands

Copy:

cp sorce_file target_file  :copies only if the files are in current direc

cp -r sor_DIR target_dir (to copy directories)

Move/Rename;

mv file1 file2

mv -i f1 f2 (asks for permision to move or not)

Remove:

rm filename

rm -r file (to remove directory structure)

rm -i file ( asks for permision to move or not)

view:

cat filename ( to view the complete file content)

To extract or unzip files:

unzip file ( extracts file to current dir)

To uncompress

uncompress filename

To compress

compress filename

To change directory

cd path

to list files in current dir

ls

ls -l (long list of files : gives acess permision,creation date..etc)

    -a(list all files satarting with a " .")

to make a dir

mkdir name or md name

to remove

rmdir dir_name

to clear the screen

clear (clears the windoe or terminal)

help commands

man <comd name> (displays the mannual page)

whatis <cammnd> (gives description)

date (to dispaly the date)

to count the words

wc filename (gives lines,words,characters

wc -l file (only lines)

wc -c file(only characters)

wc -w file(onbly words)

df ( displays the amount of free space)

grep (search a file for matching pattern)

grep [optioln]<regularExpression filename

eg: grep [a-z]*.c filename

1 comment:

dskanth said...

Note: We can also view the contents of a file with "vi" command.

Ex: vi abc.php