Introduction
Created by Christopher Lawrence GS '24
Welcome to the last tutorial! We made it. Look at us. Becoming command line pros! In this tutorial we will briefly learn about customizing our command line experience, then we will learn to script together commands we have learned so far, touch on some programming languages, and finish by learning some fun and silly commands. Ready?!!
When we open up our computer, it is customary to be met with a login screen. When we login, all of our data and applications belonging to our profile are loaded up and ready for us. When we open up the terminal, we are also logged in and similarly, our user specific environment is loaded up. We can customize this environment to make our time on the command line as efficient and enjoyable as possible.
~/.bashrc

nano ~/.bashrc
alias ll = 'ls -alF'
Each time we open up the command line, it will open and read the bashrc file that belongs to the user. In the example gif, we can see this bashrc file belongs to Christopher and can be found in ~/home. We can place different commands in this file to customize our environment and make our experience unique! One of these commands is alias.
aliases
One of the easiest ways to customize our environment is through the use of aliases. In short, these are commands that we type as shorthand for longer commands. We can see some example aliases in the bashrc file shown above. Aliases are short-hand commands that we can run instead of typing the full command. In other words, a command that another command is known by, i.e. an alias. In the example below, we are shown an alias ('ll') which can be run instead of typing the full command ' ls -alF '.

paths and $PATH
Often when we install new programs onto our computer, we need to point our command line to where they are so that we can use them. The simplest way to ensure our computer knows where the program is located, is by adding the path to said program to our bashrc file. For example, in the last tutorial we created a program hello.c and made it executable (./hello.exe). However, to run this program, we would have to be in the directory where this file is, to run it. To get around this, we can add the path to our bashrc file and have that command at our fingertips without going to the directory. Lets try this out.
nano ~/.bashrc export PATH="~/Desktop/:$PATH"
source ~/.bashrc
hello.exe
Now that we have a good understanding of how to customize our environment, we are ready to use our command line to its full potential!
FYI
You can restore your bashrc if you accidently delete it.
Make a new one:
touch ~/.bashrc
cp ~/.bashrc ~/.bashrc.bak
copy the saved one:
cp /etc/skel/.bashrc ~/
Load the new one:
source ~/.bashrc
Bash Scripting
Through out this tutorial we have been typing out commands one at a time. This is tedious and time consuming. Luckily, the command line has its own scripting language that we can use to issue multiple commands in series. This language is called bash and writing in it is bash scripting. So just as we would type in (python/r/perl/ruby/rust/blood-gulch) we can do so in bash.

For example, we can write a simple hello world script using the echo command. Open a new file called hello.sh. You can use nano, vim, whatever you want. Save it to the Desktop. To run this, we need to call the interpreter. In this case it is bash. The .sh tells bash that this script is written in bash and is ready to be read and run.

cd Desktop
nano hello.sh
echo "Hello World"
bash hello.sh
Bash scripting is very useful for making automating tasks and making our command line experience easier. Bash can also be used to interact with other programming languages. For instance, python and R are languages who have frameworks installed on the command line. Instead of interacting with them through their GUI's we can use the command line to write programs, then use their respective interpreters to run these programs.
Miscellaneous Utilities
There are many other utilities to try out on the command line. Here are some that may be of interest crontab/alsa/pulseaudio/awk/grep etc.

Command line shenanigans
Working on the command line can be an arduous process. Often it can be defeating to write commands and have programs fail. There also isn't a lot of color on the command line (changeable in settings) and can feel devoid of emotion and life. At times like these it helps to have some fun commands in our back pockets to brighten up our days. Below I will cover some of my favorites! To find out more, you can man these commands.
sl (Short for Steam Locomotive)

sl
cowsay

cowsay (your text here)
fortune

fortune
cmatrix

cmatrix
asciiquarium

asciiquarium
Well Done!! You have now completed the tutorial! Please download the certificate below as proof of completion!
Certificate-Template-Word-3.pdf
I hope you had fun learning with me; I enjoyed writing this. I'll see you on the command line! Take care, CGL