Unix Commands
Unix Commands
FILE COMMANDS
DIRECTORY COMMANDS
SYMOLIC LINKS
TERMINAL COMMANDS
HELP COMMANDS
INFORMATION COMMANDS
USEFUL CSHELL SYMBOLS
PERMISSIONS AND FILE STORAGE (UNIX)
PERMISSIONS AND FILE STORAGE (ANDREW)
PROCESSES
PRINTING
ENVIRONMENT
CUSTOMIZING
NETWORKING
X-APPLICATIONS
UNIX FILTERS
Orientation 98 page 1
FILE COMMANDS
cp Copy files.
Usage: cp [options] <source-filename> <destination-filename>
cp [options] <source-filepath > <destination filepath>
Options: -r recursively copy directory structures.
rm Remove files.
Usage: rm [options] <filname>
Options: -r recursively remove directory structures.
-i query user for confirmation.
more View file contents in sections determined by the size of the terminal.
Usage: more <filename>
less View file contents in sections determined by the size of the terminal.
Has more options and search features than more.
Usage: less [options] <filename>
compress Reduces the size of the file. and adds the extension .Z
Usage: compress <filename>.
Orientation 98 page 2
DIRECTORY COMMANDS
cd Change directory.
Usage: cd <filename>
Eg: cd my-directory
cd go to home directory
cd .. go up one directory
SYMBOLIC LINKS
Orientation 98 page 3
TERMINAL COMMANDS
HELP COMMANDS
help Opens the default web browser in the andrew unix help web site.
http://polaris.andrew.cmu.edu/help/sys=sun4_55/env=gamma/Top-
Page
rtfm Displays the man page and help files ont he terminal.
Usage: rtfm <command-name>
INFORMATION COMMANDS
Orientation 98 page 4
wc Counts and displays the number of lines, words and characters of a
file.
Usage: wc [options] <filename>
Options: -c count character only.
-l count lines only.
-w count words only.
Orientation 98 page 5
USEFUL CSHELL SYMBOLS
>> Append (the result of the command) to the end of the file.
Usage: command >> file-name
Eg: pwd >> existing-file
& Run process in the backgound so that the shell remains active.
Usage: program-name &
program-name filename &
Orientation 98 page 6
[] Match any of the enclosed characters.
Eg: grep [abc] filename
grep [a-z] filemane Hyphen is used to specify a range.
&& The logical and symbol : execute first command then if successful,
the second command.
Usage: <command1> && <command2>
|| The OR symbol : executes the first command or, if it fails, the second
command.
Usage: <command1> || <command2>
Orientation 98 page 7
PERMISSIONS AND FILE STORAGE (UNIX)
Orientation 98 page 8
PERMISSIONS AND FILE STORAGE (ANDREW)
Permissions:
r read
l list
i insert
d delete
w modify
a administrative
Orientation 98 page 9
PROCESSES
PRINTING
Orientation 98 page 10
ENVIRONMENT
CUSTOMIZING
Orientation 98 page 11
unalias Removes the alias from its bound commands.
Usage: unalias <shortcut>
set filec If filec is set, any partially typed filename can be expanded to its full
name whenever esc key is pressed.
Usage: set filec
source Reads commands from a file. Used to reload an updated .cshrc file
into the current working shell.
Usage: source filename.
Orientation 98 page 12
NETWORKING
setenv DIS- Allows the remote host to display its x-applications onto the local
PLAY terminal.
Usage: setenv DISPLAY <local-hostname or IP address>:0.0;
Eg: setenv DISPLAY bernini.arc.cmu.edu:0.0
setenv DISPLAY 128.2.120.96:0.0
ftp File transfer program: Allows the get and put of files between com-
puter accounts.
Usage: ftp <remote-hostname>
Inside ftp: put <local-filename>
get <remote-filename>
mget <filename>gets multiple files.
eg: mget *
mput <filename> puts multiple files.
eg mput *
lcd changes the local directory.
help lists all ftp commands.
quit or bye exits ftp.
Orientation 98 page 13
talk Exercise >> to be completed by students.
X-APPLICATIONS
Orientation 98 page 14
UNIX FILTERS
Orientation 98 page 15
join A database operator that joins the common lines of two sorted files.
Usage: join <file1> <file2>
Orientation 98 page 16