Alias, history, _bash, prompt
Learning outcomes:
- Show how to use alias to substitute for a command string
- Describe the _bash files and their uses
- Show how to modify the user prompt
Would you like to download my PowerPoint to follow along?
- Alias
- Shortcut or synonym for frequently used commands
- Easy way to use complex command structures (lots of switches, pipes etc.)
- To create an alias use
alias
to deleteunalias
- To make permanent add alias to .bashrc DANGER HERE easy to mess up the .bashrc file use caution
- Hidden bash config files
- Use the switch -a to see them,
ls -a
shows hidden files - Also referred to as Bash Initialization files
- .bash_profile
- Runs on log in
- Used to set paths
- Changes you want to happen at log in
- .bash-history Records all commands used
- Prompts
- User prompt is environmental variable
- Show: echo $PS1
- Change: PS1=newprompt
- Permanent change by changing .bash_profile DANGER!! Can mess yourself up very easily and very badly
- Customizing the Bash Prompt: Terminal Layout Guide
- Customizing Bash Prompt
- Potentially useful prompts
- Show last command run
- Change color if last command run was successful
- Show working directory
- Show directory info
- $ _ Bash Prompt Generator
- Bash prompt generator with colours
- 8 Useful and Interesting Bash Prompts
Suggested Activities and Discussion Topics:
- Lab assignment: PDF version (accessible HTML version)
- Go to this GitHub "A curated list of delightful Bash scripts and resources." and pick one the resources to try. Which one did you pick? Why?
- Activity: Listen to This Podcast That was created using AI from these materials. Transcript for the Podcast What are your thoughts? Did the AI do a good job representing the materials? Did you find any mistakes?
- Go through This AI generated study guide, what do you think? Did it capture the week materials well? How did you do on the self quiz? Do you know all the vocab used?
- Go through This AI generated briefing document, what do you think? Did it capture the week materials well? Was there anything it missed? Do you know all the vocab used?
Would you like to see some more classes? Click here