division breaker command for creating files

division breaker command for displaying files

division breaker command for removing files

division breaker command for copying files

division breaker command for comparing files

division breaker command for printing files

division breaker command for mailing files

division breaker commands for listing files and directories

division breaker creating, deleting, and changing directories

division breaker disk quotas

division breaker how to clean up your disk space

division breaker clean up pine mail

division breaker compress files

division breaker strip executable files

division breaker scratch space

spacer

command for creating files Back to Top

    % pico filename Creates a file using the pico editor. For more information on file creation, read the document, Using a CMS Unix Editor, Pico, also available in document form in the Information Center, 116 Hinds Hall, or the Kimmel Cluster, 029 Kimmel.

spacer

commands for displaying files Back to Top

    % cat filename Scrolls through the specified file, and displays it on your screen.
    % more filename Displays a file a page (or screenful) at a time. When "more" is displayed in the lower left-hand of your screen, use the following:

    spacebar - goes to next page
    b - goes to previous page
    q - quits page display
    h - shows help information

spacer

command for removing files Back to Top

    % rm filename Deletes a file.
spacer

commands for copying files Back to Top

    % cp file1 file2 Makes a copy of file1 and names it file2.
    % mv -i file1 file2 Renames the file called file1 to the new name file2, checking first to see if file2 already exists.
spacer

command for comparing files Back to Top

    % cmp file1 file2 Compares two files and points out what the differences are between the two.
spacer

commands for printing files Back to Top

    % lpr filename Prints a file to the default printer in Machinery Hall.
    % lp filename Prints a file from gamera or hydra to the default printer in Machinery Hall.
spacer

commands for mailing files Back to Top

Using Pine Mail

    % pine Uses pine e-mail to insert a file into your mail message. Read the document Using CMS Unix e-mail, Pine, for more information.
spacer

commands for listing files and directories Back to Top

    % ls Lists files and directories in short form. You see only file and directory names.
    % ls -a Lists all files and directories, including "hidden files" (known as system files, they start with a ".").
    % ls -c Lists by creation time.
    % ls -l Lists your files and directories showing permissions, creation date, groups, etc.
    % ls -r Lists files in reverse order.
    % ls -F Marks all executable files with * and all subdirectories with /.
    % ls -s Lists size in blocks.
    % ls -t Sorts with most-recently-modified first.
    % ls -alc Lists all the files and directories in long format by creation time.
spacer

creating, deleting, and changing directories Back to Top

    % mkdir directory1 Creates a new directory called directory1.
    % rmdir directory1 Deletes a directory called directory1 (directory must be empty).
    % pwd Shows current directory name.
    % cd directoryname Changes to the directory specified.
    % cd .. Moves you up a directory
    % cd Brings you back to your home directory.
spacer

disk quotas Back to Top

CMS computing accounts have disk quotas set that control the amount of disk space each user can have. If you try to use more than your quota, you'll see a message like this:

    DISK LIMIT REACHED (/home/u203) - WRITE FAILED
    WARNING: disk quota (/home/u203) exceeded
Once your disk space quota is exceeded, you can not save your work or create new files. So, you shouldn't wait to see this message before you clean up files.

Use the quota -v command:

    % quota -v
The computer will respond similar to the text below:

    Disk quotas for jmdean (uid 1107)
    Filesystem usage quota limit timeleft files
    /home/u203 2282  3000  3000            371
If the usage is close to the quota number, you should clean up your files.

spacer

how to clean up your disk space Back to Top

Finding Old and Big Files

Look through your directories for files that you don't need anymore, using the listing files and directories commands detailed above.

The du command shows the total number of kilobytes used in your current directory and all its subdirectories. Use du to find directories that take up a lot of space. For example:

    % cd
    % du
The list returned shows subdirectories before directories, giving a subtotal for each directory.

    & ls -Alutr
Once you find a directory that uses a lot of space, go to that directory with the cd command. The command ls -Alutr displays the files with the oldest one listed first. It also shows when each file was last use (read or modified).

Find Files
You can also look for all files which are more than a certain number of days old. The find command searches a directory and all its subdirectories. Here's an example that find everything that hasn't been accessed (read or changed) in more than 90 days.

Note: The permissions fields at the beginning of each line have been left off to fit this window

    % find . -atime +90 -ls
    1 auser acs 6079  Jan 29 1989 11:06 ./somefile
    1 auser acs 3055  Feb 19 1989 10:15 ./otherfile
    1 auser acs 13055 Dec 04 1988       ./subdir/file
Where:
The files ./somefile and ./otherfile are files in the current directory.

./subdir/file is a file named file that resides in the subdirectory named subdir.

The date and time shown by each file tell when the file was last modified (created or edited), NOT when the file was last accessed. Even so, the only files shown are those that haven't been accessed in more than 90 days. For more information type man find

Removing the Files or Directory

    % rm filename
    % rmdir directoryname
spacer

clean up pine mail Back to Top

Did you know that pine keeps a copy of every messsage you send? Clean up your "sendmail" folder first. In pine, you can sort your messages by date, allowing you to see your oldest mail listed first. While viewing a folder, for example, INBOX, type $ and then a d. Your mail is now sorted by date. At this point, you can either read the mail or mark it for deletion.

spacer

compress files Back to Top

The file-squeezing program called compress can reduce the size of a file by 90% or more (though most text files are squeezed by 30-60%). It's useful for files that you don't need often. Compressing a file adds .Z to the end of the filename to remind you that it's compressed. The following example shows the use of compress with its -v option. This option tells you how much a file has been compressed:

    % ls
    myfile words
    % cat words
    application - program
    array - matrix
    % compress -v words
    words: Compression: 48.90% -replaced with words.Z
To uncompress a file so you can use it, type uncompress filename (where "filename" is the name of your file). To see what's in a compressed file without taking the time to uncompress and recompress it, type zcat filename or zcat filename | more . Compressed files contain non-printable characters, so don't try to display them on your screen without using uncompress or zcat first.

    % ls
    myfile words.Z
    % zcat words
    application - program
    array - matrix
    % ls
    myfile words.Z
    % uncompress words
    % ls
    myfile words
Note that compressing and uncompressing files can take quite a bit of time if the files are large.

spacer

strip executable files Back to Top

If you write programs in C, Fortran, or other languages - and you use a program like cc or f77 to compile and link the program - your directories probably have one or more executable files named a.out. (Note: If you use the -o filename option when you compile, the filename may not be a.out.)

By default, these files contain a symbol table and relocation bits. Unless you're debugging the program, you can remove the symbol table and relocation bits from the files. This will save disk space.

There are two ways to strip this extra text from the executable files. First, when you compile your program, you can use the -s option. For example, to compile a C program named myprog.c and strip the executable file, use the command:

    % cc -s myprog.c
Or, if you already have the executable file, use the strip command. Using the ls -l command displays the file size before and after stripping:

    % ls -l a.out
    -rwxr-xr-x 1 auser 35889 Dec 11 13:12 a.out
    % strip a.out
    % ls -l a.out
    -rwxr-xr-x 1 auser 32768 Dec 11 14:05 a.out
In this case, stripping the file cut its size from 35,889 characters to 32,768 - about a 10% reduction.

spacer

scratch space Back to Top

The CMS Unix system has temporary storage space you can use when downloading files, etc. Use it with extreme care. Do not store anything here that cannot be re-created.

Additional space is granted on a case-by-case basis. You can request additional space by typing request on the command line and responding to the prompts. Before doing that, however, you should "clean up" existing files.