Linux CLI cheat sheet from Pixel Beat |
Actually my favourite of these is 9 ways to recover your screen. that has come in useful countless times.
- 25 Sick Linux Commands
- 25 Even More Sick Linux Commands
- 9 Ways to recover your screen
- Command line chea tsheet
- How to colour the Bash promtp
Here's a couple of tips that I now use everyday (can't remember if they're covered in the above posts.):
- Change to you previous directory
cd -
- Insert the last argument from the previous command
[ESC]+.
That's hold down escape and press .
This is a great one if you're processing a file in multiple steps. The result file is often the last argument of a command then is will be an argument of the next command. - Here's my prompt:
PS1="\[\e[30;1m\]\u@\h:\[\e[34;1m\]\w\n\`if [ \$? = 0 ]; then echo \[\e[30m\]! \!\[\e[30m\]\$; else echo \[\e[31m\]! \!\[\e[30\;0m\]\$; fi\` \[\e[0m\\]"
It looks like this:
user@host:/current/working/directory
! 506$
If the command you run returns an exit status that's not 0, i.e. it fails, then it looks like this
user@host:/current/working/directory
! 506$
It'll definitely have to write my own top tops post.
More on the linux command line: How backgrounds and prompts can means less mistakes and Enabling alt+f and alt+b in gnome terminal
More on the linux command line: How backgrounds and prompts can means less mistakes and Enabling alt+f and alt+b in gnome terminal