Supercharge your Chromebook Linux Shell..

David Field
thesafewebbox
Published in
12 min readAug 23, 2022

There's no doubt ChromeOS is a solid OS and it's gaining traction fast. For me one of the most powerful areas of the eco system is the Linux Shell provided as part of the OS.

Coming from Linux desktops to have a command line available to me it a huge reason why I enjoy using Chromebooks.

Based on Debian the Linux container which is spun up when you enable Linux (Beta) on a Chromebook is a good solid base install of Debian and will work for most of your linux needs.

This post however is about sprucing up that container a little and pushing your linux environment just a little further and hopefully make it a bit more useful to use.

It goes without saying that all of these tools will run on most linux distros as well and within the links supplied there will be instructions on install and configuration. This post however is focussed on the Chromebook Linux Container.

This isn’t a deep dive, i’ve inclueded links so you can learn more about configuration of the tool. I’ll go through the install and basic setup and a few standout features

Fish is a replacement shell which is like bash but adds functionality, as an example tab completing, in the example below i typed in

and pressed tab

I can then use the tab keys to cycle round the files in the directory (better cample might be cat).

Other nicities are the config is done via a web page, the colour palette is quickly changed and it does some good completion of man pages.

InstallLaunch each time

To have fish launch each time you open the Linux shell or a new tab runthe command where <username> is the username in your shell.

example

Config File

Fish will use a config file which you need to create (nano, vi) whcih will run commands when fish launches and we will use this for some of the commands below.

The layout is simply

Neofetch is eye candy, its a predefined output which can be setup to display when running the command which outputs like this:

_,met$$$gg. david@penguin ,g$$$$$$$$P. ----------------- ,g$P" """Y$.". OS: Debian GNU/Linux 10 (buster) ,$P' `$$. Host: crosvm ',$P ,ggs. `$b: Kernel: 5.4.88-12224-gf05236dbdecf `d$' ,$P"' . $$ Uptime: 11 hours, 49 mins $P d The logo will adapt to the OS you're running. running --help at the end of the neofetch command line displays a large number of switches for customisation. Installsudo apt install neofetchConfig FileTo make neofetch run when you open a new shell, if you have fish running is as simple asnano .config/fish/config.fishand add the line (file may be empty if you've not added any other startup optionsneofetchSave and close the file.Open a new Shell tab

3) Starship

Starship is a prompt customisation tool which uses Toml files to configure your bash/fish prompt.Installcurl -fsSL https://starship.rs/install.sh | sudo bashAdd to FishAdd to the fish config in .config/fish/config.fishnano .config/fish/config.fishthe linestarship init fish | sourceOpen a new tab.ConfigA config file needs to be createdmkdir -p ~/.config && touch ~/.config/starship.tomlAn example config file looks like this# Don't print a new line at the start of the promptadd_newline = false# Replace the "❯" symbol in the prompt with "➜"[character] # The name of the module we are configuring is "character"success_symbol = "[➜](bold green)" # The "success_symbol" segment is being set to "➜" with the color "bold green"# Disable the package module, hiding it from the prompt completely[package]disabled = true# Use custom formatformat = """[┌───────────────────>](bold green)[│](bold green)$directory$rust$package[└─>](bold green) """# Wait 10 milliseconds for starship to check files under the current directory.scan_timeout = 10# Disable the newline at the start of the promptadd_newline = false#add username to the prompt[username]style_user = "white bold"style_root = "red bold"format = "user: [$user]($style) "disabled = falseshow_always = true#follow the username with the hostname[hostname]ssh_only = falseformat = "on [$hostname](bold red) "disabled = falseGives me a prompt that looks like this
The configuration options are plenty and various and found hereExamplesIf i run asudo apt updatethen i get the expected output of➜ sudo apt updateHit:1 http://ppa.launchpad.net/ansible/ansible/ubuntu trusty InReleaseHit:2 http://packages.microsoft.com/repos/code stable InRelease Hit:3 https://download.docker.com/linux/debian buster InRelease Get:4 https://deb.termius.com squeeze InRelease [4,310 B]Hit:5 https://deb.debian.org/debian buster InReleaseHit:6 https://deb.debian.org/debian-security buster/updates InReleaseIgn:7 https://storage.googleapis.com/cros-packages/89 buster InReleaseHit:8 https://storage.googleapis.com/cros-packages/89 buster ReleaseGet:9 https://deb.termius.com squeeze/main amd64 Packages [838 B]Hit:11 https://apt.syncthing.net syncthing InRelease Fetched 5,148 B in 6s (911 B/s) Reading package lists... DoneBuilding dependency tree Reading state information... DoneAll packages are up to date.~/cert took 6sThe prompt has told me how long it takes to run the command~/cert took 6s

4) tmux

Theres so much you can do with tmux is crazy, at its heart is a system which you can launch, run commands withing a screen, detatch from that screen then come back to it later to see if the process has finished. However it can also be a system where you split a terminal into windows and run commands in each window.If you spend a lot of time running proceses in linux or want to run several command line applications at the same time while troubleshooting, or ssh into multiple remote servers in the same screen, this may be the tool for you.Installsudo apt install tmuxConfigThe internet is full of tmux cheat sheets so I won't run through it here have a look at these two pages for an overviewExampleIf i wanted to run some cli applications I could runtmux new-session \; \send-keys 'mytop' C-m \; \split-window -v \; \send-keys 'sudo lazydocker' C-m \; \split-window -h \; \send-keys 'top' C-m \;Which runs bpytop across the top of the termina, lazydocker to the bottom left and top to the bottom right as displayed here.

5) tmate

Once you've got your head around tmux, tmate is an interesting bit of software for charing ssh sessions so others can see/use them.Installsudo apt-get install tmateRunIn this vide i have two tabs open, in reality these will be two different machines. I run tmate in one tab and then copy the generated ssh command and run that in the 2nd tab at which point i'm able to see the same output on both tabsThis is useful for training or remote viewing of tmux sessions. Its also interesting because i'm able to view the session on my Linux shell on a chromebook from a remote server.

6) bpytop

Having provided Fish instead of stock Bash, and setup the command prompt this is an enhanced version of the top tool for seeing in a very pretty way what is happening in your linux container.You will need pip3 installed.Installpip3 install bpytop --upgradeConfigureOnce installed a message will be displayed with the following:The script bpytop is installed in '/home/fieldymac/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.I "solved" this by running this (i've used mytop because I keep forgetting the name of the program)sudo ln -s /home/fieldymac/.local/bin/bpytop /usr/local/bin/mytopand runningmytop

7) glances

Glances is very similar to bpytop its an enhanced top command cli tool with the addition that you can also see the output in your web browserInstallsudo pip3 install glancessudo pip3 install bottleUsageRunning glances on the command line on its own in the command lineglances
and running glances with -w providesglances -wGlances Web User Interface started on http://0.0.0.0:61208/So navigate tohttp://penguin.linux.test:61208/In Chrome and you will see a realtime process output in your browser for the Linux container.

8) lazydocker

I fun docker-ce in my Linux container on the Chromebook mainly for testing before i deploy something I've written. I recently found lazydocker as a nice CLI GUI for looking at the docker containers. There are tools like portainer.io for doing this in the web, however something in the command line with TMUX makes for a very useful setup.Installsudo curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bashRunsudo lazydockerExampleA quick run through with the lazy docker command.

9) thefuck

Other than being the best, most aptly named project on Github if you are learning linux or have fat fingers like me this is a great command. Essentailly if a command fails, it attempts to tell you what you should be typing and gives that a go (with a y/n prompt)Installsudo pip3 install thefuckSeems like fuck alias isn't configured!Please put thefuck --alias | source in your ~/.config/fish/config.fish and apply changes with fish or restart your shell.ConfigureAdd to the fish config in .config/fish/config.fishnano .config/fish/config.fishthe linethefuck --alias | sourceOpen a new tab.ExampleA simple example of misspelling apt-get❯ aptget install nmapfish: Unknown command aptget~/cert❯ fuck​​​​​​​​​​apt-get install nmap [enter/↑/↓/ctrl+c]

10) iptraf

If you want to see what is happening on any of the network cards on your Linux shellInstallsudo apt install iptrafRunsudo iptraf-ngExamplesFor such a small command it does a lot, the --help swith is really useful if you want to capture what is going on on a specific port and output that to a log for a specific time which lends itself to some great scripting capabilities.sudo iptraf-ng --helpusage: iptraf-ng [options] or: iptraf-ng [options] -B [-i <iface> | -d <iface> | -s <iface> | -z <iface> | -l <iface> | -g]-h, --help show this help message-i <iface> start the IP traffic monitor (use '-i all' for all interfaces)-d <iface> start the detailed statistics facility on an interface-s <iface> start the TCP and UDP monitor on an interface-z <iface> shows the packet size counts on an interface-l <iface> start the LAN station monitor (use '-l all' for all LAN interfaces)-g start the general interface statistics-B run in background (use only with one of the above parameters-f clear all locks and counters-t <n> run only for the specified <n> number of minutes-L <logfile> specifies an alternate log file

11) lazygit

From the person who brought LazyDocker into my life is also LazyGit a cli git interface which responds to mouse input.Installgo get github.com/jesseduffield/lazygitsudo ln -s /home/**<USER**/go/bin/lazygit /usr/local/bin/lazygitRunFrom a folder with a git repo in it runlazygitor runlazygit -p </path/to/git/repo/>

Further Reading

, $P Packages: 1014 (dpkg), 7 (flatpak) $: $. - ,d$' Shell: fish 3.0.2 $; Y$b._ _,d$P' Resolution: 2256x1504, 6144x1920 Y$. `.`"Y$$P"' Theme: CrosAdapta [GTK2/3] `$b "-.__ Icons: CrosAdapta [GTK2/3] `Y$ Terminal: ld-linux-x86-64 `Y$. CPU: 06/8e (8) @ 2.304GHz `$b. GPU: Red Hat, Inc Virtio GPU `Y$b. Memory: 13MiB / 6604MiB `"Y$b._ `"""The logo will adapt to the OS you're running.running -help at the end of the neofetch command line displays a large number of switches for customisation.InstallConfig FileTo make neofetch run when you open a new shell, if you have fish running is as simple asand add the line (file may be empty if you've not added any other startup optionsSave and close the file.Open a new Shell tab3) StarshipStarship is a prompt customisation tool which uses Toml files to configure your bash/fish prompt.InstallAdd to FishAdd to the fish config in .config/fish/config.fishthe lineOpen a new tab.ConfigA config file needs to be createdAn example config file looks like thisGives me a prompt that looks like this
The configuration options are plenty and various and found hereExamplesIf i run athen i get the expected output ofThe prompt has told me how long it takes to run the command4) tmuxTheres so much you can do with tmux is crazy, at its heart is a system which you can launch, run commands withing a screen, detatch from that screen then come back to it later to see if the process has finished. However it can also be a system where you split a terminal into windows and run commands in each window.If you spend a lot of time running proceses in linux or want to run several command line applications at the same time while troubleshooting, or ssh into multiple remote servers in the same screen, this may be the tool for you.InstallConfigThe internet is full of tmux cheat sheets so I won't run through it here have a look at these two pages for an overviewExampleIf i wanted to run some cli applications I could runWhich runs bpytop across the top of the termina, lazydocker to the bottom left and top to the bottom right as displayed here.
5) tmateOnce you've got your head around tmux, tmate is an interesting bit of software for charing ssh sessions so others can see/use them.InstallRunIn this vide i have two tabs open, in reality these will be two different machines. I run tmate in one tab and then copy the generated ssh command and run that in the 2nd tab at which point i'm able to see the same output on both tabsThis is useful for training or remote viewing of tmux sessions. Its also interesting because i'm able to view the session on my Linux shell on a chromebook from a remote server.6) bpytopHaving provided Fish instead of stock Bash, and setup the command prompt this is an enhanced version of the top tool for seeing in a very pretty way what is happening in your linux container.You will need pip3 installed.InstallConfigureOnce installed a message will be displayed with the following:I "solved" this by running this (i've used mytop because I keep forgetting the name of the program)and running7) glancesGlances is very similar to bpytop its an enhanced top command cli tool with the addition that you can also see the output in your web browserInstallUsageRunning glances on the command line on its own in the command line
and running glances with -w providesSo navigate toIn Chrome and you will see a realtime process output in your browser for the Linux container.
8) lazydockerI fun docker-ce in my Linux container on the Chromebook mainly for testing before i deploy something I've written. I recently found lazydocker as a nice CLI GUI for looking at the docker containers. There are tools like portainer.io for doing this in the web, however something in the command line with TMUX makes for a very useful setup.InstallRunExampleA quick run through with the lazy docker command.9) thefuckOther than being the best, most aptly named project on Github if you are learning linux or have fat fingers like me this is a great command. Essentailly if a command fails, it attempts to tell you what you should be typing and gives that a go (with a y/n prompt)InstallConfigureAdd to the fish config in .config/fish/config.fishthe lineOpen a new tab.ExampleA simple example of misspelling apt-get10) iptrafIf you want to see what is happening on any of the network cards on your Linux shellInstallRunExamplesFor such a small command it does a lot, the -help swith is really useful if you want to capture what is going on on a specific port and output that to a log for a specific time which lends itself to some great scripting capabilities.11) lazygitFrom the person who brought LazyDocker into my life is also LazyGit a cli git interface which responds to mouse input.InstallRunFrom a folder with a git repo in it runor run
Further Reading

Originally published at https://tech.davidfield.co.uk.

--

--

David Field
thesafewebbox

A 35+ year veteran of the IT industry, now as well as being an IT Manager, I like to tinker with technologies and projects and blog about them.