New answers tagged


GNU du --max-depth=1 directly translates to BusyBox du -d 1. There's no equivalent of xargs -d; you can translate newlines to null bytes if xargs -0 is supported. du -d 1 -k | sort -nr | cut -f2 | tr '\n' '\0' | xargs -0 du -sh BusyBox has a lot of compilations to tune the compromise between size and features. If you don't have du -d, you can use du | ...


There is no generic way to directly mount a subtree of a filesystem. But you can mount the whole filesystem somewhere, and then “copy” a subtree of the mount with a bind mount. mount /dev/foobar /media/foobar mount --bind /media/foobar/usr /usr In fstab syntax: /dev/foobar /media/foobar auto defaults 0 2 /media/foobar/usr /usr bind bind


Temporary increase tmpfs filesystem 1) Open /etc/fstab with vi or any text editor of your choice, 2) Locate the line of /dev/shm and use the tmpfs size option to specify your expected size, e.g. 512MB: tmpfs /dev/shm tmpfs defaults,size=512m 0 0 e.g. 2GB: tmpfs /dev/shm tmpfs defaults,size=2g 0 0 mount -o remount /dev/shm


I’m on an android right now so your system might be a little different but in Termux, df does not accept any options at all. df # works as expected df [FILE] # works as expected df [OPTION]… [FILE]… # No such file or directory error


As an alternative, you can do this using only POSIX: find . -type f -name "*.jpg" -exec du -sk {} \; | awk 'BEGIN{total=0};{total += $1}; END{printf "%.3f MB\n", total / 1024}' Further reading: du - estimate file space usage (POSIX) find - find files (POSIX)


find ./path/to/your/drive -type f -name '*.jpg' -exec du -ch {} + Or much faster find /path/to/your/drive -name "*.jpg" -print0 | du -ch --files0-from=- Or simply, du -ch /path/to/your/drive/*.jpg | grep total Or with help of awk, find /path/to/your/drive -iname "*.jpg" -ls | awk '{total += $7} END {print total}' On my system file size shows on ...


fallocate -l 50G big_file truncate -s 50G big_file dd of=bigfile bs=1 seek=50G count=0 As those three ways can all fill up a partition quickly. If you like use dd, usually you can try it with seek. Just set seek=file_size_what_you_need and set count=0. That will tell the system there is a file, and its size is what you set, but the system will not create ...


Other alternatives include: to change the alarm thresholds to something near or below the current usage, or to create a very small test partition with limited inodes, size, or other attributes. Being able to test things such as running into the root reserved percentage, if any, may also be handy.


The fastest way to create a file in a Linux system is fallocate: fallocate -l 50G file From man: fallocate is used to manipulate the allocated disk space for a file, either to deallocate or preallocate it. For filesystems which support the fallocate system call, preallocation is done quickly by allocating blocks ...

Top 50 recent answers are included