Monthly Archives: avril 2012

Linux tricks

Top 10 cpu users with one command « p », all in file .bashrc:

alias p='ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10'

Big files, check disk space with one command « d », ddd in file .bashrc:

alias d='du -m --max-depth=2 | sort -nr'

Trouble with gparted in X env:

gksu -d -u root gparted

SSH connexion without password:

ssh-keygen -t rsa
ssh-copy-id user@server

Script doing some time offset for my virtualbox server:


j1=`date "+%d"`
m1=`date "+%m"`
y1=`date "+%Y"`

epoch0=`date --utc --date $date0 +%s`
epoch1=`date --utc --date "$y1-$m1-$j1" +%s`
diff=`expr $epoch1-$epoch0 | bc -l`
diffms=`expr $diff*1000 | bc -l`
echo "Difference $diffms ms"
# diffj=`expr $diff/3600/24 | bc -l | cut -d"." -f1`
diffj=`expr $(expr $epoch1-$epoch0 | bc -l)/3600/24 | bc -l | cut -d"." -f1`
echo Offset de -$diffj jours

Mount windows share:

smbmount // /courge_backup/ -o user=jdoe


mount -t cifs // /courge_pro/ -o user=jdoe


mount -t cifs // /NW73

Mount iso file:

mount -o loop -t iso9660 fichier.iso /mnt/iso

Time date setup with command line:

date -s "1 DEC 2011 14:12:00"

What’s coming here ?

tcpdump -vvv -A -i any port XXXX

Routing with ip route:

ip route add via

Vider le cache disque:

sync; sysctl vm.drop_caches=3