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

Samstag, 26. September 2015

Linux Filename im Terminal ändern

Filename Punkte und Leerzeichen durch _ ersetzen

rename 's/[. -]+/_/g' *

Lowercase

for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done

Ersetzen

rename 's/hier_ist_der_zu_ersetzende_text//g' *

pyload auf bestimmte Version downgraden

Folgendes in einem Terminal ausführen:

pyLoadCore --quit

cd ~/
rm -R pyload201508/
mkdir pyload201508
cd pyload201508/

wget https://github.com/pyload/pyload/archive/5e15580202c44628f2fbfabad0c3f693975fb3c9.zip
unzip *.zip
mv pyload* pyload

sudo -s
rm -R /usr/share/pyload
mv pyload/ /usr/share/

exit

cd /usr/share/pyload/
./pyLoadCore.py --daemon


ddrescue

Image eines Datenträgers erstellen

Image erstellen:
clear && date && sudo ddrescue /dev/sdb /media/andy/iomega/raspberrypi_pyload.img && date

Image zurückspielen:
date && sudo ddrescue /media/andy/iomega/raspberrypi.img /dev/sdb --force && date

Installation 
sudo apt-get install gddrescue

Mittwoch, 26. August 2015

Pfad eines Linux Comandos anzeigen


You can use "type" or "whereis" command to find out which command shell executes and to print binary (command) file location for specified command.

whereis command example

Display ls command location along with man page path:
whereis ls
Output:
ls: /bin/ls /usr/share/man/man1p/ls.1p.gz /usr/share/man/man1/ls.1.gz

type command example

Find out which command the shell executes:
type -a ls
Output:
ls is aliased to `ls --color=tty'
ls is /bin/ls



Source: http://www.cyberciti.biz/tips/find-linux-unix-command-location.html

Sonntag, 22. März 2015

Batch-File An Taskleiste anheften

Leider ist es nicht so leicht eine Batchdatei an die Windows 7 Taskleiste anzuheften. Mit diesem Trick geht’s:

1. Die anzuheftende Batchdatei von batch.bat nach batch.exe umbenennen.

2. Die Batchdatei nun in die Taskleiste ziehen und anheften.

3. Nun die original Batchdatei wieder umbenennen in batch.bat.

4. Mit gedrückter Shift-Taste mit der rechten Mausstaste auf die Verknüpfung klicken und auf Eigenschaften klicken.

5. Unter Ziel nun den korrekten Pfad zur Batchdatei eingeben. Es reicht aus, aus dem .exe ein .bat zu machen.
Text Files per CommandLine kombinieren: copy *.js bigfile.txt