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

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

Related

How do you get the disc space occupied by symlink pointed files [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 2 years ago.
Improve this question
I have a list of file that are symlinked for original file
I was trying to get the size of those files as
filePath="/ready/PPMI_3651^SI82-SI108^PPMI_WES/PPMI_3651.r1.fq.gz"
size="$(du -ch $filePath | tail -1 | cut -f 1)"
but it only gives me 0 size. How do I get the space occupied by those?
This is how the file looks:
[un#xc transfer_data]$ ls -lht /ready/PPMI_3651^SI82-SI108^PPMI_WES/PPMI_3651.r1.fq.gz
lrwxrwxrwx 1 uuds parkd 70 May 16 2017 /ready/PPMI_3651.r1.fq.gz -> ../splitRG/PPMI_3651.r1.fq.gz
From man du:
-L, --dereference
dereference all symbolic links

How to extract file size of the files within .tar.gz using linux command? [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 2 years ago.
Improve this question
I have one file with name config.tar.gz. Inside this tar file I have couple of files. Out of which I need to get size of one file.
I am trying following
tar -vtf config.tar.gz | grep sgr.txt
Output:
-rw-r--r-- root/DIAGUSER 109568 2019-11-26 10:16:21 sgr.txt
From this I need to extract only size in human readable format. Something similar to "ls -sh sgr.txt"
You could try:
tar -ztvf file.tar.gz 'specific_file' | awk '{print $3}'

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.

Combine Multiple ls results 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 4 years ago.
Improve this question
I'm wondering if I can merge multiple ls results.
I have to combine 3 ls -l results; two directories have to list only directories in them, and the other lists symbolic links only.
The merged list'll finally be sorted by name or by date.
I did it by java code but I want to do it by single Linux command line if possible.
Thanks
I think you are better of doing this in find, but using ls -l to get out your file info for sorting by sort. Like:
find /path/dir1 /path/dir2 /path/dir3 -maxdepth 1 -exec ls -l --full-time {} + | sort -k 6,7

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.

Resources