Finding out mount points on Linux and MacOS

If you’re just starting out with Linux, MacOS or any other UNIX-like operating system, you’ll probably be surprised that they don’t use drive letters like Windows does. Instead, every mounted (i.e., available to the computer) hard disk or storage device is part of an all-encompassing tree-like structure called Filesystem hierarchy. If you’re running a desktop or laptop computer, chances are that the operating system is going to handle mounting and unmounting storage devices for you (by automatically detecting and mounting them as soon as they’re plugged in and but unmounting them when you select Eject from the right-click menu), but when you start to get into the nitty-gritty of manually mounting and unmounting devices, things can get a bit out of hand and you’re likely to lose track of at least a few mount points. Here’s how you can find them out.

Using the mount command

You can use mount to… Well, mount file systems. This is probably the first thing you learn about this command, and you’re probably familiar (or you’re going to be) with typing mount /dev/sdb1 /mnt to make available the contents of the first partition in disk sdb inside a folder called /mnt. However, not everyone realizes that mount also has a dandy feature that will likely blow you away.

Whenever you type it without arguments, you get a list of all currently-mounted filesystems. Really neat, huh?

This is what the output of mount looks like in what I would consider a typical Linux install.

To be perfectly clear, I only created a handful of partitions (one mounted on /boot, one on /, one on /home and one used as a swap area, whereas all the rest are managed directly by the operating system. One can see how this output can be a little off-putting and include information that not everyone may be interested in, which is why combining mount with grep using a pipe operand ( | ) is a good idea, as in this example:

mount | grep /dev/sd

Pro-tipPro-tip: In case you don’t know, grep is a command-line utility used to search for text or patterns of text in a text file or the output of a command.

The pipe operand is used to send the output of a command as the input of the following command. In our case, the command mount | grep /dev/sd means “run the mount command, but instead of printing the output on screen, send it as the input of grep, which will then list all lines containing /dev/sd”.

Using findmnt (Linux only)

The findmnt command is another option when you need to find mount points. The difference between this and mount without any arguments is that findmnt gives a visual representation of how filesystems are mounted in your machine, allowing you to discern more easily the relationships between them. This is how its output looks like on the same machine as before:

Reading the mtab file (Linux only)

The last way you can list all the mounted file systems on your machine is by simply reading the contents of the mtab file, located under /etc.

To do this, we can use cat /etc/mtab to obtain the following list:

If this output looks familiar, that’s because it’s almost identical to that of mount without any arguments. In essence, what mount does is simply reading the contents of mtab.

About Andrea Luciano Damico 137 Articles
Andrea Luciano Damico is a freelance translator from Italy. Among his interests are linguistics, technology, video games, and generally being a chill guy. He runs Let's and