mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-28 23:20:10 +08:00
commit
997a1b0b4e
@ -1,112 +0,0 @@
|
||||
[zzlyzq translating...]
|
||||
Linux findmnt Command To Find Mounted Filesystems
|
||||
================================================================================
|
||||
The command findmnt is used to find mounted filesystems in Linux. This command will look for a particular filesystem in /etc/fstab, /etc/mtab or /proc/self/mountinfo.
|
||||
|
||||
### How To Install findmnt ###
|
||||
|
||||
The command findmnt comes in the package util-linux-ng, now renamed util-linux. The package comes with several other utilities such as hwclock. To install findmnt [download util-linux][1] from kernel.org ftp page.
|
||||
|
||||
### How To Install findmnt In Fedora ###
|
||||
|
||||
Fedora users can install the package as follows:
|
||||
|
||||
$ sudo yum install util-linux-ng
|
||||
|
||||
### Findmnt Default option ###
|
||||
|
||||
This command by default will give you a list of all filesystems mounted if no mountpoint or device is specified.
|
||||
|
||||
$ findmnt
|
||||
|
||||
![findmnt default](http://linoxide.com/wp-content/uploads/2014/03/findmnt-default.png)
|
||||
|
||||
### Findmnt Polling Mode ###
|
||||
|
||||
The command findmnt can be used to monitor changes in /proc/self/mountinfo file. The polling mode can be invoked by tying in your terminal the following command:
|
||||
|
||||
$ findmnt -p
|
||||
|
||||
alternatively
|
||||
|
||||
$ findmnt --poll
|
||||
|
||||
Any changes made to /proc/self/mountinfo file will automatically be updated on the terminal. At first you will not see any output but if try unplug and plugging your flash drive, the changes are reflected on the terminal as in the following example.
|
||||
|
||||
![findmnt poll](http://linoxide.com/wp-content/uploads/2014/03/findmnt-poll.png)
|
||||
|
||||
The time which polling mode will block can be restricted by **--timeout** or **--first-only** option.
|
||||
|
||||
### Timeout option ###
|
||||
|
||||
This option can be used along with --poll to limit the time polling mode will block to the time you explicitly set. **The timeout to be set is in milliseconds**. After the timeout period findmnt will no longer monitor for changes to the /proc/self/mountinfo file.
|
||||
|
||||
$ findmnt --poll --timeout 6000
|
||||
|
||||
![findmnt poll timeout](http://linoxide.com/wp-content/uploads/2014/03/findmnt-poll-timeout.png)
|
||||
|
||||
### First-only option ###
|
||||
|
||||
The first-only option will monitor for changes in the /proc/self/mountinfo file only for the first change and the command will no longer be in polling mode. The first change is displayed on the terminal and the prompt is returned to you. To use this option type on your terminal:
|
||||
|
||||
$ findmnt --poll --first-only
|
||||
|
||||
![findmnt poll first-only](http://linoxide.com/wp-content/uploads/2014/03/findmnt-poll-first-only.png)
|
||||
|
||||
### Imitating the command df output option ###
|
||||
|
||||
The command findmnt can also be used to imitate the output you would get if you used the df command. You can achieve this by running the command findmnt with the **--df** option as shown the following example.
|
||||
|
||||
$ findmnt --df
|
||||
|
||||
or
|
||||
|
||||
$ findmnt -D
|
||||
|
||||
This will give an almost identical output if you had run the command **df** with the **-h** option.
|
||||
|
||||
$ df -h
|
||||
|
||||
![findmnt imitate df](http://linoxide.com/wp-content/uploads/2014/03/findmnt-imitate-df.png)
|
||||
|
||||
### Findmnt list option ###
|
||||
|
||||
If you do not like the default tree output you can use the **--list** or **-l** option. This will print for you an output in a list format.
|
||||
|
||||
$ findmnt --list
|
||||
|
||||
Running this command will give you an output as follows:
|
||||
|
||||
![findmnt list](http://linoxide.com/wp-content/uploads/2014/03/findmnt-list.png)
|
||||
|
||||
### Findmnt Evaluate Option ###
|
||||
|
||||
The evaluate option will convert all tags for example LABEL, UUID, PARTUUID or PARTLABEL to the actual device name. This option can be combined with **--fstab** option to print all the filesystems in /etc/fstab. The **--fstab** option has its output in list format, and therefore there is no need to call the **--list** option when **--fstab** is used.
|
||||
|
||||
$ findmnt --fstab --evaluate
|
||||
|
||||
When the two options are combined as follows, the output will look like the example below:
|
||||
|
||||
![findmnt fstab evaluate](http://linoxide.com/wp-content/uploads/2014/03/findmnt-fstab-evaluate.png)
|
||||
|
||||
### Findmnt type option ###
|
||||
|
||||
This option allows you to limit the set of printed filesystems. Multiple filesystems can be specified and separated by a coma. In this example the command will search for ext4, ext3 and vfat filesystems.
|
||||
|
||||
$ findmnt -t ext4,ext3,vfat
|
||||
|
||||
![findmnt types](http://linoxide.com/wp-content/uploads/2014/03/findmnt-types.png)
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
You can try out the different options for findmnt depending on your needs.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-command/powerful-findmnt-command/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:ftp://ftp.kernel.org/pub/linux/utils/util-linux/
|
@ -0,0 +1,112 @@
|
||||
[zzlyzq translated]
|
||||
Linux命令findmnt-寻找挂载的文件系统
|
||||
================================================================================
|
||||
命令findmnt用来查找在Linux下已经被挂载的文件系统。该命令会从/etc/fstab,/etc/mtab或者/proc/self/mountinfo中寻找特定的文件系统。
|
||||
|
||||
### 如何安装findmnt ###
|
||||
|
||||
findmnt命令来自于util-linux-ng软件包,现在改名为util-linux。该软件包中还包括其他一些工具,比如hwclock。从kernel.org ftp页面安装findmnt[下载util-linux][1]。
|
||||
|
||||
### 如何在Fedora下安装findmnt ###
|
||||
|
||||
Fedora用户可以通过下面的命令安装该软件包:
|
||||
|
||||
$ sudo yum install util-linux-ng
|
||||
|
||||
### Findmnt默认选项 ###
|
||||
|
||||
如果没有提供特定的挂载点或者设备,该命令默认会列出所有已经被挂载的文件系统。
|
||||
|
||||
$ findmnt
|
||||
|
||||
![findmnt default](http://linoxide.com/wp-content/uploads/2014/03/findmnt-default.png)
|
||||
|
||||
### Findmnt轮询模式 ###
|
||||
|
||||
findmnt可以被用来监控/proc/self/mountinfo文件的变化。轮询模式可以通过下面的命令进行调用:
|
||||
|
||||
$ findmnt -p
|
||||
|
||||
或者
|
||||
|
||||
$ findmnt --poll
|
||||
|
||||
/proc/self/mountinfo文件的任何变化会自动的在终端中进行更新。一开始你不会发现终端中的输出有任何变化,如果此时你拔掉闪存再插入,变化就会出现在终端中。
|
||||
|
||||
![findmnt poll](http://linoxide.com/wp-content/uploads/2014/03/findmnt-poll.png)
|
||||
|
||||
轮询模式的时间可以通过**--timeout**或者**--first-only**选项进行限制。
|
||||
|
||||
|
||||
### 超时选项 ###
|
||||
|
||||
该选项可以与--pool一起使用来限制轮询模式的时间。**超时单位是毫秒**。超时后,findmnt不会再监控/proc/self/mountinfo文件的变化。
|
||||
|
||||
$ findmnt --poll --timeout 6000
|
||||
|
||||
![findmnt poll timeout](http://linoxide.com/wp-content/uploads/2014/03/findmnt-poll-timeout.png)
|
||||
|
||||
### First-only选项 ###
|
||||
|
||||
first-only选项只会监控/proc/self/mountinfo文件的第一次变化,之后该命令退出轮询模式。第一次变化会出现在终端中,并且返回到提示符。使用此选项在终端中输入:
|
||||
|
||||
$ findmnt --poll --first-only
|
||||
|
||||
![findmnt poll first-only](http://linoxide.com/wp-content/uploads/2014/03/findmnt-poll-first-only.png)
|
||||
|
||||
### 模仿df输出的选项 ###
|
||||
|
||||
findmnt命令也可以用来模仿df命令的输出。你可以参考如下的命令使用findmnt和选项**--df**。
|
||||
|
||||
$ findmnt --df
|
||||
|
||||
或者
|
||||
|
||||
$ findmnt -D
|
||||
|
||||
它会返回和**df -h**命令几乎相同的输出。
|
||||
|
||||
$ df -h
|
||||
|
||||
![findmnt imitate df](http://linoxide.com/wp-content/uploads/2014/03/findmnt-imitate-df.png)
|
||||
|
||||
### Findmnt list选项 ###
|
||||
|
||||
如果你不喜欢默认的树形输出,你可以使用**--list**或者**-l**选项。它会以列的形式进行输出。
|
||||
|
||||
$ findmnt --list
|
||||
|
||||
执行此命令的输出如下:
|
||||
|
||||
![findmnt list](http://linoxide.com/wp-content/uploads/2014/03/findmnt-list.png)
|
||||
|
||||
### Findmnt Evaluate 选项 ###
|
||||
|
||||
求值选项会转换所有的标签(比如LABEL,UUID,PARTUUID或者PARTLABEL)成真实的设备名称。该选项可以结合**--fstab**选项来打印所有在/etc/fstab中包含的文件系统。**--fstab**选项的输出是列的形式,因此当使用**--fstab**的时候无需使用**--list**选项。
|
||||
|
||||
$ findmnt --fstab --evaluate
|
||||
|
||||
当这两个选项像如下一样结合使用的时候,输出如下:
|
||||
|
||||
![findmnt fstab evaluate](http://linoxide.com/wp-content/uploads/2014/03/findmnt-fstab-evaluate.png)
|
||||
|
||||
### Findmnt type 选项 ###
|
||||
|
||||
该选项允许你限制打印出的文件系统。多个文件系统可以使用逗号分割进行指定。在这个实例中,该命令会搜索ext4,ext3和vfat文件系统。
|
||||
|
||||
$ findmnt -t ext4,ext3,vfat
|
||||
|
||||
![findmnt types](http://linoxide.com/wp-content/uploads/2014/03/findmnt-types.png)
|
||||
|
||||
### 结论 ###
|
||||
你可以按照你的需要尝试不同的findmnt选项。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-command/powerful-findmnt-command/
|
||||
|
||||
译者:[zzlyzq](https://github.com/zzlyzq) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:ftp://ftp.kernel.org/pub/linux/utils/util-linux/
|
Loading…
Reference in New Issue
Block a user