[SOLVED] Is there a way to show only ACTUAL normal mounted devices? Lot of distros seem to put lot of stuff in there
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336
Rep:
Is there a way to show only ACTUAL normal mounted devices? Lot of distros seem to put lot of stuff in there
On some distros there's so much junk to sift through when you do mount -l to see what is mounted. I just want to see actual disk devices, not 50+ system devices. Is there a way to streamline that? Maybe another argument than -l that I should be using or another command altogether?
This works on Ubuntu 16.04.
EDIT: It doesn't quite work; it seems that the mount command only takes into account the last -t option.
EDIT2: While looking into this, I found this very interesting paragraph in the mount manual page:
Quote:
The listing mode is maintained for backward compatibility only.
For more robust and customizable output use findmnt(8), especially in your
scripts. Note that control characters in the mountpoint name are replaced
with '?'.
That's one reason why I like answering questions. It forces me to think and research, and I occasionally learn something.
Or use good old grep to trim the list:
Code:
mount -l | grep -v -e /sys -e /run
Or filter for dev:
Code:
mount -l |grep /dev/
Last edited by berndbausch; 05-23-2020 at 10:36 PM.
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336
Original Poster
Rep:
Damn so there's no easier way? I don't really want to have to type up all that each time. I can make a script, but that won't always be available on a new or foreign system.
I guess that's probably the best bet though, if I make the script universal enough I can just make it part of my "deploy kit" which is basically a set of helper scripts I load on any machine I setup.
I don't like having to specify each file system though, if a new file system comes out or there is one I don't know about then I won't see that mount point. I could maybe use df, and then get the mount names, then check those individually. Essentially could just make my own mount script to check the mount points. Though grep is a good idea too, if I get rid of anything in /sys, /proc etc it will clean up the list. Can just make a new command called showmounts or something and throw in in /usr/bin.
Last edited by Red Squirrel; 05-24-2020 at 12:45 PM.
I would say if you have a special requirement you need to implement it. Either you use what was suggested or make a script/function/alias to filter whatever you need from the output of any command and also to print it in your preferred format.
It looks like there is no ready made solution for you (or at least we don't know about it). Actually the expression "normal mount" is not really well defined.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.