UNIX commands overview


The following are some basic commands which may be useful in the UNIX/Linux Shell. For further examples on how to work with directories and files, view the following articles:

Disk usage

To show the total disk usage for your VPS or Dedicated Server, use df. This will show you total, used, and available disk space. Adding the -h flag displays the numbers in a more readable format (KB, MB, GB, and so on).

[server]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        24G  4.4G   19G  20% /
/dev/sda5       2.3G  1.1G  1.2G  49% /tmp
/dev/sda6        51G  2.0G   48G   4% /var
/dev/sdb1       3.6T  3.2T  448G  88% /home
/dev/ram0       3.9M   92K  3.6M   3% /var/dovecot

Note that the output above was truncated. The actual output on DreamHost's servers can be quite a bit longer.

Your home directory and all your files are in /home (not listed above).

In the example below, the /home directory is listed, and you can see from this that 26% percent of a 30GB partition is being used.

[server]$ df -h /home
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       3.6T  3.2T  448G  88% /home


To get a history of recent login activity:

[server]$ last username

Other common commands

Decompress files ZIP Archive

View the following article for details on how to decompress different types of compressed files.

Check if your files are correctly uploaded (check for file integrity)

If you need to upload some large files to the server, you might want to check that they are correctly uploaded with no errors. To do that, just create an MD5 file and upload it to the server, in the same folder as the files you want to check.

An MD5 file is a plain text file that contains checksums of your files so their integrity can be verified afterwards; to create it you can use any MD5 tool for your operating system, or the command line utility in a UNIX like system with openssl md5.

Once you upload the MD5 file, go to the directory that contains the files you want to verify (and where you the uploaded the MD5 file) and enter the following command:

[server]$ md5sum -c yourfile.md5
list: OK
of: OK
uploaded: OK
files: OK
being: OK
verified: OK

If all of the files report OK, the upload was completely successful. If any files report FAILED, it was not.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?