Skip to main content

All Questions

Tagged with
0 votes
2 answers
91 views

Adding up sizes of directories using bash is inconsistent

First, I got the total size of folder /my-downloads: $ du -sh /my-downloads 304G /my-downloads As you can see, it's 304G. Then, I wanted to find out the total size of all immediate directories ...
Logan Lee's user avatar
  • 249
2 votes
2 answers
344 views

find with du -sch and very many files

I have large folder structure and need to get the size of a certain subset. The directories I need to count are defined by having specific subdirectories: find . \( -iname a -or ... \) -printf "\&...
cheersmate's user avatar
0 votes
2 answers
205 views

xargs running more than one command?

Is it possible to use xargs to run more than one command? The only related information I found was this question, but the answer was not related to xargs. I'm running a simple du / -ah | sort -r -n | ...
mariano-daniel's user avatar
0 votes
2 answers
136 views

List the largest and latest 20 files on a drive

I have a disk filling up which has many large files on it so I want to find only the latest and largest 20 files on the disk. How can I do this?
markhorrocks's user avatar
0 votes
1 answer
136 views

why isn't my 'find -exec du' working?

I want to get the disk usage of a directory tree, excluding branches that begin with '.', and I will eventually want to run this over ssh, so I prefer to not use a pipe. When I run the following, I ...
samwyse's user avatar
  • 117
0 votes
2 answers
734 views

How to calculate disk usage filtering by pattern (e.g., *.JPG)?

How can I calculate disk space consumed only by some files of a directory recursively?
awvalenti's user avatar
  • 201
5 votes
2 answers
1k views

No space left on device when moving 700k files to a single directory within the same FS

I use the following command to find and move a huge number of files on my server: find SomeDir/ -maxdepth 10 -type f -mtime +90 -exec mv {} SomeDir2/ \; After moving about 700,000 files, I get this ...
Ali Golestan's user avatar
1 vote
1 answer
2k views

Readable format of file sizes using the Find command

To see human readable output, I can use the following command – du command -h option : Display sizes in human readable format (e.g., 1K, 234M, 2G). $ du -hsx * | sort -rh | head -10 The sample output ...
Rick T's user avatar
  • 357
1 vote
1 answer
3k views

Exclude directories for du command / Index all files in a directory

My goal is rather simple: I want to create a small database of all files/directories within a big directory. After looking for a tool suited I couldn't find anything but the good ol' du. I figured out ...
confetti's user avatar
  • 2,104
3 votes
1 answer
7k views

Linux show files in directory larger than 1 GB and show size

I am trying to find a command that displays files larger than 1 GB and displays those files ordered by size. I have tried find . -maxdepth 2 -type f -size +1G -print0 |xargs -0 du -h |sort -rh but for ...
griffin_cosgrove's user avatar
1 vote
1 answer
2k views

Linux find command - how to find directories by size?

Can find return results based on the size of directories? Below command is working fine as expected - find * -type f -size +10M -exec ls -hlSr {} \+ But on applying the same to directories its not ...
samshers's user avatar
  • 728
7 votes
4 answers
1k views

Measuring disk usage of specific file types per each directory (recursively, as a demo for 'du --include')

This is my working code, but I believe it's not optimized - there must be a way to complete the job much faster than this: find . -type f -iname '*.py' -printf '%h\0' | sort -z -u | xargs -r -0 -I{...
madjoe's user avatar
  • 213
2 votes
2 answers
2k views

calculate total used disk space by files older than 1000 days using find

We have more than 4 years of data in our system. We need to move 2 years old files and directories in a new repository. Our requirement is needed to know how many TB of data from Jan 2017 to as of now ...
Vijay Selvakumar's user avatar
3 votes
2 answers
5k views

List Top 20 Largest Files in a Specific Directory

I am trying to display the top 20 largest files in a specific directory. I want to include all sub directories but not the actual directories themselves. (I only want files.) I have been trying to ...
Chris's user avatar
  • 133
5 votes
3 answers
5k views

Get the exact size of files retrieved by find output

My shell engine is either Busybox 1.31.0 or bash 3.2 I need to get the size of the files retrieved from find command. I've been trying to find only files, which have been modified more than 60 days ...
aldehc99's user avatar

15 30 50 per page