Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
Given a directory d and a list of users, I want to find disk space used by each user in directory d.I cannot install any utility as it's a production environment so need a result using standard LINUX command(s)
you mean just a du -sh of /home/ ?
du -sh /home/*
1.2G /home/user001
...
The following shell script will get the disk usage, in human readable form (-h), sort the results and deliver the top 10 values:
sudo du -Sh | sort -rh | head -10
You can try -
du -shc /home/*
Where,
s :- display total size of a file or total size of all files in a directory.
h :- human readable format.
c :- display a total size usage at the end of result.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 months ago.
Improve this question
Can someone explain to me the following command in linux? (I know that with that command you can find the total space taken by each of the directories)
du -h --max-depth=1
Can you suggest a good way to understand in depth these commands?
thanks.
I assume that you want to know about this command in brief so, I'll just break it up for you:
du: this command is used to estimate file space usage
-h: this parameter is short for --human-readable to print sizes in human readable format
--max-depth=1: this parameter defines how deep in terms of folder structure level you want to see the output like is its level 1 then,
output will show the size for all the files and folders in current
directory but not for the content inside the folders the current
directory has
You can use this website to learn more about linux commands: https://explainshell.com/explain?cmd=du+-h+--max-depth%3D1
I recommend you to use du --help or man du to get help, and try these command yourself. You can remove or change any arguments and find out the differences between them.
-h means human readable, it will display the size like 1K or 3.5G, rather than only a number.
--max-depth=1 means it will only count the files and directories in current directory, sub-directories and sub-files will not display.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
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
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.
This is hacky, but it seems to do what you want, from the shell,
for d in /*; do egrep " ${d} " /proc/mounts > /dev/null || du -sh ${d}; done
Add a sudo in front of the du if needed.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I'm trying to run du -ch on multiple directories, but I only apart it only shows the total size of all files (I don't want each individual file, then the total at the end which is what -cdoes).
To resolve this issue, run the following command as parameter passing directories.
du -hs
Some ideas:
$ du -sh .
$ du -chs *
$ du -chs * | tail -1
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
When I type df -h it shows a folder of size 200GB, but when I try to find the size of any of the sub-directories by du -sch /path the folder size is 10kB. I know that certain sub-folder should be of size 100GB.
How do I find the size of the current folder/directory in Linux?
Use: du -sh * , this will give you the size of all the directories, files etc in the pwd in a readable format (you can get rid of the * if you wish obviously to get the size of just the pwd).
Read man du , also this has some very nice examples.
When you run du -sch /abc it doesn't show the size of hidden files (the files/directories that have the prefix dot(.) in their names) in the abc .
To check the size of all the files you can run, assuming you are in the directory abc
for i in `ls -a`; do du -sh $i ; done | sort -h
This will also sort the list.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I'm trying to find out which folder in my VPS take the most of disk usge, the result of df -h command show that my disk storage has 40GB and I used 38 Gb.
But when I calculate the size of root folder using ncdu (using command: ncdu /), it show that I only used 8.9 Gb:
Can anyone help me to figure out which files/folders take nearly 30 Gb of my disk
Try using this command:
du -cks *|sort -rn|head
This will list the 10 largest subdirectories of the current directory you're in. Then you can cd into the largest subdirectory and run the command again to see the sizes of the sub-subdirectories, and so on.
Source: https://serverfault.com/a/25045/297452
This sounds like an openfile issue.
try
lsof +L1 <path to dir>