Unix file management

Most users have a very limited amount of filespace on Unix hosts. This can quickly be filled up if you save a lot of email messages or create web pages with pictures in them. This section describes the commands needed to find out how much filespace you are using and to keep it tidy.

Filespace quota

To find out how much filespace you have been allocated and how much you have used:

  • Type quota -v and press Enter

The output is similar to the following:

Disk quotas for xbpab (uid 999):
Filesystem usage quota limit timeleft files quota limit timeleft
/users/sxb 111 2000 3000 11 0 0

The interesting parts are the usage and the first quota, limit and timeleft columns.

usage
shows how much filespace you are using (in kilobytes).
quota
shows how much you're allowed to use. If you exceed this amount a timer is started and you will be warned each time you log in. If you are still exceeding the quota when the time runs out, you will not be allowed to create any further files and attempting to modify files may result in the file being corrupted.
limit
is an absolute limit. You cannot create files that would exceed this limit at any time.
timeleft
shows the amount of time left to reduce the amount of filespace you are using.

Listing files

On Unix, as on PCs, files are stored in hierarchical directories (in Windows, these are also known as folders). Your filespace starts with your home directory. You may have a directory within your home directory named "public_html" for personal Web pages. The current directory is known as the working directory.

To list the files in the working directory:

  • Type ls -al and press enter

This command lists all the files in the working directory in a long format that includes the size of the file (in bytes).

To list the files in a subdirectory, for example "public_html":

  • Type ls -al public_html and press Enter

Alternatively, change the working directory by typing cd public_html and then list the files.

Removing files

To delete a file, for example "fred.html":

  • Type rm fred.html and press enter

If you want to save a copy of the file, transfer it to the PC first. To do this you need to use a file transfer program on the PC. The recommended program is the SSH secure shell client, described in Using SSH secure shell client on a PC to connect to and transfer files to and from a remote site (document ssh-i1).