Cool Unix Tricks
How do I tell where my friend is logged in from? You can find out your friend's physical location is they're logged into ella. First, figure out what computer she's on. Do a 'w'. You should get a line that looks like:
celesteh q25 mac8500-331.mi 6:45pm 11 -tcsh
What you are interested in is the third string of data: mac8500-331.mi. This is the network address of the computer she's logged in to. The ip address and physical location for this computer (provided it's on campus) is stored in a file called /etc/hosts. Because the file is really long, you probably don't want to search for the name of the computer by hand. Luckily, you can just get the lines you are interested in with a command called grep. Just type:
grep mac8500-331 /etc/hosts
The line you get back looks like:
184.108.40.206 mac8500-331.mills.edu # CPM 200
Tada! You now know that celesteh is in CPM 200.
Why is ella running so slow?
Ok, so it's not a trick, but y'all ask every so often . . . The problem is with something called the Load average. many many pine session + student news spam + ppl working on their compiler projects means that ella's load average gets kicked up purty high. which makes ella slow :(
when you do a "w", the load average is displayed at the top. You can get just that line by itself with the command "uptime" for a second by second view of the load average, plus a glimpse of what proggies are gobbling up all the cpu, type "top" without the quotes at the prompt. when you want to get out of top, hit control-c. it's fun and exciting.
What does HTTP stand for? What does it mean?
http == hyper text transfer protocol. it's the text yer browser sends to the web server asking for a page. the first line is
GET <the relative file name> <the HHTP version number>
and then you can add optional information or press return twice.
telnet www.mills.edu 80
then, after it tells you about the escape char, type:
GET / HTTP1.0
and hit enter twice
it should give you a bunch of headers and then the contents of the URL you requested.
One of those headers should say what web server we're running. Last I checked, it was Apache. apache is a free web server that runs on unix. it works the default way thhat web servers should work, so if you find a description of pretty much any webserver (except one made by microsoft or netscape), apache should work the same way.
both HTTP and Apache are described in the o'reilley book "managing internet tresources." i think cola has a copy. it's blue and has seals on the cover. lcl should have a copy too. she used to have a policy where students could borrow some of her books.
How do I log myself out from a computer across campus?
let's say you suddenly remeber you left yerself logged in across campus. you want to log yerself out, but you don't want to have to go all the way back to the puter you abandoned.
luckily, being logged in is tracked by ella the same way that any other program you run is. That means you have the power to kill it (kill = terminate execution). You can find a losting of what programs (or processes) you are running from you local terminal by running "ps"
ella % ps PID TTY TIME COMD 2990 ttyr31 0:00 csh 3057 ttyr31 0:00 ps
the PID is the unique ID number for the process. the tty is the terminal controlling the process (the system's pointer to yer log in shell). the time is the amount of cumulative CPU time taken by the process. And COMD is the command being executed. csh is my shell. When you run ps, you should see a shell listed. It should be either csh, tcsh or bash in most cases. now let's see what other processes you are running aside from at your local terminal:
ella % ps -u <yer login name> PID TTY TIME COMD 4542 pts/131 0:00 ps 26721 pts/127 0:01 tcsh 2990 pts/131 0:01 csh 2450 pts/127 0:00 forumone of these processes (#2990) we saw earlier, from the local terminal. the rest are being run from someplace else. But since we left ourselves running them accidentally, what we want to do is kill them. Luckily, if we kill the shell, all the programs running under it will also be killed AND the log in session will close. since we are running the shell under process 2990 locally, the one we must want to kill is 26721. type:
ella % kill -9 26721
the -9 part means "kill no matter what." normally, shells don't respond to kill commands, but the -9 forces them to die. run "ps -u <yer login name>" again to make sure you've actually killed your session.
You can use ps and kill to terminate any process you want. for instance, if forum hung, i could log in another window and kill forum. With any program besides a shell, you want to try to kill it first without the -9. but if that doesn't work, you'll have to use it.