Linux Reference

This started as a collection of commands to perform various tasks on Linux (mostly Ubuntu) that I had trouble remembering.

Mounting a Drive

In all the following examples, /media/drive is the mount point, and /dev/sdb1 is our example drive.

To mount a usb partition: mount /dev/sdb1 /media/drive

To mount it at boot, in /etc/fstab: /dev/sdb1 /media/drive [filesystem, or auto] auto,user,rw,exec 0 0

A slightly more advanced way to prevent issues if the drive identifier changes (from something like /dev/sdb1 to /dev/sdd1) is to use the UUID of the drive, which will not change.

To retrieve the UUID: blkid /dev/sdb1

Output: /dev/sdb1: UUID="b96f9a94-1402-4107-a361-fb79030bd4ae" TYPE="ext3"

Mount by UUID: mount /dev/disk/by-uuid/[UUID] /media/drive

To mount at boot by UUID: UUID=[UUID] /media/drive [filesystem, or auto] auto,user,rw,exec 0 0