Matt's Hectic UNIX Hacking Made Easy!

"Contrary to popular belief, UNIX is very user friendly. It's just very selective about who it's friends are."

"There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence."


[Directory Navigation] [File Manipulation] [Processes] [Interface]


Directory Navigation and Control
pwd show present working directory (where you are now)
cd dirname go into a sub directory
cd go to your home directory
mkdir dirname make a new directory
rmdir dirname remove directory
ls List the Contents of a Directory
ls -l
ls -p
ls --help
List the Contents of a Directory With Access Permissions
Add a / to directory names and a * to executables
Show all ls options
chmod ### filename
0 - No access
4 - Read Only
5 - Read&Execute
6 - Read&Write
7 - Full Access
changes the permissions for a file. The three digits represent the access priveleges for the user who owns the file, group that owns the file, and all other users on the system (in that order).
du Shows the Disk space that your directory and subdirectoriues use up
pushd dirnameAdd a directory to your list of recently visited directories so that you can easily return to it. Use this in place of cd.
popdReturn to the last directory added to the directory stack (using pushd)
dirsList the contents of your directory stack

Files
more filename show a text file
vi filenameEdit a Text file using VI, the Visual Editor
cp filename dirname puts a copy into a subdirectory
cp filename filename makes a copy of the file under a new name in this directory
mv move... same sytax as for copy
rm filename
rm -f filename
rm -r dirname
removes a file
Remove a file without confirming "Are you Sure?"
Removes all the files within a directory, and the directory
spell filename checks the spelling of a file!
find dirname -name filename

find / -name mattd.*

searches for a file. * is a wildcard, so to search for all files called mattd.* would find all the files with any extension after mattd. The dirname argument is the absolute path of the directory tree that you want to search. Searching the root (/) may take a long time.

Processes
ps
ps -u user
ps -e
Show the current processes for the active shell
Show all a user's processes
show all processes
kill -9 processnumEnd a process. Get the Process number from ps
man command man is the online manual for a command. If you need help with any of the commands, type man command!
nohup command Will run a command in the background such that you can quit your Telnet session
sched hh:mm command Will run a command at a given time. Type sched by itself to show all scheduled jobs, and sched -job number
iostat
Shows usage stats on your workstation. The cpu id is the percent of the CPU that is idle
w
Shows you what other users are doing right now

Interface
stty erase <hit backspace key>A common problem with UNIX interfaces is that the backspace key shows garbage. This fixes that problem, but only for the current session
clear clear screen
banner text Type banner hello and you'll see what it does!
passwd change password


Matt's Hectic VI Hacks Made Easy
Matt's Home Page
Matthew A d'Alessio / dalessio@leland.stanford.edu / Stanford University, California