Linux Administration
2.52K subscribers
4 files
125 links
Download Telegram
# stat -c "%F"$'\t'"%15s"$'\t'"%n" -- * | awk -F"[\t\.]+" '/^regular file.*\..{1,5}$/{t[$NF]+=$2;x[$NF]++} END {for (s in t){printf("%-5s %4i %12i\n",s,x[s],t[s])}}' | sort -k3n



Command to See what type of files are taking up so much space. output columns = type count
If you want to clean empty directories, find command can make the job easy:

$ find / -type d -empty -exec rmdir {} +

The -type d option searches for directories, -empty select empty ones and -exec rmdir {} executes the rmdir command to delete them. The rmdir command ensures that the directory is empty before deleting it.



Alternatively, you can also use below command to complete the same task:

$ find / -type d -empty -delete
Two files in different formats (eg. TSV vs. CSV) and need to find out if file1 had lines that were not in file2.


join -v1 --header -t, -1 2 -2 1 <( sort -t, -k2 files1.csv | cut -d, -f1-5 ) <( sed 's/\t/,/g' files2.tsv | sort -t, -k1 )
Regex Tip


[a-z] matches all lower case letters. [-az] matches '-', 'a', or 'z'.