My Pop! OS setup

I’m keeping a log of my System76 / Pop! OS setup as a reminder to myself as well as to provide others with helpful settings and snippets

Command line tools

Working on the command line is my most fun and efficient way of interacting with the computer. Coming from macOS, I was used to the package manager brew to install and update command line tools. Since apt-get doesn’t provide recent versions of many CLI tools, I’m continuing to use brew on Linux as well.

Tools available in brew

Firstly, installing brew itself:

/bin/bash -c "$(curl -fsSL"
echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> ~/.profile
source ~/.profile

And then installing cli tools available via brew:

# fzf - general-purpose command-line fuzzy finder
brew install fzf
/home/linuxbrew/.linuxbrew/opt/fzf/install --key-bindings --completion --update-rc # installs useful keybindings and fuzzy completion
source ~/.bashrc   # source settings made by previous install command

brew install docker-compose
brew install doctl              # DigitalOcean CLI
brew install helm               # K8s package manager
brew install imagemagick        # Image processing
brew install jq                 # JSON processing
brew install kubectl            # Kubernetes CLI
brew install neovim             # My favorite text editor
brew install postgres
brew install ripgrep            # Better grep

Other tools, not available in brew

sudo apt install                                   # docker is also available via brew but I had some issues installing it
sudo apt install gnome-shell-extension-autohidetopbar        # hides any window's top bar
sudo apt install tlp tlp-rdw --no-install-recommends         # incrases battery life:

curl -Ls -o ~/bin/trans && chmod +x ~/bin/trans # translator:

~/.profile exports

export FZF_DEFAULT_COMMAND='rg --files --follow --hidden -g "!{node_modules/,.git/}"'
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

~/.bashrc aliases and functions

alias awkp1="awk '{print \$1}'"
alias decode_ssl='openssl x509 -text -noout -in'

Run a few commands on every system start

I want to run a few commands on every system start such as

  • set battery charging thresholds to increase battery life
  • setting the initial screen brightness ot the lowest value that is available via the Fn brightness keys (in fact, the screen brightness can be set to a value as low as 1, but that makes the screen barely readably in very bright surrounding conditions)
  • enable audio codec power saving
sudo tee /etc/rc.local << EOF > /dev/null

# Set charging thresholds to increase battery lifespan
echo '50' > /sys/class/power_supply/BAT0/charge_control_start_threshold
echo '85' > /sys/class/power_supply/BAT0/charge_control_end_threshold
# Alternatively, this works, too:
# system76-power charge-thresholds 50 85

# Set LCD brightness to minimum value
echo '3663' > /sys/class/backlight/intel_backlight/brightness

# Enable audio codec power saving
echo '1' > /sys/module/snd_hda_intel/parameters/power_save
echo 'Y' > /sys/module/snd_hda_intel/parameters/power_save_controller

exit 0
sudo chmod -v +x /etc/rc.local
sudo tee /etc/systemd/system/rc-local.service << EOF > /dev/null
 Description=/etc/rc.local Compatibility

 ExecStart=/etc/rc.local start

sudo systemctl enable rc-local.service

Neovim setup

Many programmers prefer neovim over the original vim and here’s my personal neovim setup:


curl -fLo ~/.vim/autoload/plug.vim --create-dirs \


Editor settings and plugins go to ~/.config/nvim/init.vim. Run

nvim -c "PlugInstall" -c "qa"

to install the plugins from your command line, having nvim quit right after.

set backspace=indent,eol,start
set clipboard=unnamedplus
set colorcolumn=91
set nocompatible
set number relativenumber
set ruler
set runtimepath+=~/.vim
set runtimepath+=/home/linuxbrew/.linuxbrew/opt/fzf
set shell=/bin/bash
set whichwrap+=<,>,[,]

let g:ctrlp_max_files=0
let g:ctrlp_max_depth=100
let g:ctrlp_working_path_mode = 'ra'
let g:mapleader = "\<Space>"
let NERDTreeShowHidden=1

call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'editorconfig/editorconfig-vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'Vimjas/vim-python-pep8-indent'
Plug 'yuezk/vim-js'
call plug#end()

filetype plugin indent on

nnoremap <silent> <leader><space> :Files<CR>
" Don't overwrite register with selected text when pasting
" See also:
xnoremap <expr> p 'pgv"'.v:register.'y`>'

" Auto-reload buffer on file change
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() !~ '\v(c|r.?|!|t)' && getcmdwintype() == '' | checktime | endif
autocmd FileChangedShellPost * echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None

Git configuration

Here’s my .gitconfig. Noteably, it doesn’t provide an alias for git checkout as I prefer its newer “replacements” git restore and git switch.

a = add
aa = add .
b = branch
c = commit -m
ca = commit --amend
can = commit --amend --no-edit
d = diff
ds = diff --staged
f = fetch
find = "!git log --color -p -S "
g = log --pretty=oneline --abbrev-commit --graph
gg = log --graph
l = log --pretty=oneline --abbrev-commit
ll = log
p = push
pf = push --force
pl = pull
r = restore
rb = rebase
rba = rebase --abort
rbc = rebase --continue
s = status --short
sh = show
shno = show --name-only
sw = switch
swc = switch -c

rebase = false

Some aliases I need so frequently that I make them available as single or two letter shell aliases via .bashrc:

alias a='git a'
alias b='git b'
alias c='git c'
alias d='git d'
alias g='git'
alias p='git p'
alias ll='ls -al'
alias s='git s'
alias sw='git sw'
alias swb='git switch $(git branch | grep -v \* | fzf)'

Hardware settings


As an avid user of Vim, the Escape key is essential to escape edit mode. As the Caps Lock lock key is useless to me but actually easy to reach, I make it function as the Escape key. My System76 Lemur Pro laptop has placed its Page Down/Up keys rather poorly, cramped together with Left and Right keys. Luckily this laptop comes with a programmable firmware which allowed me to remamp these and some other keys; my remapping is available in this file.

If you don’t own a System76 computer with programmable firmware, you can also swap the Caps Lock for Escape using this shell command:

gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"

Bluetooth and Wi-Fi

To restore the previous power state of Bluetooth and Wi-Fi on restarts, apply the follow setting. Requires tlp to be installed (see above)

sudo sed -i 's/#\(RESTORE_DEVICE_STATE_ON_STARTUP\)=0/\1=1/' /etc/tlp.conf

CPU performance

In circumstances that require a extra long battery autonomy, I want to the processor to consume as little energy as possible. Therefor I’ve added a function called cpuper to ~/.bashrc which allows setting lower and upper boundaries for the CPU performance as well as enabling/disabling good old turbo mode.

To change the display brightness even below the minimum value, call the following function followed by a brightness value. It defaults to 300 which is pretty low on my system but still readable.

cpuperf() {
  local cpu_vars="min_perf_pct max_perf_pct no_turbo"
  if [ -z "$1" ]; then
    for var in ${cpu_vars}; do
      echo ${var}=$(cat /sys/devices/system/cpu/intel_pstate/${var})
    return 0
  local min_perf_pct
  local max_perf_pct
  local no_turbo
  case "$1" in
    echo "Invalid value. Possible values are: lowest, low, high"
    return 1
  echo "Applying the following CPU performance settings:"
  for var in ${cpu_vars}; do
    echo $var=${!var}
    echo ${!var} | sudo tee /sys/devices/system/cpu/intel_pstate/${var} > /dev/null


In addition to save on CPU energy consumption, I want to manually control the screen brightness and be able to set it to the lowest value possible - a brightness level that is not available via the systems brightness sliders/hot keys.

brightness() {
  local f="/sys/class/backlight/intel_backlight/brightness"
  if [ -z "$1" ]; then
    cat $f
    local value=$(($1 < 1 ? 1 : $1))
    sudo su -c "echo $value > $f"
comments powered by Disqus