Explore

Loading

Thursday, February 16, 2012

Unix Commands


.
6.3. Automating Tasks
Create a Makefile pico Makefile
A makefile consists of macro definitions and targets.
Test Makefile make -n [target]
Run make make [target]
6.4. Managing Disk Usage
Check Quota quota -v
Seeing Disk Usage df
du -s
6.5. Combining and Compressing Files
Create a tarfile tar cf file.tar file1 file2 … fileN
tar combines files but does not compress
Create a zipfile zip filename
Unzip a file unzip filename
7. Printing
7.1 Formatting Output for Printing
Paginate with Page Headers pr filename
in n columns pr -n filename
Format for Laser Printer tex document
7.2 The Printer Queue
Print a File lp [-dpr] filename
lpcae filename
Check Quota lpquot
List Queue lpq
Stop Job lprm
8. Miscellaneous
8.1 Miscellaneous Commands
List Commands for Subject man -k subject
Display Current Date and Time date
Log off exit
Electronic Mail pine
Display Documentation man command
8.2 Control Keys
Abort Program CTRL-C
Backspace (Delete Last Character) CTRL-H
Pause Display on Screen CTRL-S
Resume Display after CTRL-S CTRL-Q
Send Job to Background CTRL-Z followed by bg

Unix Commands


Modifiers
Print Command Line :p
Substitute Command Line :[g]s/l/r/
3.2 Aliases
alias Command alias name 'definition'
definition can contain escaped history substitution event
and
word designators as placeholders for command-line arguments.
3.3. Variable Substitution
Creating a Variable set var
Assigning a Value set var = value
Expressing a Value $var
Displaying a Value echo $var
value is a single word, an expression in quotes, or an
expression that results in a single word after variable,
filename and command substitution takes place.
Assigning a List set var = (list)
list is a space-separated list of words, or an expression that
results in a space-separated list.
Selecting the n'th Item $var[n]
Selecting all Items $var
Selecting a Range $var[x-y]
Item Count $#var
3.4 foreach Lists
Start foreach Loop foreach var (list)
foreach prompts for commands to repeat for each item in
list (with >), until you type end. Within the loop, $var
stands for the current item in list.
3.5. Command Substitution
Replace Command with its Output on Command Line ``
3.6 Job Control
Run Command in the Background &
Stop Foreground Job CTRL-Z
List of Background Jobs jobs
Bring Job Forward %[n]
Resume Job in Background %[n] &
4. Processes
Listing ps [-[ef]]
Terminating kill [-9] PID
Timing time command
time is a number up to 4 digits. script is the name of a file
containing the command line(s) to perform.
5. Users
Seeing Who is Logged In who
w
Seeing Your User Name whoami