PDF Version Available
This document is also available in PDF format: aliasesandothers.pdf
The PDF version includes bookmarks for easy navigation and is optimized for printing.
Accessibility Notice
This document is also available in HTML format at:
Link: https://aholdengouveia.name/IntroLinux/labs/aliasesandothers.html
The HTML version provides enhanced accessibility features including keyboard navigation, screen reader support, responsive design, dark mode support, and high contrast options.
Learning Outcomes
By the end of this lab, you will be able to:
- Look up, create, and use aliases, and explain how to make an alias permanent
- Identify your shell and the files that set up your environment, such as .bash_profile
- Modify your command prompt using environment variables, and restore it after it has been unset
Lab Instructions
Aliases
Reference: Link: https://linuxreviews.org/HOWTO_make_aliases_for_frequently_used_commands
- For this part we are going to create an alias that will untar a tarball easily.
- Look up alias by running help alias. Take a screenshot.
- Create an alias called untar that will run the command tar -xvf. Take a screenshot.
- Create a tarball of your folders (my video on how to use tar is linked under Resources). Take a screenshot.
- Run untar on that tarball. What happened? Take a screenshot.
- How would you make this a permanent addition to your bash profile? (Don't make it permanent, just tell me how you would do it)
- Pick one command that you use all the time, and create an alias for it. Tell me what the command is, why you chose it, and what you called your alias. Take a screenshot.
Environment variables
This part of the lab is about changing your command prompt. We will be using Environmental Variables to do this.
References:
Link: https://www.maketecheasier.com/8-useful-and-interesting-bash-prompts/
Link: https://wiki.archlinux.org/title/Bash/Prompt_customization
- Run the command echo $SHELL. What happened? Take a screenshot.
- To do this you need to change the variable PS1 and reset it to your desired prompt. Reset this to your full first name. Take a screenshot to pass in.
- What does your .bash_profile or .profile say? Take a screenshot.
- Go to the man file on Bash. You should be able to find options for your prompt. Try adding in the current time option, any of the 4 choices are fine.
- Run the command unset PS1. What happened? How did you fix it? Take a screenshot.
- Go to the Arch Wiki page on prompt customization (linked above), read through it and make a command prompt that you think will be most useful to you. What did you do? Take a screenshot.
Deliverables
One file should be submitted, with your name, date and lab title on it. It should have two clearly labeled sections:
- Aliases: your answers to the Aliases questions.
- Environment variables: your answers to the Environment variables questions.
Include screenshots of each of your successful commands and prompt changes. Make sure to clearly label any screenshots and answers so it's clear what you're solving. Since your prompt will change during this lab, every screenshot must include a note with your name and the term. This is an example of what it should look like:
Resources
References, a video, a PowerPoint and some notes are available at my website Link: https://www.aholdengouveia.name/IntroLinux/aliasesandothers.html
My FAQ Linux playlist on YouTube, with demos of many of the commands and scripts in this class Link: https://www.youtube.com/playlist?list=PLQOmuLC45eoQlIMH7oCNL6yFP7kWQubBo
My video on how to use tar Link: https://www.youtube.com/watch?v=x0EK6PmKRCU