Useful bash commands

Useful linux commands

list all txt files * $ ls ~//*.txt | wc -l

list all files that are not txt files * $ ls ~/ | grep “.*[^txt)]$”

get size of folder * $ du -sh ~/

inspect the first two lines of a text file * $ head -n 2 .txt

for f in $(ls *.txt); do awk -F’ ‘NR<=2 {data[NR]=$0} END {split(data[1], cols, “); split(data[2], desc,”); for(i=1; i<=NF; i++) {print cols[i] “ desc[i]}}’ $f >> output; done && cat output | awk -F’ ‘{print $1 $2}’ | sort | uniq >> elements_list.txt && rm output