Personal Guide to Linux

Here I’ll be listing all sorts of tweaks I might use again when I’ll setup a new computer. I should have done this a long time ago, but better late than never! The following is written for my own use first and foremost, but most of the contents can prove useful for Linux users, especially with Arch Linux variants, since I use Manjaro Linux.

Why Manjaro?

Manjaro Linux is a rolling-release Linux distribution, which allows a one-time installation with continuous upgrades. I find it very convenient since I can keep my software updated while never having Windows-like updates which incapacitate my computer for an unknown amount of time.

Contrary to Arch Linux, Manjaro comes with an installer and is way more user-friendly.

What’s more, Manjaro uses pacman, the Arch package manager which is easy to use, and has access to the Arch User Repository, a community-driven repository for Arch users. This alone is a very strong argument for using Manjaro Linux.

Finally, after testing quite a lot of Linux distributions, I have been satisfied with Manjaro as it is a good compomise: it gives the user full control over the system but also works out of the box.

2020/05/28: I’ve recently tinkered with WSL2 and I must say it does everything I need, so perhaps I won’t ever trouble myself anymore with dual-booting Linux. It’s so good that I’m considering removing the Manjaro partition I have on my laptop to keep only Windows.

2020/07/27: Well now it’s done, I’m completely on Windows with an ArchWSL instance.

Arch WSL basic setup

This section deals with my Arch WSL instances which require a bit more setup than a fresh Manjaro install. Of course, check the wiki if needed.

Root password setup

passwd

Wheel group setup

pacman-key --init
pacman-key --populate
pacman -Syu
pacman -S vi
visudo

And uncomment the line

%wheel ALL=(ALL) ALL

Default user setup

useradd -m -G wheel -s /bin/bash lashoun
passwd lashoun
exit

Then run in Powershell

Arch.exe config --default-user lashoun

Priority stuff

SSH setup

First, let’s setup a new SSH key. Don’t forget to change the dummy email address.

sudo pacman -S openssh
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "john@example.com"

Then I’ll be able to add it to GitHub and my VPS among others.

I will want to import my “dotfiles”, i.e. my configuration files. I use yadm so I’ll have to install it.

Installing yay

yay is an AUR helper written in Go. I basically use it as a replacement for pacman, the great thing being that it defaults to pacman when I install a package from the official Manjaro repositories.

sudo pacman -S git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si # do not run with sudo

Installing zsh and zplug

zsh is a powerful shell and zplug is a plugin manager for zsh.

yay -S zsh
chsh -s $(which zsh) # if `which zsh` returns `/usr/sbin/zsh`, just `chsh -s /bin/zsh`

Check on zplug’s repository if the command below is still the recommended way of installing it before!

curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh

Installing yadm

yay -S yadm

Importing my dotfiles

yadm clone git@github.com:lashoun/yadm.git

Various packages

Below is a non–exhaustive list of packages I might want to install:

  • anki - A flashcard program which helps you remeber facts efficiently
  • authy - Two-Factor Authentication from your PC
  • bitwarden - A secure and free password manager for all of your devices
  • calibre - Ebook management application
  • caprine - Unofficial Facebook Messenger app
  • cheat-git - Cheat allows you to create and view interactive cheatsheets on the command-line
  • diff-so-fancy - Good-lookin’ diffs. Actually… nah… The best-lookin’ diffs.
  • emacs - The extensible, customizable, self-documenting real-time display editor
  • epson-inkjet-printer-escpr2 - Epson Inkjet Printer Driver 2 (ESC/P-R) for Linux
  • exa - ls replacement
  • fasd - Command-line productivity booster, offers quick access to files and directories
  • feh - Fast and light imlib2-based image viewer
  • fzf - Command-line fuzzy finder
  • firefox - Standalone web browser from mozilla.org
  • gimp - GNU Image Manipulation Program
  • gvim - GUI for vim
  • hugo - Fast and Flexible Static Site Generator in Go
  • ibus, ibus-libpinyin, ibus-mozc - Next Generation Input Bus for Linux
  • imagescan - EPSON Image Scan v3 front-end for scanners and all-in-ones
  • joplin - A note taking and to-do application with synchronization capabilities
  • kitty - A modern, hackable, featureful, OpenGL-based terminal emulator
  • libreoffice-still - LibreOffice maintenance branch
  • mp3gain - Lossless mp3 normalizer with statistical analysis
  • neovim - Fork of Vim aiming to improve user experience, plugins, and GUIs
  • nodejs - Evented I/O for V8 javascript
  • npm - A package manager for javascript
  • otf-fira-code - Monospaced font with programming ligatures
  • p7zip - Command-line file archiver with high compression ratio
  • qpdfview - A tabbed PDF viewer using the poppler library
  • qtgain - Simply frontend for mp3gain, vorbisgain and metaflac to replay gain your tracks
  • qutebrowser - A keyboard-driven, vim-like browser based on PyQt5
  • ranger - A simple, vim-like file manager
  • redshift - Adjusts the color temperature of your screen according to your surroundings
  • ripgrep - A search tool that combines the usability of ag with the raw speed of grep
  • rofi - A window switcher, application launcher and dmenu replacement
  • seafile - An online file storage and collaboration tool
  • seafile-client - GUI client for synchronizing your local files with seafile server
  • spotify - A proprietary music streaming service
  • svp - SmoothVideo Project 4 (SVP4)
  • thunderbird - Standalone mail and news reader from mozilla.org
  • timeshift - A system restore utility for Linux
  • texlive - LaTeX distribution
  • tldr - Command line client for tldr, a collection of simplified and community-driven man pages
  • tllocalmgr-git - A shell and command-line utility to manage TeXLive on Arch Linux
  • tor-browser - Tor Browser Bundle: anonymous browsing using Firefox and Tor (international PKGBUILD)
  • transmission-cli, transmission-gtk - Fast, easy, and free BitTorrent client (CLI tools, daemon and web client)
  • trilium-bin - A hierarchical note taking application built on modern technologies
  • vim - Vi Improved, a highly configurable, improved version of the vi text editor
  • visual-studio-code-bin - Editor for building and debugging modern web and cloud applications
  • vlc - Multi-platform MPEG, VCD/DVD, and DivX player
  • wine - A compatibility layer for running Windows programs
  • xclip - Command line interface to the X11 clipboard
  • zathura, zathura-djvu, zathura-pdf-mupdf - Minimalistic document viewer with PDF, ePub and DjVu support

Configuration

The notes below should be included in my dotfiles, but I will keep them here since I might need them.

git config

Don’t forget to edit the dummy email address again.

git config --global user.name "lashoun"
git config --global user.email "john@example.com"

git-subrepo

This is git submodule, but better. Install it here.

Python distribution

First install python with yay. Install pip and pipx too while you’re at it.

yay -S python python-pip
python3 -m pip install --user pipx
python3 -m pipx ensurepath

Now let’s install a conda distribution to avoid polluting the global Python environment. Do NOT install anaconda package with yay. Install from source for the local user, it will spare you from unnecessary trouble with package management later on.

I tend to favor miniconda:

cd
yay -S wget
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86-64.sh

As soon as you install it, create a new default environment to keep the base environment as clean as possible:

conda update -n base -c defaults conda
conda create --name default_conda

Then, source that environment in your .bashrc or .zshrc. I might want to install these:

conda install flake8 pylint black

npm and pnpm

pnpm is a fast and disk space efficient package manager for Nodejs.

Install pnpm with npx:

truenpx pnpm add -g pnpm # in my dotfiles, the alias is already there

Then, you can use pnpm instead of npm. I defined aliases so I don’t have to think about it.

alias truenpm='/usr/bin/npm'
alias npm='pnpm'
alias truenpx='/usr/bin/npx'
alias npx='pnpx'

I might want to install those too:

npm add -g netlify-cli prettier

diff-so-fancy

A few config commands have to be typed. Be sure to check the repo.

git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"

git config --global color.ui true

git config --global color.diff-highlight.oldNormal    "red bold"
git config --global color.diff-highlight.oldHighlight "red bold 52"
git config --global color.diff-highlight.newNormal    "green bold"
git config --global color.diff-highlight.newHighlight "green bold 22"

git config --global color.diff.meta       "11"
git config --global color.diff.frag       "magenta bold"
git config --global color.diff.commit     "yellow bold"
git config --global color.diff.old        "red bold"
git config --global color.diff.new        "green bold"
git config --global color.diff.whitespace "red reverse"

diffconflicts

A few config commands have to be typed. Be sure to check the repo.

git config --global merge.tool diffconflicts
git config --global mergetool.diffconflicts.cmd 'vim -c DiffConflicts "$MERGED" "$BASE" "$LOCAL" "$REMOTE"'
git config --global mergetool.diffconflicts.trustExitCode true
git config --global mergetool.keepBackup false

ssh-ident

A really useful agent for automatic ssh identification. The repo is here.

mkdir -p ~/bin; wget -O ~/bin/ssh goo.gl/MoJuKB; chmod 0755 ~/bin/ssh

There shouldn’t be anything more to do since the correct export should be in my ~/.profile. However if it doesn’t work (like in WSL for instance), just add it to ~/.zshrc instead.

neovim

conda install pip
pip install pynvim

Then in neovim, type

:help nvim

and follow the instructions to source .vimrc.

My blog

cd ~/Documents
mkdir projects
cd projects
git clone git@github.com:lashoun/lashoun-website.git
cd lashoun-website
git submodule init
git submodule update
netlify init