How to find current folder size in linux [closed] - linux

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.

Related

linux command explain du -h --max-depth=1 [closed]

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.

How can you delete specific files in /temp in site server? [closed]

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
My site is experiencing Internal server Errors, website shutdowns and the main cause is a full /temp directory. The support gave us a list of large temp files that come with a size exceeding 1 GB. Is there any way to delete specific files in /temp?
ls -lah /tmp
I've used this code to go to my /temp file. How can I delete specific files in it?
Change directory to tmp - cd /tmp
And delete specific files - rm -f specific.file.name
You can use find for that:
find /temp -size +1G -delete
This means the following:
/temp : location of the search (subfolders are searched too)
-size +1G : the size should be larger than 1Gb
-delete : once such a file is found, delete it.

How to find disk usage per-user in Linux? [closed]

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.

Linux du command without traversing mounted file systems [closed]

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.

Using BASH, how would one use "du -ch" to output only the total collective size? [closed]

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

Resources