To save space in your CIS Unix directory:
% du ~ | sort -n
will show you a list of all your directories in ascending order by the amount of space they use. (Use
% du | sort -n
to just look at the directory structure rooted at your current directory.)
% ls -als | sort -n
will show you the files in your current directory, in ascending order by the amount of space they use.
To delete a file, give the command
% rm filename
To delete an entire directory subtree, give the command:
% rm -rf dirname
This command should be used, of course, with extreme caution.
% gzip demo.c
... this will replace demo.c with a file named demo.c.gz typically taking up a lot less space. To get the original file back again:
% gunzip demo.c.gz
You can compress all the files in a directory (whose names don't begin with a period) with the command
% gzip *
% tar cf demo.tar *
% gzip demo.tar
This will create the file demo.tar.gz. You can then safely delete all other files and directories in the current directory. To restore things, use the commands:
% gunzip demo.tar.gz
% tar xpf demo.tar
(You can also extract single files from the archive if necessary. For more information on the tar and gzip programs, see the man pages.)
Last modified: 2005-08-05 10:06 EDT
Paul A. Sand, pas@unh.edu