common unix command

Upload: deep-das

Post on 04-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Common Unix Command

    1/3

    Managing Directoriespwd show the current working directorycd xyz change working directory to xyzmkdir xyz create directory named xyzrmdir xyz remove/delete directory named xyz

    Directory Identifiers~(tilde) your home directory.(dot) the current working directory.. the parent directory (one level up)/ root directory

    Managing Filesls list files in the working directoryls file1 list file file1 if it exists in the working directoryls dir1 list contents of the directory dir1ls -l list directory contents with addtional information

    (long listing)ls -a list all files including hidden ones (.* files)cat file1 display contents of file1more file1 display contents of file1, one page at a timehead -n file1 display first n lines (default=10) of file1tail -n file1 display last n lines (default=10) of file1rm file1 remove/delete file1rm -i file1 remove/delete file1 but inquire for confirmationcp file1 file2 copy file1 to file2cp file1 dir1 copy file1 into directory dir1mv file1 file2 move file1 to file2 (i.e., rename file1 to file2)mv file1 dir1 move file1 into directory dir1diff file1 file2 display lines which are different in file1 and file2

    For more descriptive help on searching, sorting etc., go toFile Manipulation Utilities.

    Managing Jobs

    ctrl-c kill current jobctrl-z suspend current jobbg run suspended job in backgroundfg bring suspended/background job to foregroundps list processes by their process identifier (PID)kill PID kill process with process identifier PIDjobs list your jobs by job number

    http://www-d0.fnal.gov/d0unix/archive/Unixhelp/utilities2_.htmlhttp://www-d0.fnal.gov/d0unix/archive/Unixhelp/utilities2_.html
  • 7/30/2019 Common Unix Command

    2/3

    On-line helpman command display manual entry for commandman -k keyword list manual pages that pertain to keywordinsight on-line help on SGI (X version)learn on-line tutorial on IBM

    System Informationwho list users logged onto the systemwhoami displays your logon ID (username)df display number of free blcoks on diskdu display disk usage

    Utility Programswc file1 displays the number of lines, words and characters

    in file1sort file1 sort contents of file, send results to

    standard outputgreppattern file1 look for pattern in file1, send

    results to standard outputtar file1 write to or retrieve file1 from an archival

    storage medium (e.g., tape)compress file1 compresses file1 and writes file1.Zuncompress file1.Z restores file1 from compressed formatuniq file1 file2 delete duplicate lines in file1 and

    write the new version of file1 into file2findpath -name \search the directory tree path file -print /for file and displayechostring translate parameter string and display

    Special Characters* match any character (wild card)& put job in background! repeat previous command; Concatenate several commands on one line# start of a comment#! first two characters of a shell script

    I/O Redirection Commands (csh, tcsh)

    < redirect standard input (get input from)> redirect standard output (write output to)>& redirect standard output and standard error>! redirect standard output, overwrite file if it exists>!& redirect standard output and error, overwrite file if itexists

  • 7/30/2019 Common Unix Command

    3/3

    | send output from first command to input of second command(pipe)>> append standard output>>& append standard output and error