I was tearing away this morning configuring something in the shell. My wife peaks over my shoulder and says “How do you do that?!” I have a nice laugh and there was born an idea for my next post. This post outlines
some basic shell shortcuts. note: these use the default shell bindings, based on emacs.
First lets start with some simple stuff.
Clearing the screen. I still see a lot of people using the old ‘clear’ command to do that. A shorter method is:
Exiting the shell or logging out. I’m sure the most common way to exit your terminal session is using the ‘exit’ command. This can also be done with:
Searching the history. I’m guessing you’re familiar with using the up/down arrow keys for finding previous run commands. Did you know you can search through your history too, helping avoid hitting up a hundred times.
ctrl-r + command
The above will find the most recent match. If you’d like to go further back hit the key sequense again and it’ll toggle through matches of ‘command’ deeper into your history.
Using the previous argument. This is one of my favorites, and really can save some typing and monotony. You can drop in previously used arguments to your current commands with:
esc-. or alt-.
These are all that came to me off the top of my head. What other shortcuts do you use for the default shell? I’ll have a future post about
set -o vi, so if you’ve got tips for that hold them for now.
You also might be interested in an earlier post on using copy and paste within the terminal.