UNIX C Shell Cheat Sheet

Reviews
Shared by: elitecx764
Stats
views:
0
rating:
not rated
reviews:
0
posted:
11/5/2009
language:
English
pages:
0
UNIX C Shell Cheat Sheet Setup Terminal Setup Setting Path Variable Password Changing Changing Default Shell Help Logging Out % stty erase ‘^?’ kill ‘^U’ intr ‘^C’ % set term=vt100 % set path=(directory ... directory) % passwd % chsh Directory Manipulation Creating Directories % mkdir directory % cd Changing Directories % cd directory Displaying Current Directory % pwd Removing Directories % rmdir directory Miscellaneous Commands % man command % man -k topic % logout % Finding Files Searching Files Sorting Files Comparing Files % find directory -name filename -print % grep string filename % sort [-o output-file] filename % diff filename1 filename2 % cmp filename1 filename2 File Manipulation Listing Files Displaying Files % ls % cat filename % more filename next page next line q quit % cp file1 file2 % cp file1 [file2] ... directory % cp -r directory1 directory2 Use the -i option to prompt before overwriting files. File Protection User and Permission Types u g o r w x file owner (u is short for user) group members all other users read permission write permission execute permission (for directories, allows users to use the directory name in a pathname) Copying Files Moving Files % mv file1 file2 % mv file1 [file2] ... directory % mv directory1 directory2 Use the -i option to prompt before overwriting files. Displaying File Protection Changing File Protection % ls -l filename % chmod [ugo][+-=][rwx] filename % chmod nnn filename numeric protection mode table r w x user 400 200 100 group 40 20 10 other 4 2 1 Removing Files % rm filename % rm -r directory Use the -i option to prompt before deleting files. Printing Files % lpr filename Default Protection % umask nnn The umask value is subtracted from 666 for new files and from 777 for new directories. I/O Redirection Input Redirection Output Redirection (overwrite) Output Redirection (append) Error Redirection (overwrite) Error Redirection (append) Noclobber Variable % command < filename % command > filename % command >> filename % command >& filename Special Files .cshrc This file, if it exists in your home directory, is automatically executed at login. Must begin with “#” to indicate C shell script. .cshrc typically includes C shell specific commands such as the set noclobber, set history, set savehist, and alias commands. .login % command >>& filename % set noclobber Setting the noclobber variable protects files from being accidentally overwritten due to output redirection (but not cp, mv, etc.). “!” following any redirection operator overrides noclobber. This file, if it exists in your home directory, is automatically executed at login. Must begin with “#” to indicate C shell script. .login typically contains generic UNIX commands such as the stty, set path, and umask commands. .logout This file, if it exists in your home directory, is automatically executed at logout. Must begin with “#” to indicate C shell script. .logout typically contains commands to perform cleanup. Piping Operator % command1 | command2 C Shell Specific Commands Enable Tracking of Commands Displaying Command History Re-executing Previous Commands % set history=n % history !! !n !string !-n !?string? previous command nth command last command beginning with string nth most recent command last command containing string Job Control Running Jobs in the Background Stopping Foreground Jobs % command & % command . . . % % jobs % kill %job-number % kill process-id % fg %job-number % bg %job-number % ps % ps -a % ps -x % who % whoami lists all your processes lists all running processes full listing for given option Job Status Killing Jobs Bringing Jobs to the Foreground Moving Jobs to the Background Process Status Saving Command History Setting Aliases Displaying Aliases Deleting Aliases % set savehist=n % alias alias-string command-string % alias % unalias alias-string Displaying Users

Related docs
UNIX C Shell Cheat Sheet
Views: 92  |  Downloads: 17
UNIX Linux Shell Cheat Sheet
Views: 15  |  Downloads: 6
UNIX Linux Shell Cheat Sheet
Views: 236  |  Downloads: 61
SmithFCAD Unix Cheat Sheet
Views: 5  |  Downloads: 0
_____ _- Shell ______ Unix
Views: 4  |  Downloads: 0
UNIX CHEAT SHEET
Views: 49  |  Downloads: 8
Unix Cheat Sheet
Views: 53  |  Downloads: 12
UNIX Cheat Sheet
Views: 74  |  Downloads: 19
Unix command line command cheat sheet
Views: 269  |  Downloads: 57
Unix Tutorial
Views: 164  |  Downloads: 40
Other docs by elitecx764