Caring for your virtual environment
Tutorial
The verbose exercise instructions are here, but make sure to view this page as a RevealJS presentation for the slides.
If you haven’t before, investigate the settings of your local emulator:
Customising your local terminal emulator
Please refer to your emulator’s documentation for full details on how to customize…
Most platforms have a default terminal, but these often aren’t feature complete and can leave you wanting more.
Platform agnostic
Alacritty
MacOS
iTerm2
Windows
PuTTY
Customising your shell environment
Run the rest in your Linux terminal:
- Experiment with modifying your PS1 manually
- Attempt to modify your PS1 within your
~/.bashrc
, or modify other settings - Load and open tmux, make a new pane, switch to it, and close the previous pane
- Install
oh-my-bash
or your equivalent, and load a pre-defined configuration
Backups
For some of this exercise, we will be modifying your ~/.bashrc
. Before we do this, it’s a good idea to back it up.
You can do this in the following fashion:
$ cp ~/.bashrc ~/.bashrc.bak
Then, if you ever want to restore from this backup:
$ cp ~/.bashrc.bak ~/.bashrc
This manual process is nice, but still isn’t foolproof. What if you rm -rf ~
!? (please don’t do this).
Customising your shell
Assuming you haven’t already configured something like oh-my-bash
, let’s get started.
Your shell’s “prompt” is configurable through the environment variable PS1
. PS1
here means “primary prompt”.
Try configuring your shell in the “hello-world” way:
$ export PS1="Hello, world! "
Then, you should see a modified prompt!
If you have issues with this, it is likely because the environment variable PROMPT_COMMAND
is configured to set PS1
.
To fix this, you can run the following command:
$ unset PROMPT_COMMAND
Then, re-export your PS1
, and you should be good to go!
Persisting changes
Now that we have modified this change manually, we probably want to have this persist across our login sessions. In order to do this, you will have to modify your ~/.bashrc
file. Do this using the OpenOnDemand file explorer + text editor if you don’t have an IDE or shell based editor configured. Simply paste the commands that you needed to run manually into the bottom of this file, and you should be good to go! Remember that you can always restore from a backup as needed.
Make sure to run source ~/.bashrc
to see changes in your shell whenever you make modifications to your ~/.bashrc
oh-my-bash
https://github.com/ohmybash/oh-my-bash?tab=readme-ov-file#basic-installation - follow the basic-installation instructions here.
Then, picking a theme from the following list, https://github.com/ohmyzsh/ohmyzsh/wiki/themes, add a line like the following to your ~/.bashrc
to configure the theme:
OSH_THEME="powerline"
Make sure to run source ~/.bashrc
to see changes in your shell whenever you make modifications to your ~/.bashrc
tmux
You need to first install tmux using either apt or homebrew. Google what is best for your environment.
Once tmux is installed:
# This might be easier placed in your `.bashrc`
$ export TERM=xterm-256color
$ tmux
Then, you should see a green boarder around the bottom of your shell! This is tmux. In order to exit tmux, you can simply run exit
in your shell.
https://hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/#starting-your-first-session - feel free to follow the contents of this article and explore tmux further if this sounds like a good window management approach to you.