Mittwoch, 14. Oktober 2015

Linux sort CSV file

sort -t";" -k2 -k1 -k3 list.csv

oder 

sort --field-separator=';' --key=2,1,3

Input:
3;1;2
2;1;3
3;2;1
1;2;3
2;3;1
1;3;2

Output:
2;1;3
3;1;2
1;2;3
3;2;1
1;3;2
2;3;1

Sonntag, 4. Oktober 2015

Linux count Files in directory

ls -l | grep ^- | wc -l # Files
ls -l | grep ^d | wc -l # Directories
ls -l | grep ^l | wc -l # Links

Count with specific ending (eg. mkv):

ls -l | grep -i ^-.*mkv | wc -l

Compile unrar from Source In Linux

First see whats the most recent version:
ftp://ftp.rarlab.com/rar/ 
look for unrarsrc-*.tar.gz
 
 
wget http://www.rarlab.com/rar/unrarsrc-4.1.4.tar.gz
tar xzvf unrarsrc-4.1.4.tar.gz # replace Version 
cd unrar
make
sudo make install