Useful unix commands


#tell me about the join command
man join

#symlink files
ln -s realname.ext fakename.ext

#see history but cut line numbers at start
history | cut -c 8-

#copy files
scp [list of files] username@vm:path

#wget files
#get ftp address of file
wget <ftp address>

#format a tabular file in view
less file.txt | column -t 


#sort table (a tsv) by number in col 3
sort -nk 3 file.txt > sorted.txt

#sort a table and keep the header
# extract header
head -1 file.txt > sorted.txt
# extract all but header
# then sort by reverse number in col 2
tail -n+2 file.txt | sort -nrk 2 >> sorted.txt


#glob: a pattern for searching filenames
#NOTE: can be different to regex
#show all files ending in .txt
echo *.txt