CMPSC 311, General Instructions

Miscellaneous Problems and How to Solve Them




Lost Files

The CSE file system runs a backup procedure nightly.  If you deleted a file, there is a chance of recovering it.  Contact helpdesk@cse.psu.edu, or visit Barb Einfalt in 111D IST, between 8 am and 4:30 pm Monday-Friday.  You will need to know the full pathname of the file, and when it was last seen intact.

Some programs overwrite files, and are not always careful about checking the commands you give (the usual Unix assumption is that you know what you're doing, which isn't true all the time).  Here's an especially bad example, with comments added.  We did this on Mac OS X, but you would get similar bad results on Solaris and Linux.

% cat foo.c
int main(void) { return 0; }
    a small program

% ls -l foo.c
-rw-------   1 dheller  wheel  29 Aug 21 10:46 foo.c

% file foo.c
foo.c: ASCII text

% cc foo.c
    the default name for the executable file is a.out

% ls -l foo.c a.out
-rwx------   1 dheller  wheel  9816 Aug 21 10:47 a.out
-rw-------   1 dheller  wheel    29 Aug 21 10:46 foo.c

% file foo.c a.out
foo.c: ASCII text
a.out: Mach-O executable ppc

% cc -o foo.c foo.c
    probably meant  cc -o foo foo.c

% ls -l foo.c a.out
-rwx------   1 dheller  wheel  9816 Aug 21 10:47 a.out
-rwx------   1 dheller  wheel  9816 Aug 21 10:47 foo.c

% file foo.c a.out
foo.c: Mach-O executable ppc
a.out: Mach-O executable ppc
    the files a.out and foo.c have identical contents,
    your program is gone

Get into the habit of typing carefully, or using makefiles, or using a source code management system (CVS and Subversion are popular choices), or saving previous versions manually.

Some editors, especially Emacs, will automatically save the previous version of the file, under some name like foo.c~ .



Disk Quotas

Undergraduate students using the CSE dept. systems are subject to a disk quota - you are not allowed to go over a certain limit on the amount of disk storage you use.  If you get a warning message like "Disc Quota Exceeded", then try these commands from your home directory.

quota -v

This will report your limit, your current usage, and some other things.  For example,

% quota -v
Disk quotas for [username] (uid [userid]):
Filesystem     usage  quota  limit    timeleft  files  quota  limit    timeleft
/home/noncse   55000  50000  55000    4.0 days    957      0      0

du -h

This will display your disk usage statistics in "human-readable" form.  If you don't name a directory the command assumes the current directory.

du -s *

This will summarize the disk usage for each of your subdirectories.

du -k | sort -k 1n

This will list all your large directories (including the files and subdirectories) in units of kilobytes, sorted.  Pay attention to the end of the list.  Note that the sort option is "numeral-one-n" not "letter-ell-n".

find . -size +2048 -ls | sort -k 7n

This will list all your large files.  Note that the option to find is "letter-ell-s" not "numeral-one-s".

Now that you know where the problems are, you can use the rm command to delete unneeded files, largest first.

It might be that your problem is really coming from the web browser's cache of previously-visited web pages.  Here is what you can do with Firefox (other browsers have something similar).



Web Browser Cache Size vs. Disk Quotas

Some students have been going over their disk quota because the Firefox cache on Linux becomes too large (it defaults to 1 GB).   Here is how you do it, before you go over quota:
  1. Open Firefox and then go to Edit-->Preferences and then click on "Advanced".
  2. Then click on the "Network" tab.
  3. You can then click on the "Clear Now" button found near "Offline Storage" to verify that the cache is clear.   If you are over quota, you won't be able to do this.
  4. You can also change the value for the "Offline Storage" which currently defaults to 1GB and lower this value so you are not accumulating Firefox cache in your CSE Home Directory which will take up your home directory storage.
To have the cache cleared automatically every time you quit Firefox:
  1. Open Firefox and then go to Edit-->Preferences and then click on "Privacy".
  2. From the pulldown menu under the "History" section, select "Use custom settings for history".
  3. Checkmark "Clear history when Firefox closes" which should then allow you to click on "Settings..."
  4. Select and unselect the items that you would like Firefox to clear when Firefox quits.  Your choices are Browsing History, Download History, Form & Search History, Cookies, Active Logins, and Cache.



Keyboard Confusion

Keyboard settings are controlled by the stty program (stty originally meant "set teletype", but Teletype terminals are now found only in museums).

If you are using an editor such as vi, and the backspace or delete keys don't do what you expect, then try these commands:

stty -a

This will show all your current settings.  Look for "erase = ^h" or "erase = ^?".  The erase character will (or should) remove the character to the left of the cursor.

stty erase "^?"
stty erase "^h"


These change the setting for the erase character.  Pick one of them, try your editor again, and if the problem does not improve then pick the other one and try again.  Note that the ^ symbol here really means ^ and not control-something.

To make this selection apply every time you login, edit the file .login in your home directory.  Here is an example:

#
#       $HOME/.login - initialization commands for interactive csh/tcsh shells.
#

# Set some tty modes.
# stty erase "^h" intr "^c" kill "^u"
stty erase "^?"

# Don't let ctrl-D log you out.
set ignoreeof

# Do we let people talk to us?
mesg y

# permissions mostly off
umask 077



Last revised, 11 Jan. 2013