Unix Resources
- A collection of everyday Unix Commands
- A link to a comprehensive Unix
help page.
- How
to use CDE (a manual specific for Solaris but applicable to CDE in general).
UNIX commands everyone should know:
ls
- List directory's contents
cd
- Change directory
Format: cd [dir]
cp
- Copy files
Format: cp [path1/source.file] [path2/destination.file]
rm
- Remove (or delete)
Format: rm file
mkdir
- Make directory
Format: mkdir dir
rmdir
- Remove directory:
Format: rmdir dir
chmod
- Changes the permission modes of files and directories.
-o change others permission
+ add permission's
r= read
w = write
x = execute
example chmod -o+rx index.html
allows index.html to be read and executed by others
top
Very useful, but not neccesary, commands
mv
- Move
Format: mv path1/file1 path2/file2
quota
- Displays the user's quota (maximum disk space). Some
machines have the command
myquota
.
Format: quota
cat
- Concatenate: echos contents of any number of files to the screen.
Format: cat [file1]
grep
- Searches files for strings and echoes those entire lines to
the screen. To make the search case insensitive, type
grep
-i
. You may use wildcards like * and ?
to specify a set of files.
Format: grep [-i] "string" file(s)
head -n
- Head: echos first n lines of a file to the screen. The command
tail
will echo the last lines (default is 10 lines).
Format: head [-n] file
clear
- Clear screen
Format: clear
wc
- Counts the lines, words and characters in a file.
Format: wc file
ispell
- Checks the spelling of words in a file.
Format: ispell file
Format for TeX© files: ispell -t file.tex
whereis
- Displays the location of commands.
Format: whereis command
du
- Disk usage for the current directory and all subsequent
directories. The attribute k (as in
du -k
) will display the
disk usage in kilobytes instead of blocks (1 block = 512 bytes?).
Format: du [-k] [path]
df
- Free disk space on current disk.
Format: df [path]
top
Other interesting commands:
touch
- Create a file. When an existing file is touched, UNIX thinks
the file was modified (but it wasn't). This means that if you
are programming and 'make' the program, the touched file will be
re-compiled.
Format: touch new_file
>
- Output redirection (puts output of command into
file)
Format: command > file
Redirecting to
/dev/null
simply ignores the output.
>>
- Append (adds the output of command to the end of
file)
Format: command >> file
tee
- Redirects output of a command to a file AND prints it to the screen.
It is useful to think of a pipe leading to a "tee" connection -- one
input and two outputs.
Format: command | tee file
who
- Lists the login names of everyone currently logged in. For more
information on the users logged in, try the command w.
Format: who
date
- Displays the current date and time.
Format: date
whoami
- Echoes the login name to the screen
Format: whoami
id
- Echoes the user and group ID number.
Format: id
file
- Finds out what the file format is.
Format: file filename
webster
- Online dictionary (not on many machines).
Format: webster word
units
- Converts between units
Format: units
write
- Sends messages to another user (who is logged on).
Format: write username
nslookup
- Looks up the name and IP address of a server.
Format: nslookup servername
apropos
- Finds commands that have to do with a keyword. The command
man -k
does exactly the same thing and is easier
to remember.
Format: apropos keyword
source
- Executes a file. For instance,
source
.cshrc
will execute the file so that you don't
have to login in again if it is changed.
Format: source file
! (bang)
- Executes the last command. If a number is specified (e.g.
!n
) the nth command executed in the
session will be repeated. To repeat the last command that started
with a certain expression, type !expression
.
Format: ![number or expression]
top
- Lists the top processes (the ones that are taking the most
processor time).
Format: top
<CTRL>z
- Suspends current job (program). The job temporarily stops
executing, but this is useful because you can execute things at
the prompt without quiting the job. Type fg to put
the job back in the foreground. Also, you can type bg
to make the job continue executing in the background as if you typed
an ampersand ("&") at the end of the line when you first executed
the job.
bg
- Puts a suspended job (job number n) in the background.
Format: bg [n] (NOTE: Here, brackets
are needed when specifying a number.)
fg
- Brings a job (job number n) to the foreground.
Format: fg [n] (NOTE: Here, brackets
are needed when specifying a number.)
jobs
- Lists the jobs running in the background.
Format: jobs [-l]
printf
- Print formatted output to standard output. This includes numbers
and text.
Format: printf "format statement" values
mesg
- Allows/denies permission for other users to send you messages.
Format: mesg y/n
top
Last modified by CS-GSO,
Sunday, 27-Nov-2005 09:10:19 EST