Você está na página 1de 3

Managing Directories

pwd cd xyz mkdir xyz rmdir xyz show the current working directory change working directory to xyz create directory named xyz remove/delete directory named xyz

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

Managing Files
ls ls file1 ls dir1 ls -l list files in the working directory list file file1 if it exists in the working directory list contents of the directory dir1 list directory contents with addtional information (long listing) ls -a list all files including hidden ones (.* files) cat file1 display contents of file1 more file1 display contents of file1, one page at a time head -n file1 display first n lines (default=10) of file1 tail -n file1 display last n lines (default=10) of file1 rm file1 remove/delete file1 rm -i file1 remove/delete file1 but inquire for confirmation cp file1 file2 copy file1 to file2 cp file1 dir1 copy file1 into directory dir1 mv file1 file2 move file1 to file2 (i.e., rename file1 to file2) mv file1 dir1 move file1 into directory dir1 diff file1 file2 display lines which are different in file1 and file2 For more descriptive help on searching, sorting etc., go to File Manipulation Utilities.

Managing Jobs
ctrl-c ctrl-z bg fg ps kill PID jobs kill current job suspend current job run suspended job in background bring suspended/background job to foreground list processes by their process identifier (PID) kill process with process identifier PID list your jobs by job number

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

System Information
who whoami df du list users logged onto the system displays your logon ID (username) display number of free blcoks on disk display disk usage

Utility Programs
wc file1 displays the number of lines, words and characters in file1 sort file1 sort contents of file, send results to standard output grep pattern file1 look for pattern in file1, send results to standard output tar file1 write to or retrieve file1 from an archival storage medium (e.g., tape) compress file1 compresses file1 and writes file1.Z uncompress file1.Z restores file1 from compressed format uniq file1 file2 delete duplicate lines in file1 and write the new version of file1 into file2 find path -name \search the directory tree path file -print /for file and display echo string 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)


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

| (pipe) >> >>&

send output from first command to input of second command append standard output append standard output and error

Você também pode gostar