Duke Statistics Disk Space FAQ
The goal of this page is to answer some of the more frequently asked questions about disk usage.
What is my home directory?
- Here are several different commands, each of which will print
your home directory:
prompt% env HOME
prompt% printenv HOME
prompt% echo $HOME
prompt% echo ~
prompt% cd; pwd
(Note: cd w/o any arguments puts you in your home directory, and pwd prints current directory.
prompt% finger my_login_id
(Note: finger returns more info than just home directory.)
Where is my home directory?
Your home directory lives on the departmental fileserver, currently named "where". (Where is the fileserver. Who's on first. He he.) It is accessible from all departmental Unix and Windows machines (on the latter as the Z: drive).How much space am I taking up?
There are two ways to determine this. The best is:prompt% quota -vwhich will print your current disk usage and quota in kilobytes.
A much slower and inefficient way is
prompt% du -sk ~which will compute your disk usage while you wait.
How can I tell what files or subdirectories are taking up most of the space?
- Some of the more notorious users of disk space are:
- core files
- PostScript files (.ps)
- bugs output
- .Audit files in .Data directories (Splus)
- old objects in .Data directories (Splus)
- tex and latex output
- emacs back-up files (.~*~ or .~)
- image files (.gif, .jpg, .tiff)
- object files (.o) from compiling
- Use du command to find size of a directory.
prompt% du -sk dir_name
Or to find size of your subdirectories and files in your home directory:prompt% du -sk ~/*
Also, check your ~/.Data directory and the netscape directory:prompt% du -sk ~/.Data* ~/.netscape
- Use find command to find all files larger than a given
size:
- 0.5 MB (512 kB)
prompt% find ~ -size +512k -ls
- 1 MB (1024 kB)
prompt% find ~ -size +1024k -ls
prompt% find ~ -name ".Audit" -ls
- 0.5 MB (512 kB)
How do I control the .Audit files?
- Nuke them every once in awhile, using the find command (be careful)
prompt% find ~ -name ".Audit" -exec cp /dev/null {} \;
- Write a .First function which sets the audit.size option to 0
> .First <- function() { options(audit.size="0") }
The .First function in your ~/.Data directory loads options before S is run. It is also useful for setting other options. To see a complete listing of the options, type options() from within S. For more info on the options and .First, use the help functions----either ?options or fire up the help gui help.start(). - Use the built in Splus function TRUNC_AUDIT
prompt% Splus TRUNC_AUDIT 0
What utilities are available to control disk usage?
- If files are not essential, delete them---especially, core
files and big PostScript or image files which you are finished with.
- pu is an alias which removes all of the .~ and
.~n~ from the current directory. To clear your entire directory
structure of these:
prompt% find ~ \(-name "*.~*" -o -name "*.~*~"\) -exec rm -i {} \;
(Note: pu is aliased to rm -i *.~* *.~*~.)
- texclean will remove any .aux, .dvi, .log and
core files from the current directory;
texclean -r ~ will recursively remove these files from all of your directories. - Use either gzip or compress commands to reduce
the size of the files.
Note gzip produces .gz files and compress creates
.Z files. For example,
prompt% gzip file.ps
will create file.ps.gz which should be smaller than the original. Also, gzip -r dir_name will recursively compress all of the files dir_name and any subdirectories of dir_name.
To recover the file in its original form, use the command gunzip with .gz or .Z files and uncompress with .Z files. gunzip -r dir_name will recursively gunzip all files in dir_name.
How can I archive (put into deep storage) and recover it?
- The (almighty) find command can help you figure out
some candidates for deep storage---ie, directory structures that
have not accessed or modified in a long time nor plan to
(of course).
To find files you have not accessed in 30 days (this will change the access time):
prompt% find ~ -atime +30 -ls
To find files you have not accessed in 30 days (this will change
prompt% find ~ -mtime +30 -ls
- I have a directory of stuff that I want available, but it is neither
critical nor often used (e.g. work from a completed course or research
project), how can I keep it at arms length?
Use the tar and gzip utilities to create a compressed archive of a directory structure called old_proj_dir:
prompt% tar cvf old_proj.tar ./old_proj_dir prompt% gzip old_proj.tar prompt% cd old_proj_dir prompt% rm -rf * prompt% mv ../old_proj.tar.gz .
- Great, how the heck do I access this stuff?
- To see the contents of old_proj.tar.gz:
prompt% gzcat old_prog.tar.gz | tar tvf -
- To extract the entire contents of old_proj.tar.gz:
prompt% gzcat old_prog.tar.gz | tar xvf -
(This will recreate the entire old_proj_dir in the current directory.) - To extract the file from old_proj.tar.gz. First
view the contents to get the path of file, and then
prompt% gzcat old_proj.tar.gz | tar xzvf - ./old_proj_dir/file
- To see the contents of old_proj.tar.gz:
- I have some old stuff that I should delete, but I may want it sometime
in the future. Will it be permanently lost?
Probably not. If it is over a month old, it should be backed up on tape and archived. Tape degradation aside, it should be recoverable; however, bear in mind that such requests should be of a critical nature. If you have any concerns or questions send email to help@stat.duke.edu.
Files less than one day old are not recoverable!!!!!!!!