du command hack

Here comes the Linux Tip of the Day.

I know that you all know our old and reliable “du” command. Which is used to give you the disk usage report for a particular directory or files.

But ….

If there is a situation where you want to provide ‘du’ input on the terminal, then what to do. As we know du takes the directory path in argument.

Here is the good news this can be done using –files0-from’ flag.

Just give the command –

du -ah –files0-from=-
now write first file name and press ctrl+d twice (the cursor will come in second line)
second file name press ctrl+d twice (repeat the steps as u need)

press ctrl+c to end and come out

Here is the screenshot from my machine. (That is why we encourage reading man pages during our RHCE Training)

Join Network NUTS Facebook Page.

Linux du command

Linux du command

Advertisements