The command line / Terminal is a fantastically powerful piece of technology and today I am going to share some of the shortcuts / facts I have learned to help speed up your usage of it. These shortcuts / facts should work on a Raspberry Pi, most Linux systems and Mac OS X’s Terminal.
Navigating
ls
Lists all the files and folders in the current directory
cd
Changes to another directory e.g. If you were in /Pi/Home/ and wanted to go to /Pi/Home/MagPi/ then cd MagPi
Command Switches
Switches generally come after a command for example in:
ping http://www.geektechstuff.com -c 5
ping is the command and -c is the switch. Single letter swithces are prefixed with – ,whilst switches that are words are prefixed with –.

For example the version switch for the git command starts with — as the switch is a whole word:
git –version

And as seen above the count (c) switch for the ping command starts with one – as is is a single letter switch.
Clearing The Screen

Sometimes there is so much data in the terminal window that it easy to get lost. Using the clear command will wipe the screen.

Lost
If your navigating around using the cd (Change Directory) command and don’t know where you have ended up then use pwd to get the terminal to tell you which working directory you are currently in.
History
Want to see what commands you have recently used? Hit the up arrow and you can browse through them. Very useful if you have mistyped a command.
Keyboard Shortcuts
When using the history command it can be a little tedious getting to a certain point in a command if you have to rely on the left and right arrow keys, thankfully there are some keyboard shortcuts:
ctrl a moves the cursor to the beginning of the command
ctrl e moves the cursor to the end of the command
ctrl h deletes the character to the left of the cursor
ctrl u deletes everything to the left of the cursor
ctrl d deletes the character currently underneath the cursor
ctrl k deletes everything to the right of the cursor
You must be logged in to post a comment.