A how-to install guide for Linux programs

This is a list of GNU and open source programs I use regularly. I have included some install commands and configuration details that I hope will make them easier to use.

A how-to install guide for Linux programs
Page content

Emacs

Emacs is the best text editor you will ever learn to use. Like all good things, it takes some time to learn to use properly.

But, is it good enough to spend the time to learn to use it properly?

Yes, it is.

Installing emacs

Debian

     sudo apt install emacs post-el org-mode markdown-mode hunspell hunspell-en_CA hunspell-en_US

Arch

    sudo pacman -S emacs hunspell hunspell-en_CA hunspell-en_US

Emacs Configuration

Emacs configuration lives in a plain text file: .emacs

There are many .emacs files you can use, but you can start with mine in my github templates dotfiles folder. You can open the .emacs file in Emacs and have a read through. Do not get too worried about what the code says, but the comments (lines starting with ";") will tell you what the parts do.

There are several things that you need to configure to have it working, but the following lines in your .emacs file will change the default behaviour.

Lose the startup screen and bracket matching:

(inhibit-startup-screen t)
(show-paren-mode t)

To set-up spellcheck with Canadian English and load the flyspell spell checker:

(setq ispell-program-name (executable-find "hunspell")
      ispell-dictionary "en_CA")
;;LOAD FLYSPELL FOR EVERYTHING WRITING

(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)

(dolist (hook '(text-mode-hook))
      (add-hook hook (lambda () (flyspell-mode 1))))

(dolist (hook '(org-mode-hook))
      (add-hook hook (lambda () (flyspell-mode 1))))

(dolist (hook '(latex-mode-hook))
      (add-hook hook (lambda () (flyspell-mode 1))))

(dolist (hook '(markdown-mode-hook))
      (add-hook hook (lambda () (flyspell-mode 1)))

Turn on Word Wrap

(global-visual-line-mode t)

Unfill commands are useful when dealing with text that has line breaks in weird places. This code copied from places on the internet so long ago I cannot properly cite them.

M-x unfill-region and M-x unfill-paragraph are extremely useful when editing something someone else sent you that has weird line breaks.

;;UNFILL DAMNIT!
(defun unfill-region (begin end)
  "Remove all linebreaks in a region but leave paragraphs, 
  indented text (quotes,code) and lines starting with an asterix (lists) intakt."
  (interactive "r")
  (replace-regexp "\\([^\n]\\)\n\\([^ *\n]\\)" "\\1 \\2" nil begin end))

;;MORE UNFILL
;Stefan Monnier <foo at acm.org>. It is the opposite of 
;fill-paragraph. Takes a multi-line paragraph and makes 
;it into a single line of text.
(defun unfill-paragraph ()
  (interactive)
  (let ((fill-column (point-max)))
    (fill-paragraph nil)))

Org-mode

Org-mode is one of the reasons so many people go through the process of learning Emacs in the first place. It is an extremely powerful organizational tool with some added benefits for normal users too.

However, the best part of org-mode is to use it as your default writing mode and use the powerful list and header editing features to make any writing easier. Write in org-mode and use the export features to export to html, document, and PDF formats.

Make Org-mode the default mode:

;;SET MAJOR MODE TO ORG
;; This sets Org-Mode as your main mode and sets Org cammands
(setq default-major-mode 'org-mode)
(global-set-key "\C-cl" 'org-store-link)
     (global-set-key "\C-ca" 'org-agenda)
     (global-set-key "\C-cc" 'org-capture)
     (global-set-key "\C-cb" 'org-iswitchb)

Other things that are extremely useful in Emacs for people who just love to write and be efficient users

M-x package-install <enter>
writeroom-mode
  • M-c (capitalize the first letter of the next word); M-l (make the next word all lower-case) make correcting strange capitalization errors easier. M-u is also useful (capitalize the entire next word) especially if you have remapped the Capslock key.
  • Learn to use macros. They are fun and unbelievably useful.

GPG and Encryption/Signing Keys

There are many programs that use encryption and key signing in Linux systems. GnuPG is an open source version of Pretty Good Privacy (PGP). It allows you to encrypt files and digitally sign those files if you send them to someone else.

It is also the basis of the Password Store (or 'pass') password manager described below.

Installing Gnupg

Debian

sudo apt install gnupg2
gpg --full-generate-key
gpg --list-secret-keys --keyid-format LONG

Arch

sudo pacman -S gnupg2
gpg --full-generate-key
gpg --list-secret-keys --keyid-format LONG

Make it easy on yourself and install Keys.pub to manage your keys:

git ssh

Git version control system. Might as well install secure shell since you will use it with git all the time.

Installing git and ssh

Debian

sudo apt install git ssh

Arch

sudo pacman -S git ssh

Using git and Magit

Git takes some time to figure out how to use properly, but the commands a basic user needs are:

git init
git clone <git repository>
git pull
git add .
git commit -a -m "Messge about what you changed"
git push

Magit, the git program in Emacs, is the key to using git effectively.

In emacs,

M-x package-install <enter>
magit <enter>

Add the following into .emacs file:

;; Magit Key Binding
(global-set-key (kbd "C-x g") 'magit-status)

In an initialized git repository the following commands will allow you to push changes:

C-x g
press 's' to stage the chages
press 'c' then 'c' again to commit the changes
edit the file that opens by adding your commit message to the top of the file and remove the '#' infront of the files you want to commit changes to.
C-c C-c
press 'P' (captial 'p') to push your change to the git repository.

For using Magit to use password less push and pull from repositories you have passowordless access to using a key file:

Create ssh key file:

ssh-keygen <enter>

Copy output from cat .ssh/repofile_rsa.pub to git server (usually under the settings in github.com, gitlab.com, gogs, gitea).

Launch ssh-agent and add the key file:

eval `ssh-agent`
ssh-add .ssh/repokeyfil_rsa

Make ssh-agent launches, add the following to your .bashrc file

## ssh-agent command 

if ! pgrep -u "$USER" ssh-agent > /dev/null; then
    ssh-agent > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! "$SSH_AUTH_SOCK" ]]; then
    eval "$(<"$XDG_RUNTIME_DIR/ssh-agent.env")"
fi

Install keychain-environment and ssh-agency so Magit knows where to look for your active ssh keys

M-x package-install <enter>
ssh-agency <enter>
M-x package-install <enter>
keychain-environment <enter>

Magit should do passwordless git clone, push, pull after you do ssh-add .ssh/keyfile_rsa in a bash terminal.

Password Store

Pass is the password manager that uses gpg. I see no reason to use anything else.

Installing pass

Debian

sudo apt install pass xclip

Arch

sudo pacman -S pass xclip

Bash completion makes it easier to find what you are looking for in pass, so add this to your .bashrc file:

complete -o filenames -F _pass pass

On a server you have ssh access to, you can make your pass file a git repository and sync it across devices with the following commands. See pass manual pages for full command list.

pass git init
pass git remote add origin kexec.com:pass-store
pass git pull
pass git push

On a different computer you can clone the password store git files and then push and pull to the remote server any local or remote changes.

mosh

Mosh is basically persistent ssh sessions. If you are on a spotty or slow internet connection, or you move from one device to another and want access to that ssh session, use mosh. It will save you some headaches. If you use mosh with tmux it works amazing.

If you have language/UTF8 encoding trouble or your ssh server needs a different port from 22, this might help you:

LC_ALL="en_US.UTF-8" sh --ssh "ssh -p PORT" user@server

This uses US UTF-8 and sets the port number, change as needed.

Linux Libertine Fonts

Use this professional looking font in your programs and make your linux environment look great.

Installing LinuxLibertine

Debian

sudo apt install fonts-linuxlibertine

Arch

sudo pacman -S ttf-linux-libertine

Latex PDF creation

Install texlive to generate PDFs using pandoc or Emacs org-mode PDF export:

Installing Latex

Debian

sudo apt install texlive-full

Arch

sudo pacman -S texlive-bin texlive-core texlive-fontsextra texlive-formatsextra texlive-pstricks

For your org-mode header to make your PDFs look nice, try:

#+LATEX_CLASS_OPTIONS: [twoside]
#+LATEX_HEADER: \usepackage[margin=1in,bottom=1in,top=1in]{geometry} 
#+LATEX_HEADER: \setlength{\headheight}{14pt}

#+LATEX_HEADER: \usepackage{xcolor} \definecolor{MSBlue}{rgb}{.204,.353,.541} \definecolor{MSLightBlue}{rgb}{.31,.506,.741}


#+LATEX_HEADER: \usepackage{titlesec}

#+LATEX_HEADER: \newcommand*{\justifyheading}{\raggedright}
#+LATEX_HEADER: \titleformat*{\section}{\huge\bfseries\justifyheading\sffamily\color{MSBlue}}
#+LATEX_HEADER: \titleformat*{\subsection}{\Large\bfseries\justifyheading\sffamily\color{MSBlue}}


#+LaTeX_HEADER: \usepackage[T1]{fontenc}
#+LaTeX_HEADER: \usepackage{mathpazo} 
#+LaTeX_HEADER: \usepackage{pdfpages}
#+LaTeX_HEADER: \linespread{1.15}
#+LATEX_HEADER: \usepackage{bookman}
#+LaTeX_HEADER: \usepackage[scaled]{helvet}
#+LaTeX_HEADER: \usepackage{courier}

#+LATEX_HEADER: \renewcommand{\familydefault}{\rmdefault}
#+LATEX_HEADER: \usepackage[latin9]{inputenc}

#+LaTeX_HEADER: \usepackage{enumitem} \setlist[itemize]{noitemsep, nolistsep} \setlist[enumerate]{noitemsep, nolistsep}

#+LaTeX_HEADER: \usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype} \microtypecontext{spacing=nonfrench}

#+LaTeX_HEADER: \usepackage{color}
#+LATEX_HEADER: \usepackage{hyperref}
#+LATEX_HEADER: \hypersetup{colorlinks = true, linkcolor=MSBlue}

#+LATEX_HEADER: \usepackage{fancyhdr} \renewcommand{\headrulewidth}{0pt}
#+LATEX_HEADER: \pagestyle{fancy} 
#+LATEX_HEADER: \fancyhf{}

#+LATEX_HEADER: \fancyhead[LE]{{\fontsize{10}{12} {\sffamily \bfseries{\leftmark}}}\\\dotfill} \fancyhead[RO]{{\fontsize{10}{12} {\sffamily \bfseries{\rightmark}}}\\\dotfill} \fancyfoot[C] {{\fontsize{10}{12} {\sffamily \bfseries{\thepage}}}}

# #+LATEX_HEADER: \pagestyle{fancy} \pagestyle{fancyplain} \fancyhf{} \lhead{  {\sffamily \bfseries{\fancyplain{}{\nouppercase{\leftmark}} }} \rhead{ \fancyplain{}{\today} } \cfoot{ \fancyplain{}{\thepage} }

#+LATEX_HEADER: \newcommand*{\justifyheading}{\raggedright}



#+LATEX_HEADER: \usepackage{parskip}
#+LATEX_HEADER: \setlength{\parindent}{0in}

tmux

If you are using mosh to login to a server you manage all the time, you might as well install tmux. Tmux is a terminal multiplexer – which is a fancy way to say that it allows you to have multiple screens open in your terminal environment. You can "detatch" from the your session and then reattach later.

More about tmux here.

Installing tmux

Debian

sudo apt install tmux

Arch

sudo pacman -S tmux

Configure tmux

Use this configuration file to make tmux work well and look good and put it as ~/.tmux.conf:

https://github.com/gpakosz/.tmux

fzf

Search for files in the terminal the better way by using fzf. Emacs also has a fzf mode for finding files and competes with helm for "incremental" search for me.

Installing fzf

Debian

sudo apt install fzf

Arch

sudo pacman -S fzf

sed

Learning to use sed is not easy because regular expressions are not easy, but it is worth the time invested. Here is an example of a bash script that I use on a regular basis that uses sed and pandoc to create an email template for mailchimp. It isn't pretty, but it gets the job done.

pandoc

Pandoc is the document format converter that you have been missing.

You will also notice that my [#headline-32][.muttrc]] file examples use pandoc to convert plain text to HTML email when you want some additional formatting.

I am personally in favour of plain text email, but sometimes I am dealing with folks who live inside web-based email services like Gmail and Outlook. In these cases, I put longer briefing notes that are attached as PDFs in the body of the email and formatted with HTML. Pandoc makes this easy.

Installing pandoc

Debian

sudo apt install pandoc

Arch

sudo pacman -S pandoc

Using pandoc

Used most frequently as:

pandoc infile.org -f org -t docx -o outfile.docx
pandoc infile.md -o outfile.docx
pandoc infile.docx -t gfm -o outfile.md # gfm is github flavour of markdown

mupdf and zathura

Replace your heavy PDF reader with something that does what you want it to do most of the time: show you a PDF.

  • mupdf is a super lightweight PDF and ePUB viewer. It does nothing else but show you the PDF quickly.
  • Zathura is also a super lightweight PDF viewer, with a few more tricks.

Installing mupdf and zathura

Debian

sudo apt install mupdf zathura

Arch

sudo pacman -S mupdf zathura-pdf-poppler

Using mupdf and zathura

  • mupdf is just a viewer. Set it as a default viewer for large PDFs you want to view quickly. The '+' and '-' signs zoom.
  • Zathura has several features for viewing, copying from the PDF, resizing (+,-,a,s), search ('/'), dual page view (d), rotating (r), moving up and down incrementally (k,j), and going into presentation mode (F5). It is a perfect viewer for part of your LaTeX work process and presentations.

termite, sakura, uxterm

Three terminal emulators that are the best.

  • Termite for Arch
  • Sakura for Debian
  • uxterm for whatever quick thing you need.

Installing

Debian

sudo apt install sakura xterm

Arch

sudo pacman -S termite xterm

Using the terminal

  • Sakura can be configured by left left-clicking on the window and changing the settings. The last settings used are saved.
  • Termite is set-up through editing the configuration file ~/.config/termite/config

For ssh to work properly, makes sure that you include this in the termite config file:

export TERM=xterm-color

uxterm (and xterm) use .Xresources as their config file.

!xterm config -----------

XTerm*renderFont: true
Xterm*saveLines: 4096

!URxvt*font: -*-helvetica-medium-r-normal-*-*-*-*-*-*-*-*-*

XTerm*faceName: Inconsolata
XTerm*boldFont: Inconsolata

XTerm.vt100.geometry: 80x32
XTerm.termName: xterm-256color

XTerm*faceSize: 20

UXTerm*faceName: Inconsolata
UXTerm*boldFont: Inconsolata

UXTerm.vt100.geometry: 80x32
UXTerm.termName: xterm-256color
UXTerm*faceSize: 20

! double-click to select whole URLs :D
xterm*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48


*VT100*translations: #override Shift <Btn1Up>: exec-formatted("firefox '%t'", PRIMARY)

xterm*boldMode: true
xterm*loginShell: true
XTerm.VT100.geometry: 80x24
xterm*saveLines: 2000
xterm*termName: xterm-color
xterm*eightBitInput: false
xterm*foreground: rgb:a8/a8/a8
xterm*background: rgb:00/00/00
xterm*color0: rgb:00/00/00
xterm*color1: rgb:a8/00/00
xterm*color2: rgb:00/a8/00
xterm*color3: rgb:a8/54/00
xterm*color4: rgb:00/00/a8
xterm*color5: rgb:a8/00/a8
xterm*color6: rgb:00/a8/a8
xterm*color7: rgb:a8/a8/a8
xterm*color8: rgb:54/54/54
xterm*color9: rgb:fc/54/54
xterm*color10: rgb:54/fc/54
xterm*color11: rgb:fc/fc/54
xterm*color12: rgb:54/54/fc
xterm*color13: rgb:fc/54/fc
xterm*color14: rgb:54/fc/fc
xterm*color15: rgb:fc/fc/fc
XTerm*VT100.translations: #override <Btn1Up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)
XTerm*on3Clicks: regex [[:alpha:]]+://([[:alnum:]!#+,./=?@_~-]|(%[[:xdigit:]][[:xdigit:]]))+
XTerm*metaSendsEscape: true

Firefox

Use the browser that cares about you and the internet, use Firefox.

Then install the following addons:

  • privacy badger
  • decentraleyes
  • https everywhere
  • ublock origin

mutt

The least worst email program.

Works best with:

  • w3m as the html email viewer
  • elinks as the alternative email viewer
  • mu and abook for searching mail and address books
  • isync (mbsync) for email fetching
  • antiword, pdftotext, docxtotext for seeing your email attachments as plain text files in your terminal
  • urlscan for launching a browser if there are any links in your emails

Installing mutt

Debian

Arch

Install mutt-ics

pipx install mutt_ics

Using mutt

Setting-up mutt can be done many ways.

Once you have your .muttrc set-up, try the following additions/changes. The '#' indicate comments

# see plain text first, but also see plaing text of the html emails

alternative_order text/plain text/enriched text/html
auto_view text/html

# use ics viewer for calendars

auto_view text/calendar application/ics


# Use '<esc> o' to covert an org-mode coded email into html to send
 
macro compose \eo "F pandoc -f org -t html \ny^T^Utext/html; charset=us-ascii\n"

# Use '<esc> m' to convert an email written in markdown into an html email to send

macro compose \em "F pandoc -f markdown -t html \ny^T^Utext/html; charset=us-ascii\n"
set wait_key=no

# Use urlscan to view urls in your email and launch firefox 

macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"
macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"

And the following .mailcap file:

text/html; w3m -I %{charset} -T text/html; copiousoutput;
application/vnd.openxmlformats-officedocument.wordprocessingml.document; cat %s|/usr/bin/docx2txt; copiousoutput
application/msword ; antiword %s ; copiousoutput
text/plain; emacsclient %s ; copiousoutput
text/calendar; /home/m6s78/.local/bin/mutt-ics; copiousoutput
application/ics; /home/m6s78/.local/bin/mutt-ics; copiousoutput 
text/pdf; pdftotext %s -; copiousoutput; needsterminal; description="Adobe PDF Doc"
application/pdf; pdftotext %s -; copiousoutput; needsterminal; description="Adobe PDF Doc"

gnumeric

LibreOffice is of course a default install and comes with Calc, but gnumeric has some amazing functionality and is my default program for spreadsheet manipulation of data for statistics.

The only thing missing from gnumeric that would be nice to have is the ability to create pivot tables. However, tad has you covered there.

Tad

Tad is a pivot table program. The first time you use it you will wonder why you ever did pivot tables in Excel or LibreOffice.

Installing tad

Debian

wget https://github.com/antonycourtney/tad/releases/download/v0.9.0/tad_0.9.0_amd64.deb
sudo dpkg -i tad_0.9.0_amd64.deb

Arch

git clone https://aur.archlinux.org/tad-bin.git
cd tad-bin
makepkg -si

Abiword

LibreOffice is of course a default install, but if opening a Word document without the needed additional overhead and bloat I use Abiword.

dict

Command line dictionary lookup:

Debian

sudo apt install dict dictd dictionaries-common dict-jargon

Arch

sudo pacman -S dictd

In the command line, just type

dict word

Sqlitebrowser

Forget using spreadsheets for anything that requires editing or manipulating data that has more than a few columns and rows.

SQLiteBrowser is an extremely powerful SQL environment using SQLite database format. SQLite allows you to run a full SQL database on a single file – and without running a big database server like MySQL, MariaDB, or Postgresql. This is perfect for quick edits to large datasets before importing them into R, a spreadsheet, or up-loading them to a hosted database server.

Installing Sqlitebrowser

Debian

sudo apt install sqlitebrowser # note that this may be an old version.

Ubuntu

sudo add-apt-repository -y ppa:linuxgndu/sqlitebrowser
sudo apt-get update
sudo apt-get install sqlitebrowser

Arch

sudo pacman -S sqlitebrowser

pavucontrol

If you are using Pulseaudio and you cannot figure out how to change volume, then Pavucontrol is your friend.

pcmanfm

An under-appreciated file manager that works very well and is quite light on resources.

Thunar

Your other file manager.

nm-applet

If you are using Network Manager to manage your network settings, make sure you nm-applet to make managing those network connections easy.

blueman

Bluetooth is a pain. Blueman makes it easier.

  • blueman-tray for your launch bar icon
  • blueman-manager to managing your bluetooth

arandr

Managing multiple monitors can be a pain on any operating system. arandr is a front end to randr and while it is very ugly it makes things super easy.

GNU/Linux Desktop Environments

Debian/Ubuntu

Little configuration is needed with Ubuntu as it works on most computers out of the box.

Installing i3wm and using that as your default window manager will make things better for you.

sudo apt install i3 i3blocks i3lock i3status

Manjaro

There are many flavours of Manjaro, but the i3 window manager install is my favourite. But, I can deal with an Xfce4 install with an i3 interface. They all work extremely well if you want an Arch-style flavour for a laptop and you don't want to spend hours getting it up and running.

Arch

Arch linux is the best. Good luck with the install process, it takes some time and you have to follow the steps, but when it is done you have a very streamlined system.

The Arch Wiki is the best how-to place for Arch (and other linux distributions) on the internet. It will provide all the steps necessary to install Arch on pretty much anything.