mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
a71aa7de9e
renamed: 10 Linux Platforms Meant For Embedded Systems.md -> 201406/10 Linux Platforms Meant For Embedded Systems.md renamed: 20140527 4MLinux 9.0 Beta Is a 55 MB Operating System That Has It All.md -> 201406/20140527 4MLinux 9.0 Beta Is a 55 MB Operating System That Has It All.md renamed: 20140527 A Complete Historical Timeline of Linux Evolution.md -> 201406/20140527 A Complete Historical Timeline of Linux Evolution.md renamed: 20140528 Setup Backup Server Using Bacula And Webmin On Ubuntu 14.04.md -> 201406/20140528 Setup Backup Server Using Bacula And Webmin On Ubuntu 14.04.md renamed: 20140528 Why We Shouldn't Accept Bad Linux Ports.md -> 201406/20140528 Why We Shouldn't Accept Bad Linux Ports.md renamed: 20140529 Add Windows Like Bottom Taskbar In Ubuntu Unity 14.04.md -> 201406/20140529 Add Windows Like Bottom Taskbar In Ubuntu Unity 14.04.md renamed: 20140529 Command Line Tuesdays--The Introductory.md -> 201406/20140529 Command Line Tuesdays--The Introductory.md renamed: 20140529 How To Share Disks In VirtualBox Between Linux Guest OS.md -> 201406/20140529 How To Share Disks In VirtualBox Between Linux Guest OS.md renamed: 20140529 Install RainLoop Webmail (A Web Based Email Client) using 'Nginx and Apache' in Arch Linux.md -> 201406/20140529 Install RainLoop Webmail (A Web Based Email Client) using 'Nginx and Apache' in Arch Linux.md renamed: 20140529 What is a good terminal emulator on Linux.md -> 201406/20140529 What is a good terminal emulator on Linux.md renamed: 20140529 Why No Flash Support for Linux Is Good for Open Source.md -> 201406/20140529 Why No Flash Support for Linux Is Good for Open Source.md renamed: 20140530 Fix 'Cannot Add PPA' Error In Ubuntu 14.04 and Linux Mint.md -> 201406/20140530 Fix 'Cannot Add PPA' Error In Ubuntu 14.04 and Linux Mint.md renamed: 20140530 How To Install Linux On A MacBook Pro Retina.md -> 201406/20140530 How To Install Linux On A MacBook Pro Retina.md renamed: 20140530 Linux script command--A recorder inside your Terminal.md -> 201406/20140530 Linux script command--A recorder inside your Terminal.md renamed: 20140603 App Grid Is A Superior Ubuntu Software Center Alternative.md -> 201406/20140603 App Grid Is A Superior Ubuntu Software Center Alternative.md renamed: 20140603 Linux Foundation to donate portion of membership fees to Code.org.md -> 201406/20140603 Linux Foundation to donate portion of membership fees to Code.org.md renamed: 20140603 Write your first Linux Kernel module.md -> 201406/20140603 Write your first Linux Kernel module.md renamed: 20140604 Command line secrets.md -> 201406/20140604 Command line secrets.md renamed: 20140604 Setup Virtual Hosts In Apache On Ubuntu 14.04 LTS.md -> 201406/20140604 Setup Virtual Hosts In Apache On Ubuntu 14.04 LTS.md renamed: 20140607 Cup 2014 Brazil--Watch FIFA World Cup 2014 Competition in Your Linux Desktop.md -> 201406/20140607 Cup 2014 Brazil--Watch FIFA World Cup 2014 Competition in Your Linux Desktop.md renamed: 20140607 How To Extract Images From Videos Using ffmpeg.md -> 201406/20140607 How To Extract Images From Videos Using ffmpeg.md renamed: 20140607 How To Install iCup 2014 In Linux.md -> 201406/20140607 How To Install iCup 2014 In Linux.md renamed: 20140607 Linux--Bash Delete All Files In Directory Except Few.md -> 201406/20140607 Linux--Bash Delete All Files In Directory Except Few.md renamed: 20140607 New OpenSSL breach is no Heartbleed-but needs to be taken seriously.md -> 201406/20140607 New OpenSSL breach is no Heartbleed-but needs to be taken seriously.md renamed: 20140607 Nuvola Player 2.4.0 Released -- A Online Cloud Music Player for Linux.md -> 201406/20140607 Nuvola Player 2.4.0 Released -- A Online Cloud Music Player for Linux.md renamed: 20140607 Practical Interview Questions and Answers on Linux Shell Scripting.md -> 201406/20140607 Practical Interview Questions and Answers on Linux Shell Scripting.md renamed: 20140607 Steam Hits The Big 500 For Linux Games.md -> 201406/20140607 Steam Hits The Big 500 For Linux Games.md renamed: 20140607 Ubuntu One Formally Shuts Down.md -> 201406/20140607 Ubuntu One Formally Shuts Down.md renamed: 20140609 How To Know If Your System Has USB 3.0 Port In Linux [Quick Tip].md -> 201406/20140609 How To Know If Your System Has USB 3.0 Port In Linux [Quick Tip].md renamed: 20140609 Open Source LDAP Solutions.md -> 201406/20140609 Open Source LDAP Solutions.md renamed: "20140609 OpenELEC 4.0.4 \347\216\260\345\267\262\345\217\221\345\270\203, \345\237\272\344\272\216 XBMC 13.1 \342\200\234Gotham\342\200\235.md" -> "201406/20140609 OpenELEC 4.0.4 \347\216\260\345\267\262\345\217\221\345\270\203, \345\237\272\344\272\216 XBMC 13.1 \342\200\234Gotham\342\200\235.md" renamed: 20140610 How to set up Internet connection sharing with iptables on Linux.md -> 201406/20140610 How to set up Internet connection sharing with iptables on Linux.md renamed: 20140610 IPFire 2.13 Core 78 Linux Firewall OS Receives OpenSSL Fixes.md -> 201406/20140610 IPFire 2.13 Core 78 Linux Firewall OS Receives OpenSSL Fixes.md renamed: 20140610 Open Source SDN Project OpenDaylight Adds New Members.md -> 201406/20140610 Open Source SDN Project OpenDaylight Adds New Members.md renamed: 20140610 Top 7 Desktop Environment For Linux.md -> 201406/20140610 Top 7 Desktop Environment For Linux.md renamed: 20140611 HTG Explains--What' s the Difference Between Linux and BSD.md -> 201406/20140611 HTG Explains--What' s the Difference Between Linux and BSD.md renamed: 20140611 How to Prevent Other Users From Accessing Your Home Directory in Ubuntu 14.04.md -> 201406/20140611 How to Prevent Other Users From Accessing Your Home Directory in Ubuntu 14.04.md renamed: 20140612 Command Line Tuesdays--Part One.md -> 201406/20140612 Command Line Tuesdays--Part One.md renamed: 20140612 Dpkg Vulnerabilities Closed in Ubuntu 14.04.md -> 201406/20140612 Dpkg Vulnerabilities Closed in Ubuntu 14.04.md renamed: 20140616 How To Install Numix Icon Theme In Fedora 20.md -> 201406/20140616 How To Install Numix Icon Theme In Fedora 20.md renamed: 20140616 Ubuntu Desktop Next 14.10 Images Available to Download.md -> 201406/20140616 Ubuntu Desktop Next 14.10 Images Available to Download.md renamed: 20140616 Ubuntu for Phones Activated on 10,000 Devices.md -> 201406/20140616 Ubuntu for Phones Activated on 10,000 Devices.md renamed: 20140617 14 Apps To Boost Ubuntu.md -> 201406/20140617 14 Apps To Boost Ubuntu.md renamed: 20140619 Improve Battery Life with Laptop Mode Tools 1.65.md -> 201406/20140619 Improve Battery Life with Laptop Mode Tools 1.65.md renamed: 20140619 Red Hat to Acquire eNovance, Focus Together on OpenStack.md -> 201406/20140619 Red Hat to Acquire eNovance, Focus Together on OpenStack.md renamed: 20140620 Celebrating 30 Years of X.md -> 201406/20140620 Celebrating 30 Years of X.md renamed: 20140620 ENCRYPT DNS TRAFFIC IN LINUX WITH DNSCRYPT (VIA OPENDNS).md -> 201406/20140620 ENCRYPT DNS TRAFFIC IN LINUX WITH DNSCRYPT (VIA OPENDNS).md renamed: 20140620 How to enable testing and unstable repository on Debian.md -> 201406/20140620 How to enable testing and unstable repository on Debian.md renamed: 20140625 Canonical Debuts 'Orange Box' for Ubuntu OpenStack Cloud Demos.md -> 201406/20140625 Canonical Debuts 'Orange Box' for Ubuntu OpenStack Cloud Demos.md renamed: 8 examples of findmnt command to check mounted file systems on Linux.md -> 201406/8 examples of findmnt command to check mounted file systems on Linux.md renamed: Bash Getopts--Scripts with Command Line Options.md -> 201406/Bash Getopts--Scripts with Command Line Options.md renamed: Collectl--An Advanced All-in-One Performance Monitoring Tool for Linux.md -> 201406/Collectl--An Advanced All-in-One Performance Monitoring Tool for Linux.md renamed: Fix Adobe Flash Player Issue In Chromium In Ubuntu 14.04.md -> 201406/Fix Adobe Flash Player Issue In Chromium In Ubuntu 14.04.md renamed: Guide To Install Ubuntu 14.04 In Dual Boot Mode With Windows 8 Or 8.1 UEFI.md -> 201406/Guide To Install Ubuntu 14.04 In Dual Boot Mode With Windows 8 Or 8.1 UEFI.md renamed: How To Install 'California' Calendar App in Ubuntu 14.04.md -> 201406/How To Install 'California' Calendar App in Ubuntu 14.04.md renamed: How To Remove Drive Icons From Unity Launcher In Ubuntu 14.04 [Beginner Tips].md -> 201406/How To Remove Drive Icons From Unity Launcher In Ubuntu 14.04 [Beginner Tips].md renamed: How to Install Windows 8.1 and Ubuntu 14.04 LTS on the Same Computer.md -> 201406/How to Install Windows 8.1 and Ubuntu 14.04 LTS on the Same Computer.md renamed: How to download webcomics from the command line on Linux.md -> 201406/How to download webcomics from the command line on Linux.md renamed: How to launch applications differently with Gnome-Pie on Linux desktop.md -> 201406/How to launch applications differently with Gnome-Pie on Linux desktop.md renamed: How to manage Linux containers with Docker on Ubuntu.md -> 201406/How to manage Linux containers with Docker on Ubuntu.md renamed: How to manage ip addresses and subnets with phpIPAM.md -> 201406/How to manage ip addresses and subnets with phpIPAM.md renamed: How to manage passwords from the command line on Linux.md -> 201406/How to manage passwords from the command line on Linux.md renamed: How to monitor Nginx web server from the command line in real time.md -> 201406/How to monitor Nginx web server from the command line in real time.md renamed: How to set up a web-based lightweight system monitor on Linux.md -> 201406/How to set up a web-based lightweight system monitor on Linux.md renamed: How to take a screenshot from the command line on Linux.md -> 201406/How to take a screenshot from the command line on Linux.md renamed: How to take full length screenshots of websites via terminal.md -> 201406/How to take full length screenshots of websites via terminal.md renamed: How to use LVM in Linux.md -> 201406/How to use LVM in Linux.md renamed: How to verify DDOS attack with netstat command on Linux Terminal.md -> 201406/How to verify DDOS attack with netstat command on Linux Terminal.md renamed: Install SoundCloud In Ubuntu 14.04.md -> 201406/Install SoundCloud In Ubuntu 14.04.md renamed: Linux Pros' Top Command Line Secrets.md -> 201406/Linux Pros' Top Command Line Secrets.md renamed: Linux Terminal--Dstat monitoring tools.md -> 201406/Linux Terminal--Dstat monitoring tools.md renamed: Making Linux Feel at Home.md -> 201406/Making Linux Feel at Home.md renamed: Open Source's Cult Of Personality Is Dying--Thankfully.md -> 201406/Open Source's Cult Of Personality Is Dying--Thankfully.md renamed: Pros' Secrets and Red Hat 7 and PCLinuxOS 2014.05 Reviews.md -> 201406/Pros' Secrets and Red Hat 7 and PCLinuxOS 2014.05 Reviews.md renamed: Start Practising Linux ip command and Avoid the Habit of Using ifconfig.md -> 201406/Start Practising Linux ip command and Avoid the Habit of Using ifconfig.md renamed: TechView--Linus Torvalds Inventor of Linux.md -> 201406/TechView--Linus Torvalds Inventor of Linux.md renamed: Turn Off Bluetooth By Default In Ubuntu 14.04 [Quick Tip].md -> 201406/Turn Off Bluetooth By Default In Ubuntu 14.04 [Quick Tip].md renamed: Ubuntu Linux Community Manager Jono Bacon Leaves Canonical.md -> 201406/Ubuntu Linux Community Manager Jono Bacon Leaves Canonical.md renamed: What Heartbleed Teaches Us--Be An Open Source Contributor, Not Just A User.md -> 201406/What Heartbleed Teaches Us--Be An Open Source Contributor, Not Just A User.md renamed: Why htop Command Compete Linux top Command.md -> 201406/Why htop Command Compete Linux top Command.md
149 lines
7.3 KiB
Markdown
149 lines
7.3 KiB
Markdown
findmnt 命令的八个应用实例
|
||
================================================================================
|
||
### 已挂载的文件系统和设备 ###
|
||
|
||
linux 中常用的检查已挂载的文件系统的是 mount 命令,不仅用于列出已挂载的设备,而且可以在需要的时候挂载和卸载。另外还有一个叫做 findmnt 的超赞命令,它可以用于快速查看挂载位置和选项。
|
||
|
||
### 安装findmnt ###
|
||
|
||
findmnt 命令来自 util-linux 软件包,默认安装在大多数发行版中,如 Ubuntu,Fedora,Debian
|
||
|
||
$ aptitude search util-linux
|
||
i util-linux - Miscellaneous system utilities
|
||
|
||
$ yum info util-linux
|
||
|
||
### 使用findmnt ###
|
||
|
||
#### 1. 列出文件系统 ####
|
||
|
||
无任何选项运行 findmnt,只会以树形结构图的方式列出所有已挂载的文件系统。
|
||
|
||
$ findmnt
|
||
|
||
![](http://www.binarytides.com/blog/wp-content/uploads/2014/03/findmnt.png)
|
||
|
||
#### 2. 以列表形式输出 ####
|
||
|
||
输出可以格式化为一个简单的列表,而不是默认的树形结构,使用l(键盘u和o中间那个,不是数字1)选项使它方便阅读。
|
||
|
||
$ findmnt -l
|
||
TARGET SOURCE FSTYPE OPTIONS
|
||
/sys sysfs sysfs rw,nosu
|
||
/proc proc proc rw,nosu
|
||
/dev udev devtmpf rw,rela
|
||
/dev/pts devpts devpts rw,nosu
|
||
/run tmpfs tmpfs rw,nosu
|
||
/ /dev/disk/by-uuid/6fa5a72a-ba26-4588-a103-74bb6b33a763
|
||
ext4 rw,rela
|
||
/sys/fs/cgroup tmpfs rw,rela
|
||
/sys/fs/fuse/connections fusectl rw,rela
|
||
/sys/kernel/debug debugfs rw,rela
|
||
/sys/kernel/security securit rw,rela
|
||
/run/lock tmpfs rw,nosu
|
||
/run/shm tmpfs rw,nosu
|
||
/run/user tmpfs rw,nosu
|
||
/sys/fs/pstore pstore rw,rela
|
||
/media/13f35f59-f023-4d98-b06f-9dfaebefd6c1
|
||
/dev/sda8 ext4 rw,nosu
|
||
/media/4668484A68483B47 /dev/sda5 fuseblk rw,nosu
|
||
/proc/sys/fs/binfmt_misc binfmt_misc binfmt_ rw,nosu
|
||
/sys/fs/cgroup/systemd systemd cgroup rw,nosu
|
||
/run/user/1000/gvfs gvfsd-fuse fuse.gv rw,nosu
|
||
|
||
#### 3. df格式输出 ####
|
||
|
||
Findmnt 可以用“-D”或“-df”选项创建一个 df 格式的输出报告空闲和已用磁盘空间。
|
||
|
||
$ findmnt -D
|
||
SOURCE FSTYPE SIZE USED AVAIL USE% TARGET
|
||
devtmpfs devtmpfs 994.2M 0 994.2M 0% /dev
|
||
selinuxfs selinuxfs 0 0 0 - /sys/fs/selinux
|
||
tmpfs tmpfs 1001.5M 68K 1001.4M 0% /dev/shm
|
||
tmpfs tmpfs 1001.5M 724K 1000.8M 0% /run
|
||
tmpfs tmpfs 1001.5M 0 1001.5M 0% /sys/fs/cgroup
|
||
/dev/mapper/fedora-root ext4 6.5G 5.3G 811.6M 82% /
|
||
tmpfs tmpfs 1001.5M 60K 1001.5M 0% /tmp
|
||
/dev/sda1 ext4 476.2M 107.7M 339.6M 23% /boot
|
||
|
||
需要注意的是,以上选项 util-linux2.20 之前的版本都不可用,它正好是 Ubuntu13.10 上的最新版本
|
||
|
||
#### 4. 从fstab读取文件系统 ####
|
||
|
||
使用“-s”或“-fstab”选项,findmnt 将只从/etc/fstab文件和/etc/fstab.d目录读取文件系统。
|
||
|
||
$ findmnt -s
|
||
TARGET SOURCE FSTYPE OPTIONS
|
||
/ /dev/mapper/fedora-root ext4 defaults
|
||
/boot UUID=18cde604-1c65-4ec8-8a8d-385df50ada3b ext4 defaults
|
||
swap /dev/mapper/fedora-swap swap defaults
|
||
|
||
#### 5. 通过类型过滤文件系统 ####
|
||
|
||
Findmnt 可以打印出只基于类型的特定的文件系统,例如 ext4,多个系统类型可以指定一个逗号分隔。
|
||
|
||
$ findmnt -t ext4
|
||
TARGET SOURCE FSTYPE OPTIONS
|
||
/ /dev/mapper/fedora-root ext4 rw,relatime,seclabel,data=ordered
|
||
└─/boot /dev/sda1 ext4 rw,relatime,seclabel,data=ordered
|
||
|
||
#### 6. 原始输出 ####
|
||
|
||
如果你喜欢原始风格的输出,那么使用“-r”或“--raw”选项。
|
||
|
||
$ findmnt --raw
|
||
TARGET SOURCE FSTYPE OPTIONS
|
||
/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime
|
||
/proc proc proc rw,nosuid,nodev,noexec,relatime
|
||
/dev udev devtmpfs rw,relatime,size=4069060k,nr_inodes=1017265,mode=755
|
||
/dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
|
||
/run tmpfs tmpfs rw,nosuid,noexec,relatime,size=816716k,mode=755
|
||
/ /dev/disk/by-uuid/6fa5a72a-ba26-4588-a103-74bb6b33a763 ext4 rw,relatime,errors=remount-ro,data=ordered
|
||
/sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755
|
||
/sys/fs/fuse/connections fusectl rw,relatime
|
||
/sys/kernel/debug debugfs rw,relatime
|
||
/sys/kernel/security securityfs rw,relatime
|
||
/run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k
|
||
/run/shm tmpfs rw,nosuid,nodev,relatime
|
||
/run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755
|
||
/sys/fs/pstore pstore rw,relatime
|
||
/media/13f35f59-f023-4d98-b06f-9dfaebefd6c1 /dev/sda8 ext4 rw,nosuid,nodev,relatime,errors=remount-ro,data=ordered
|
||
/media/4668484A68483B47 /dev/sda5 fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096
|
||
/proc/sys/fs/binfmt_misc binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime
|
||
/sys/fs/cgroup/systemd systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd
|
||
/run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
|
||
|
||
看起来非常整洁(译注,亲爱的读者你也这样觉得么?)。
|
||
|
||
#### 7. 通过源设备查找 ####
|
||
|
||
通过源设备查找文件系统,指定设备路径包括/不包括“-S”选项。
|
||
|
||
$ findmnt -S /dev/sda1
|
||
TARGET SOURCE FSTYPE OPTIONS
|
||
/boot /dev/sda1 ext4 rw,relatime,seclabel,data=ordered
|
||
|
||
#### 8. 通过挂载点查找 ####
|
||
|
||
通过挂载目录查找文件系统,指定目录包括/不包括“-T /--target”选项。
|
||
|
||
$ findmnt -T /
|
||
TARGET SOURCE FSTYPE OPTIONS
|
||
/ /dev/mapper/fedora-root ext4 rw,relatime,seclabel,data=ordered
|
||
|
||
$ findmnt -T /media/4668484A68483B47
|
||
TARGET SOURCE FSTYPE OPTIONS
|
||
/media/4668484A68483B47 /dev/sda5 fuseblk rw,nosuid,nodev,relatime,user_id=0
|
||
|
||
### 总结 ###
|
||
|
||
这是一个 findmnt 命令的简要介绍。关于 findmnt 的更多选项可以在 man 手册页中找到。
|
||
|
||
--------------------------------------------------------------------------------
|
||
|
||
via: http://www.binarytides.com/linux-findmnt-command/
|
||
|
||
译者:[Vito](https://github.com/vito-L) 校对:[Caroline](https://github.com/carolinewuyan)
|
||
|
||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|