Coding ยท ยท

NOTE: you probably don't want this guide, unless you're feeling particularly adventurous!

Advanced command line usage

This is an optional guide for those interested in some advanced command line usage. Windows users probably want to install WSL first.

WSL

This section is for Windows users who want a full Linux experience.

NOTE: for 2025, I made this section entirely optional and not recommended (but all students in the previous 2 years did it). If you're on Linux or macOS, this section is irrelevant for you. If you're on Windows, you can do this step, but it's no longer required. It's possible, though, that we'll come back to it later in the year

We'll be installing a flavour of Linux called Ubuntu in a virtual machine (VM) within our host Windows operating system (OS). Having Linux running within Windows in this way is officially supported by Microsoft, and they've called it WSL (Windows Subsystem for Linux).

Install WSL, using your lower-case forename (eg 'jake' not 'Jake') as Linux user and putting in a password (you won't see the password, but press enter when done). You may have to restart before you can use it.

About 20% of students run into some kind of issue installing WSL. If you get some kind of error when following the above guide, here are some things which have worked for others in the past:

We now need to set up VSCode to use WSL correctly. This assumes you have VSCode installed already.

With VSCode installed and open to your Linux VM, you'll now open the Linux command line within VSCode:

Linux user config files

You'll find various config files in your home ~ folder - they tend to start with a .. Have a look at your .bashrc and your .profile file by opening them in VSCode with eg code ~/.profile. These files are run when you open a terminal and you can modify them to do things like add aliases and run scripts on startup.

Pimp your shell

Windows

NOTE: For me, Starship seems very slow on Windows, so probably best not to use it

Linux, macOS and WSL

Head on over to https://starship.rs/ and follow the instructions to pimp your shell. In brief, in a terminal run curl -sS https://starship.rs/install.sh | sh.

Also add the following to the end of your .bashrc file eval "$(starship init bash)" then exit your shell and open a new one.

All

Make a file called $HOME/.config/starship.toml and put the following in it:

[time]
disabled = false
format = '[$time ]($style)'

[git_branch]
symbol = '^'

[nodejs]
detect_extensions = []

[bun]
detect_extensions = ['js', 'jsx', 'ts']

See the docs for other config tweaks you can make. There's also something about installing a nerd font, which I haven't got round to yet myself but will get rid of weird ? symbols in your shell.

Keep pimping by fishing

NOTE: you can only do this on Windows if using WSL

You may want to try a different shell such as fish for eg more colours and some awesome auto completion. Install it with:

sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
sudo apt install fish

Run fish with fish then exit to get back out. Then get Starship working in fish by adding starship init fish | source to the bottom of ~/.config/fish/config.fish. Try running it again with fish and you'll see it has Starship in it now. Close/exit your terminal in VScode completely.

If you like it, in VSCode close/exit your terminal completely then open a new one and click the down arrow next to the '+' then 'Select default profile' and choose 'fish'. Close the terminal and open a new one and it should be fish instead of bash. If you change your mind later, switch the default profile back to 'bash'.

Pimp a bat into a cat

NOTE: you can only do this on Windows if using WSL

We can use cat in the terminal to show the contents of a file. But there's another command we can install called bat (or batcat) which looks nicer with syntax highlighting and line numbers.

Run sudo apt install bat to install bat as batcat, then add alias cat='batcat' to your ~/.config/fish/config.fish file to be able to run it as cat instead of batcat. Close and open a new terminal then try it out with eg cat ~/.config/fish/config.fish (then arrows to navigate up/down and q to exit).

CLI text editors - emacs and vim

Many uber-geeks use a CLI text editor instead of a GUI one such as VSCode. Popular choices are emacs and vim. If interested, best to find someone you know who's tried them before to get some tips.

Some more Linux commands

The following are for Linux and WSL only:

Installing packages on macOS

Troubleshooting and extra bits for WSL

Forgot your WSL/Linux/Ubuntu password?

Oops! Thankfully it's easy to reset. Open a PowerShell in Windows then run wsl -u root, then passwd <username> (eg passwd jake if your Linux username is 'jake'), then enter a new password when prompted.

How can I find my Linux files from Windows?

In Windows, open File Explorer then bottom-left click 'Linux', then navigate to eg /home/jake. The Linux files are stored within WSL's Linux installation VM, which Windows sees as a network file share. You may want to pin the folder to your favourites in File Explorer.