What Determines How Many Files Can Be Stored in a Filesystem?
I'm conditioned to the ll command which is aliased to ls -alF. It is but missing a file count and size of files at the bottom. I played with du and tree but could non become the totals I needed. So I created lll to do that for me.
In your ~/.bashrc place the following:
lll () { ls -alF "$@" arr=($(ls -alF "$@" | awk '{Total+=$5} END {print NR, TOTAL}')) printf " \33[1;31m ${arr[0]}\33[m line(s). " printf "Full size: \33[i;31m ${arr[1]}\33[grand\n" # printf "Total size: \33[1;31m $(BytesToHuman <<< ${arr[i]})\33[m\n" } Salvage the file and resource information technology using . ~/.bashrc (or you can restart your concluding).
Sample output
The dainty thing nearly ll output is information technology's colors. This is maintained with lll but lost when using find or du:
TL;DR
A bonus role you can add to ~/.bashrc is chosen BytesToHuman(). This does what most console users would wait converting large numbers to MiB, GiB, etc:
part BytesToHuman() { # https://unix.stackexchange.com/questions/44040/a-standard-tool-to-catechumen-a-byte-count-into-homo-kib-mib-etc-like-du-ls1/259254#259254 read StdIn b=${StdIn:-0}; d=''; s=0; S=(Bytes {K,Thou,G,T,E,P,Y,Z}iB) while ((b > 1024)); practise d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))" b=$((b / 1024)) let south++ washed echo "$b$d ${Southward[$southward]}" } # BytesToHuman () Next flip the comment between two lines in lll () function to look like this:
# printf "Full size: \33[1;31m ${arr[1]}\33[m\due north" printf "Total size: \33[1;31m $(BytesToHuman <<< ${arr[i]})\33[m\n" Now your output looks similar this:
As always don't forget to re-source with . ~/.bashrc whenever making changes. (Or restart the terminal of class)
PS - Two weeks in self-quarantine finally gave me time to piece of work on this five year old goal.
Source: https://askubuntu.com/questions/1224/how-do-i-determine-the-total-size-of-a-directory-folder-from-the-command-line
Post a Comment for "What Determines How Many Files Can Be Stored in a Filesystem?"