These are some common tips and tricks for when you’re working in at the command line or in the shell.
We frequently have to use key combinations at the terminal. Some common notations are:
^
) syntax
^C
means “hold down Control and C at the same time”^X
means “hold down Control and X at the same time”<C-C>
“hold down Control and C at the same time”<C-X>
“hold down Cotnrol and X at the same time”Also, <CR>
is not a typo for <C-R>
. Instead, <CR>
stands for
“carriage return” and basically just means “ENTER”.
Typing things out is very time consuming and error prone. The shell has a feature called tab completion which lets you press “TAB” to automatically complete the names of files when you’re running shell commands.
cd
ShortcutsThere are a few fancy shortcuts for cd
:
cd ..
cd -
cd
‘d herecd
(no arguments)
Bash keeps track of all the commands you run, and you can use this to your advantage.
history
!!
sudo
!!
There are multiple ways to try quitting things.
^C
^D
q
less
or man
, you can press q
to quit.:q
When you work at the command line often, you end up pressing Control and Escape frequently. Also, chances are that you don’t use Caps Lock that often. As a result, you may want to change your laptop settings to send either Control or Escape instead of Caps Lock when you press the Caps Lock key.
Copyright © 2014, Great Practical Ideas in Computer Science.