Mission 29 of 30

Customizing Your Shell Safely

Try a shell customization with a tested rollback path.

Experiment with aliases, prompt changes, and sourced files inside the sandbox before touching .bashrc.

40–50 min Week 4 · Scripting, scheduling, customization, final project Ubuntu terminal
Your outcome: You can personalize the terminal reversibly.
Practice inside ~/linux-practice. Check your setup before you begin. Prerequisite: Locating Files and Reading Documentation .

What you’ll practice

  • Temporarily change PS1
  • Source a practice alias file
  • Understand .bashrc without editing it

The mental model

  • .bashrc runs for interactive Bash shells.
  • Temporary PS1 changes vanish when you close the shell or source defaults.
  • Practice customization in ~/linux-practice first.

Try it in your terminal

Inspect, do not edit

Read-only system view

Reads the beginning of your real .bashrc without changing it.

Run from ~/linux-practice

cat ~/.bashrc | head -30

Temporary prompt

Safe in practice folder

Changes and restores the prompt only in the current shell.

Run from ~/linux-practice

OLD_PS1=$PS1
PS1='Practice> '
echo 'Prompt changed for this session'
PS1=$OLD_PS1

Practice alias file

Safe in practice folder

Sources aliases from a removable practice file.

Run from ~/linux-practice

echo "alias showdate='date +%Y-%m-%d'" >> ~/linux-practice/my_aliases
source ~/linux-practice/my_aliases
showdate
unalias showdate

Real .bashrc edit example

Explanation only

This permanently modifies your real shell startup file. Explanation only in this course.

Run from do not run

echo "alias la='ls -A'" >> ~/.bashrc

Put it into practice

  1. Create a practice alias file with one alias and source it.
  2. Remove the alias with unalias.

Check your result

The customization works and the original state can be restored.

Common mistakes

  • You experiment by appending `echo 'alias foo=...' >> ~/.bashrc` over and over. After ten tries, your .bashrc has ten duplicate lines and three broken aliases. Test in the current session first. Write to .bashrc once, when you know it's right.
  • You put `source somefile.sh` in your .bashrc without reading what's in it. The source command runs every line in that file as if you typed it yourself. A malicious or buggy sourced file can break your shell or worse. Only source files you've inspected.

Check your understanding

Explain these in your own words. If you’re unsure, revisit the examples before moving on.

  1. Why use ~/linux-practice/my_aliases first?
  2. What does source do?

Your practice, your pace

Loading saved progress…

Discussion

Continue the conversation about this guide. Loading comments connects to GitHub Discussions through giscus.

Open community discussions on GitHub

Check before you copy

This command needs care. Read its context, confirm the target and location, and keep a recovery path.

Copying does not run a command.