Theres no doubt ChromeOS is a solid OS and its 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.
I put these together, and I do it mainly for myself. I put them on the internet because others might want to read them and maybe learn something new or inform me if i'm wrong. While writing them the spelling and grammar will be off. Focus on the content, not the writing..
11 Linux Shell Command line tools
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.
sudo apt -y install fish
Launch 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.
sudo usermod -s /usr/bin/fish <username>
sudo usermod -s /usr/bin/fish david
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
command1 command2 command3
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$' , $$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.
sudo apt install neofetch
To make neofetch run when you open a new shell, if you have fish running is as simple as
and add the line (file may be empty if you've not added any other startup options
Save and close the file.
Open a new Shell tab
Starship is a prompt customisation tool which uses Toml files to configure your bash/fish prompt.
curl -fsSL https://starship.rs/install.sh | sudo bash
Add to Fish
Add to the fish config in .config/fish/config.fish
starship init fish | source
Open a new tab.
A config file needs to be created
mkdir -p ~/.config && touch ~/.config/starship.toml
An example config file looks like this
# Don't print a new line at the start of the prompt add_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 format format = """ [┌───────────────────>](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 prompt add_newline = false #add username to the prompt [username] style_user = "white bold" style_root = "red bold" format = "user: [$user]($style) " disabled = false show_always = true #follow the username with the hostname [hostname] ssh_only = false format = "on [$hostname](bold red) " disabled = false
Gives me a prompt that looks like this
The configuration options are plenty and various and found here
If i run a
sudo apt update
then i get the expected output of
➜ sudo apt update Hit:1 http://ppa.launchpad.net/ansible/ansible/ubuntu trusty InRelease Hit: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 InRelease Hit:6 https://deb.debian.org/debian-security buster/updates InRelease Ign:7 https://storage.googleapis.com/cros-packages/89 buster InRelease Hit:8 https://storage.googleapis.com/cros-packages/89 buster Release Get: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... Done Building dependency tree Reading state information... Done All packages are up to date. ~/cert took 6s
The prompt has told me how long it takes to run the command
~/cert took 6s
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.
sudo apt install tmux
The internet is full of tmux cheat sheets so I won't run through it here have a look at these two pages for an overview
If i wanted to run some cli applications I could run
tmux 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.
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.
sudo apt-get install tmate
In 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 tabs
This 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.
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.
pip3 install bpytop --upgrade
Once 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/mytop
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 browser
sudo pip3 install glances sudo pip3 install bottle
Running glances on the command line on its own in the command line
and running glances with -w provides
glances -w Glances Web User Interface started on http://0.0.0.0:61208/
So navigate to
In Chrome and you will see a realtime process output in your browser for the Linux container.
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.
sudo curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
A quick run through with the lazy docker command.
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)
sudo pip3 install thefuck
Seems 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.
Add to the fish config in .config/fish/config.fish
thefuck --alias | source
Open a new tab.
A simple example of misspelling apt-get
❯ aptget install nmap fish: Unknown command aptget ~/cert❯ fuck apt-get install nmap [enter/↑/↓/ctrl+c]
If you want to see what is happening on any of the network cards on your Linux shell
sudo apt install iptraf
For 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 --help usage: 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
From the person who brought LazyDocker into my life is also LazyGit a cli git interface which responds to mouse input.
go get github.com/jesseduffield/lazygit sudo ln -s /home/**<USER**/go/bin/lazygit /usr/local/bin/lazygit
From a folder with a git repo in it run
lazygit -p </path/to/git/repo/>