How to Use showmount Command to List Shares on an NFS Server

View available exports on an NFS server.

The showmount command provides information about shares on an NFS server. The mountd daemon maintains this information on the host.

The command queries the mountd daemon on a remote host for information about the state of the NFS server on that machine.

Related: How To Access Linux Filesystems in Windows 10 and WSL 2

The default value for the host is the value returned by the hostname. With no options, show the clients that have mounted directories from the host. The showmount command is usually found in /usr/sbin, which is not in the default search path.

Showmount Command Options

The options available with the showmount command are as follows:

OptionDescription
-a
–all
Print all remote mounts in the format hostname:directory, where hostname is the name of the client and directory is the root of the filesystem that has been mounted.
-d
–directories
List directories that clients have remotely mounted.
-e
–exports
Print the list of exported filesystems.
-h
–help
Provide a short help summary.
–no-headersDo not print headers.
-v
–version
Report the current version of the program.

List of the Most Commonly Used Examples of showmount

To get the list of available options and usage of the command:

showmount -h

To list the remote mounts in the format hostname:directory, where hostname is the name of the client and directory is the root of the file system that has been mounted:

showmount -a

If you only want to list the directories mounted by remote clients, use the -d option:

showmount -d 192.168.1.10Code language: CSS (css)

To print the list of exported filesystems:

showmount -e 192.168.1.10Code language: CSS (css)

To remove the header from the showmount command output, use the -h option:

showmount --no-headers

Get the version of the showmount command/package being used:

showmount -v

Bottom Line

In conclusion, the information given by showmount can sometimes include stale information about old mounts that are no longer present.

This can happen, for example, if a client reboots without unmounting the NFS mount. In this case, to correct this situation, you can, if necessary, remove the file /var/lib/nfs/rmtab on the server and restart the NFS server.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%