Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Rice University
July 11, 2002 mv present-filename new-filename to rename a file
Create (or Make) a Directory mv source-filename destination-directory to move a file into another
Document No. UNIX 1.01
directory
UNIX Reference Card mkdir directory-name create a directory called directory-name options: -i interactive mode. Must confirm file overwrites.
examples:
Printing permission can be any combination of
cd test change to the directory named test r (read)
w (write)
lprloc lists available printers Directory Abbreviation x (execute)
setenv PRINTER printer set the default printer
pcpasswd initialize SAMBA password for lab ~ home directory (tilde) Ex: chmod a+x filename (makes filename executable by everyone)
printing /login; only works on Owlnet’s
~username another user’s home directory
short-earred and long-earred servers
http://www.owlnet.rice.edu/webprint.shtml . current or working directory Shell Tools
web-based printing; view current charges .. parent of working directory
lpr option filename print file Wild Cards
lpq option check status of print queue ? single character wild card
lprm option remove jobs from printer queue * arbitrary number of characters
options: -Pprinter specify a printer other than the default
History: Command Repetition Run Command in Background: Job Control Program Compilation
history display list of most recent commands To run a command in the background, as opposed to the more common
f90 filename.f FORTRAN compiler (also f77 code)
!! repeat the entire last command line at any point method of running commands in the foreground, append an & to the
cc filename.c C compiler
in the current command line end of a command string. Then, you can type more commands to the
gcc filename.C C compiler (other suffixes: .cc, .cxx, .cpp, .c++)
!$ repeat the last word of previous command command prompt, or even run more commands in the background for
g++ filename.c++ C++ compiler
line at any point in current command line simultaneous command execution.
pc filename.p Pascal compiler
!^ repeat first argument from previous command
line at any point in the current command line Control-Z stop (interrupt) foreground job
options:
!n repeat command line n jobs list of background jobs
!!:p display previous command bg run a stopped job in the background -o filename direct output of program to filename
-l library include library in program compilation
!string command beginning with string fg resume stopped job in the background
!* repeat all arguments to previous command
File Operations
Command I/O User Information and Helpful Commands
> command output redirection (create new) Search for Patterns in Files env lists your environment settings
>> command output redirection (append) who lists users on the local system
< command input redirection (from file) grep search-string filename [filename...] to find and type out lines con-
finger username@host.domain
<< command input (from script or standard input) taining the string in a file
looks up information on another user
Alias options: -v type out lines that don’t contain the string (invert the search)
clear clears screen
ntalk username@host.domain
alias alias-string command-string Counting Words in a File talk to another user
wc filename counts the number of words, lines, or characters in a file lprloc shows names and locations of printers
Alias abbreviates a command string with an alias string. For multi-
stty sane resets terminal characteristics to a
command strings, enclose commands in quotes. options: -w words
usable set
-l lines
stty display terminal characteristics
Example: alias shut chmod go-rwx -m characters
date displays current time and date
cal year for yearly calendar
To use the aliased command shut on a file, and turn off read, write, and Compare Files cal ## #### for monthly calendar
executable permissions for all users except yourself, type shut filename.
diff filename1 filename2 compares contents of filename1 and filename2 (month-year)
on a line-by-line basis ssh host.domain user interface to a remote system
Process Control
which command locate a command; display its pathname
File Transfer
Process Status spell filename report spelling errors
mail address sends mail to user at the specified address (using the for-
ispell filename interactive spell-checker
ps (display the status of the current processes) mat is user@host.domain). ^d terminates input and sends message.
options:
-a include processes owned by other users echo $path inspect your search path
ftp host.domain use file transfer protocol to connect to remote host
-g display all processes computer. Type ? for commands.
-u display user-oriented processes bc basic calculator (^d to exit)
-x include processes with no controlling terminals Compress Files du display the number of disk blocks used
-gx display all of your local processes
per directory or file
compress filename compress file and rename it filename.Z
kill id-number terminate a process owned by you du -s display your total disk usage
uncompress filename.Z decompress file and rename filename
The id-number (PID-Process ID) can be quota -v display your disk quota and usage
gzip filename compress file and rename it filename.gz
found by first using the ps command. gunzip filename.Z decompress file and rename filename