Suggested day 2920–30 minutesCaution

Mission 4 of 5

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.

Outcome: You can personalize the terminal reversibly.

Mental model

Understand what is happening

.bashrc runs for interactive Bash shells.

Temporary PS1 changes vanish when you close the shell or source defaults.

Practice customization in ~/linux-practice first.

Guided lab

Work through the mission

1

Inspect, do not edit

Read-only

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

Terminal
cat ~/.bashrc | head -30
2

Temporary prompt

Safe

Changes and restores the prompt only in the current shell.

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

Practice alias file

Safe

Sources aliases from a removable practice file.

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

Real .bashrc edit example

Explanation

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

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

Checkpoint

Verify the mission

The customization works and the original state can be restored.

Try it yourself

One step without a recipe

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

Need a hint?

Test every shell change in your current session before putting it in .bashrc. Change PS1 live. Add an alias with `alias`. If it breaks something, close the terminal and start fresh. Permanent config deserves a probation period.

Explain it back

Before you move on

  • Why use ~/linux-practice/my_aliases first?
  • What does source do?

Shortcuts:Alt + ← previous lessonAlt + → next lessonAlt + H home? focus search