30 shell tricks Cheat Sheet by TME520 (TME520) via cheatography.com/20978/cs/17483/

Top 30

Run the last as root !!

Serve current directory http://$HOSTNAME:8000/ python -m SimpleH​ TTP​ Ser​ ver

Runs previous command but replacing "H​ ello Morld"

^Morl​ d^​ World

echo "H​ ello World"

Rapidly invoke an editor to a long command [ctrl+x e]

Place the argument of the recent command on the shell 'ALT+.' or ' .'

Salvage a borked terminal reset

List currently mounted filesystems in layout | column -t

Get your external IP address curl ifconfi​ g.me

Execute a command at a given echo " -l" | at midnight

Output your microphone to a remote computer's speaker if=/dev​ /dsp | ssh -c arcfour -C usernam​ e@ dd of=/dev​ /dsp

Type partial command, check something, resume typing /etc/ssh/ [ctrl+u]

ls -lisa /etc/ssh/

[ctrl+y] vi /etc/ss​ h/s​ sh_​ con​ fig

Mount folder/filesystem through SSH sshfs name@se​ rve​ r:/​ pat​ h/t​ o/f​ older /path/t​ o/m​ oun​ t/p​ oint

Mount a temporary ram partition mount -t tmpfs tmpfs /mnt -o size=10​ 24m

Download an entire website wget --rando​ m- -r -p -e robots=off -U mozilla http://​ www​ .ex​ amp​ le.com

Clear the terminal screen [ctrl+l]

Compare a remote with a local file ssh user@host /path/t​ o/r​ emo​ tefile | /path/t​ o/‐​ loca​ lfile -

Update twitter via curl curl -u user:pass -d status=​ "Twe​ eting from the shell" http://​ twi​ tte​ r.co​ m/​ sta​ tus​ es/​ upd​ ate​ .xml`

SSH connection through host in the middle ssh -t reachab​ le_​ host ssh unreach​ abl​ e_h​ ost

Close shell keeping all subprocess running -a &&

Make '' behave like ' -f' less +F somelog​ file

Put a console clock in top right corner while 1;do tput sc;tput cup 0 $(($(tput cols)-‐​ 29))​ ;da​ te;​ tput rc;done &

Shutdown a Windows machine from Linux net rpc -I ipAddre​ ssO​ fWi​ ndo​ wsPC -U usernam​ e%‐​ pass​ word

List of commands you use most often | '{a[$2]​ ++}​ END​ {for(i in a){print a[i] " " i}}' | -rn |

32 bits or 64 bits? getconf LONG_BIT

Set audible alarm when an IP address comes online ping -i 60 -a IP_addr​ ess

Reboot machine when everything is hanging + + - - - - -

By TME520 (TME520) Published 17th October, 2018. Sponsored by ApolloPad.com cheatography.com/tme520/ Last updated 1st December, 2018. Everyone has a novel in them. Finish tme520.com Page 1 of 2. Yours! https://apollopad.com Top 30 linux shell tricks Cheat Sheet by TME520 (TME520) via cheatography.com/20978/cs/17483/

Top 30 (cont)

Simulate typing echo "You can simulate on-screen typing just like in the movies"​ | pv -qL 10

Quickly rename a file filenam​ e.{o​ ld​ ,new}

Escape any command aliases \[​ and]

Delete all files in a folder that don't match a certain file extension !(.foo​ |.bar​ |*.baz)

Bonus: Tricks of the ancient UNIX masters

Reuse all parameter of the previous command line !*

Sharing file through http 80 port nc -v -l 80 < file.ext

Display a block of text with AWK awk '/start​ _pa​ tte​ rn/​ ,/s​ top​ _pa​ tte​ rn/' file.txt

Kills a process that is locking a file -k filename

Display all current terminal settings stty -a

Type a string, hit [ctrl+d] and see the ASCII codes -cx

By TME520 (TME520) Published 17th October, 2018. Sponsored by ApolloPad.com cheatography.com/tme520/ Last updated 1st December, 2018. Everyone has a novel in them. Finish tme520.com Page 2 of 2. Yours! https://apollopad.com