Gist created from https://github.com/arturoherrero/command-line-one-liners
$ !!
$ sudo !!
$ echo "!!" > script.sh
$ echo cd .
$ !*
$ echo a b c d e
$ echo !!:2
$ echo !!:3-$
$ cp script.sh /usr/bin/
$ cd <ESC> .
$ echo no typos
$ ^typos^errors
$ alias ls="ls -a"
$ \ls
$ mv filename.{old,new}
$ mv filename.{png,jpg}
$ cp file.txt{,.bak}
$ history
...
1225 ls -l
1226 git status
1227 history
$ !-3
$ !1225
$ !text
$ history | awk '{print $2}' | sort | uniq -c | sort -rn | head
$ <space>command
$ mkdir -p a/long/directory/path
$ mkdir dir && cd $_
$ cd -
$ (cd /tmp && ls)
$ cat > file.txt
{your text here}
{your text here}
<ctrl-d>
$ > file.txt
$ echo $PATH | tr ':' '\n'
$ tr ':' '\n' <<< $PATH
$ less +F somelogfile
$ command | tee file.txt | less
┌─────────┐ ┌─────────┐ ┌─────────┐
│ command │─▸│ tee │─▸│ stdout │
└─────────┘ └────┬────┘ └─────────┘
│
▾
┌───────────┐
│ file │
└───────────┘
$ grep -RnsI --color=auto <pattern> *
_ /|
\'o.O'
=(___)=
U ack!
$ ack <pattern>
$ find . -type d -empty -delete
$ git shortlog -sn
$ python -m SimpleHTTPServer
$ nc -l 5566 > data-dump.sql
$ nc <his-ip-address> 5566 < data-dump.sql
$ wget -m http://website.com
<ctrl-l>
$ reset
$ disown -a && exit
$ nohup command &
$ ssh user@host -t screen -r
$ ssh user@host cat /path/to/remotefile | diff /path/to/localfile -
$ curl ifconfig.me
$ ping -a IP_address
$ lsof -i
$ mount | column -t
$ df -h
$ du -sh *
$ du -s * | sort -nr | head
$ echo "ls -l" | at midnight
$ time read
<ctrl-d>
$ while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done &
$ ps aux | sort -nk +4 | tail
$ ps aux | grep ruby | awk '{ print $2 }' | xargs kill -9
$ ps aux | awk '/ruby/ && ! /awk/ { system("kill -9 "$2) }'
$ getconf LONG_BIT
$ cal 12 1984
$ cal | sed "s/.*/ & /;s/ $(date +%d) / [] /"
$ cal | sed "s/.*/ & /;s/ $(date +%d) / $(printf '\e[0;31m[]\e[0m') /"
$ man hier
$ man ascii
$ [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live"
$ telnet towel.blinkenlights.nl