Solving Problems

These are some useful things to know about dealing with problems that tend to occur once in a while.

Listing your processes and killing them

You may have to do this e.g. when you got kicked out of a modem connection. Use ps -fl -u username to list your processes and find the process ID. Normally, when you have been kicked out of a dialin session or have otherwise managed to get yourself disconnected abruptly, this list will contain the processes you need to kill. Those may include the shell (tcsh or whatever you're using), and anything you were running, for example emacs or elm. Be careful not to kill your current shell - the one with the number closer to the one of the ps command you're currently running. But if it happens, don't panic. Just try again :) If you're using an X-display you may have to kill some X processes before you can start them again. These will show only when you use ps -efl, because they're root processes. Then use kill PID to 'kill' (end) the processes with the ID you gave. This works only for your own processes, of course. If the process doesn't 'die' properly, use the option -9. But attempt without that option first, because it doesn't give the process a chance to finish possibly important business before dying.

# files saved by emacs

Emacs is very good about saving copies in case of an emergency, such as a dying modem connection. They are put in a file with the same name as it had before, except with a hash at the front and end (#filename#). When you start editing the file again emacs will ask you whether you want to work with this emergency copy instead.

snd.XXXX files in /tmp

If you were typing away at an e-mail message and got kicked off the system, the message you've been working on is probably still around, as a file of the form snd.XXXX or #snd.XXXX# in the directory /tmp. To find it, do
find /tmp -user username -name \*snd\* -print

Cleaning up when you've exceeded your quota

Most Unix accounts at Stanford impose a quota on disk storage. To see what your quota is how much space is still available, type sweetquota on the Leland system, or quota -v from CSLI accounts. If you're over quota, this will also tell you how much time you have to fix the problem. The numbers are shown in kilobytes, i.e. 2000 means 2 megabytes. There are two things you can do to reduce the amount of space you're using - compress files, using gzip, or delete them. gzip gets files down to about half their original size, but it depends very much on the size of the file and the nature of the contents (large text files compress best). There are other tools for this purpose, too (e.g. compress), but gzip usually gives the highest compression rate. It produces files with the ending .gz appended to the original filename. You can use gunzip to uncompress the file again, or gzcat to just look at it.

Here's an alias I find useful for finding the biggest non-gzipped files, i.e. the ones that would improve the situation most if you gzip or delete them: alias rslsgz 'ls -Ral | grep '-' | grep -v '/' | grep -v '.gz' | sort -rn +4 | more' This will look through all your directories and list your files by size (in bytes), the biggest one first. If you can't remember where the file is you'll have to use ff or find to find it.

Another way of finding big files is using the command du -a | sort -rn | more It lists all your files with their size, ordered by size (in 512-byte blocks). The advantage is that you'll see which directory the files are in. Also try du -s, which gives you the total for the current directory. If you do it while you're in your home directory and it doesn't roughly match with the result of quota -v you probably have files somewhere other than in your home directory. For example this may be your incoming mail, if it's stored on the same filesystem as your home directory. If the difference is big and you want to find out what causes it, try find / -user username -print

Files that you can probably remove are those ending in .dvi or .ps - these are the results of running LaTeX and can be reproduced if you have the corresponding .tex file. They also tend to be large, so worth removing. You can also remove all files ending in ~ - those get created as backup copies when you're editing a file in emacs, so they're just old versions of your files. If you're using netscape on turing directly, look at the directory .netscape-cache or .netscape/cache - it probably contains a large number of large-ish files. You can remove all of them - these are copies of the pages you looked at when surfing the web. If you surf the web a lot, your .mosaic-global-history or .netscape-history may also have gotten large. These determine which links get marked as having been followed, so this information will be lost if you delete them. Also check your .newsrc file. It may contain large numbers of unsubscribed newsgroups, which you can delete, either by editing the file directly, or by using nntidy -r If you use mosaic or netscape to read news, they may have created additional files.

Another place to look for files you might be able to delete is those you haven't looked at in a long time. Do do that, use ls -alrut

Also look at help cleanup.

Sometimes the space problems may not be with your quota but with the whole filesystem. To see how full it is, type df . You can improve the situation by sorting your own files and reducing your disk space usage, but you may not be able to fix the problem for very long. Send mail to action if this is happening and you suspect you're the first person to notice (because it's the middle of the night or so).

Other problems

If you have other problems, look at Electronic Sources of Information and Non-Electronic Sources of Information. These contain various suggestions of how to get help. Try the electronic ones first, i.e. look at man pages and help files, but don't waste too much time on your problem and don't hesitate to ask people for help. They can always tell you that you should read some particular manual or do a tutorial, but often they can give you a quick and helpful answer.
Back up to the Main Computing Page