bashrc file and command aliases

Most users are running the bash shell on our system. One file that controls the bash shell is the ~/.bashrc file. You can look at or edit this file with any text editor, like vim or atom:

atom ~/.bashrc

In this file you can change your prompt, set environment variables, and create command aliases. The ~/.bashrc file is run anytime you create a new terminal window, so you typically put stuff in this file that you want to happen/be accessible for all terminals.

For example, suppose you like to print code files 2-per page, in landscape mode. Here’s how you can do that with a command called enscript:

enscript -2rhGj prog.py

I’ve made a alias called land that runs that same command. Here’s the alias definition in my ~/.bashrc file:

alias land='enscript -2rhGj'

Now, in any terminal window, I can type land prog.py to print my files in landscape mode.


See also:


Back to SwatCS Help Docs