SSH Proxy  • • •  Install new cursors for Ubuntu       all posts in Archive

A few Bash skills should be remembered

1. sudo !!

How to recall the previous command? This is the one the most cool way.
The "!!" is a special feature which called event designators. And it equals  "!-1" , so it means you can also use "!-2","!-50","!-250" ... Usually, system will store 500 latest used commands in ~/bash_history.

2. cd -

This is the way to go back the directory where you just been.

3. time read

A easy timer. Caculate time until press enter.

4. history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head

Show the top 10 most used commands.

5. sudo netstat -tulnp

Show the threads occupying ports.
-t: show TCP connection information
-u: show UDP connection information
-l: show monitoring ports
-n: show ip directly
-p: show thread PID and name ,need root user

6. top

Show the most used memory programs.
or you can do this : ps aux | sort -nk +4 | tail

7. The hot key should also remember:

Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L    Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W Delete the word before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + T Swap the last two characters before the cursor
Ctrl + P    Show previous command
Ctrl + N   Show next command
Tab Auto-complete files and folder names