Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux du command without traversing mounted file systems [closed]

If the wording of the question is wrong, please let me know. It might explain why I can’t find an answer.

I want to find the usage on my main disk using a command like:

du -sh /*

The problem is that I have a number of mount points at the root level, and I would like du to skip these.

I thought the -x option was supposed to do this, but either I misunderstand what it does or I’m using it the wrong way.

How can I apply du to only the root disk without traversing the additional mounts?

Thanks

like image 985
Manngo Avatar asked May 17 '16 22:05

Manngo


People also ask

What is the use of du command in Linux?

The du command is a standard Linux/Unix command that allows a user to gain disk usage information quickly. It is best applied to specific directories and allows many variations for customizing the output to meet your needs.

Which command will not show mounted file system in Linux?

Method 01: Using Findmnt Command Let's start working on it. To see the list of mounted filesystems, type the simple “findmnt” command in the shell as below, which will list all the filesystems in a tree-type format. This snapshot contains all the necessary details about the filesystem; its type, source, and many more.

How can I make du command faster?

If you only need to know the size of the directory, you can speed it up a lot by simply avoiding writing the information to the screen. Since the grand total is the last line of the du command, you can simply pipe it to tail .

How do I find out what is taking up disk space in Linux?

Linux command to check disk space using:df command – Shows the amount of disk space used and available on Linux file systems. du command – Display the amount of disk space used by the specified files and for each subdirectory.


1 Answers

du -x will not traverse any mount points it encounters. But if it is told to start at a mount point then it will do as requested.

like image 139
Ignacio Vazquez-Abrams Avatar answered Oct 05 '22 23:10

Ignacio Vazquez-Abrams