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:
Option | Description |
-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-headers | Do 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.10
Code language: CSS (css)
To print the list of exported filesystems:
showmount -e 192.168.1.10
Code 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.