Setting Up Raspbian Bash Shortcuts
August 16, 2019
As I've written before I'm a big fan of bash shortcuts, aka aliases (I also wrote about it a second time). When I got a new [Raspberry Pi](/tags/raspberry-pi) I really missed using them. So I learned how to set them up.
It’s Pretty Simple
The docs explain pretty clearly how to do this, and how the existing .bashrc
is set up. You can see these hidden files by running ls -a
on the Raspbian command line:
pi@raspberrypi:~ $ pwd |
On a fresh Raspbian install, this .bash_aliases
file won’t be there, so you need to create it:
pi@raspberrypi:~ $ touch .bash_aliases |
Then open the file:
pi@raspberrypi:~ $ nano .bash_aliases |
Then add your commands. In my case, I wanted to start & stop my remote desktop server more easily, and create a shortcut to take a photo:
alias vncstart='vncserver :1 -geometry 1280x720 -depth 24' |
Press ctrl + x
to begin exiting Nano, y
to save, and Enter
(or Return
) to save it to the same filename.
Once back on the command line, run source .bashrc
to bring the new aliases into effect.
Voila!