Ever regret you didn’t take that speed reading class when the output some console program scrolls by too fast? Worry not, there’s a fix for that.
It’s possible to suspend and resume the output from any console program. It’s also possible to scroll back and forth in the console buffer, whether you are in a graphical terminal or a text-mode console such as the Linux virtual terminal (textmode VT).
Bash and Zsh
Ctrl-S - suspend output from current program
Ctrl-Q - continue output from current program
Ctrl-PgUp - scroll backwards in the console buffer to read older program output
Ctrl-PgDn - scroll forwards in the console buffer to read newer program output
A common rookie mistake is to freeze the entire terminal by accidentally hitting Ctrl-S. When this happens, hitting Ctrl-Q will thaw it just fine.
(These shortcuts work on most recent Linux systems. Your mileage may vary on Solaris.)
Ctrl-C - terminate the currently running process
Ctrl-Z - suspend the currently running process
Use fg to start the process again, in the foreground. Use bg to start the process again, in the background.
Use jobs to list all programs you have started in the current shell that run in the background (usually all programs you have started with as program & or that you have run bg on).
More shortcuts in trick #2.
(These shortcuts work on most recent Linux systems. Your mileage may vary on Solaris.)
Bash and Zsh
Ctrl-. - insert last argument from the previous command
Ctrl-R - as-you-type reverse search through the shell history
Ctrl-K - delete all text after the cursor
Ctrl-H - delete the previous character (old-school backspace)
Esc-u - turn rest of the current word into uppercase
Esc-l - turn rest of the current word into lowercase
Esc-c - capitalize current letter, then jump to end of word
Update: More shortcuts in trick #1.
I’ve come to realize that skills that I believe are basic for any Linux/Unix user seem to be anything but.
In the interest of backing up my future “I told you so” statements, I’ve decided to write a series of tiny blog posts that tells people so.
First up: Builtin keyboard shortcuts for moving around on the command line.
(These shortcuts work on most recent Linux systems. Your mileage may vary on Solaris.)
Bash and Zsh
Ctrl-A - move cursor to beginning of the line
Ctrl-E - move the cursor to end of line
Esc-f - move cursor to first letter in next word
Esc-b - move cursor to first letter of previous word