Fun with Linux: Starting out

This blogpost is going to be much more technically oriented than any I’ve ever published before. It’s aimed at a geekier audience than what I normally cater to, so please do not bash me for it. It discusses filesystems and zsh. The next post in this series will talk about configuring a graphical environment.

Before going further into this blogpost, you should understand that none of what I write here is gospel, you’re free to reinterpret it as and when you please. Also, most of what I’ve written is the work of people better and far more experienced than I. All I’ve done is tweak their methods a bit for my own satisfaction. Their names are far too many for me to recount, and I honestly don’t know them all.

Distro of choice

Arch Linux

Why Arch? Well, there are many, many reasons. But the ones most important are:

  • It’s highly customizable
  • Pacman and the AUR
  • It doesn’t assume anything about the user
  • I’m very comfortable with it

Arch Linux follows the KISS philosophy. This allows one to see the internals of the OS and tinker around as one pleases. You can customize Arch to be anything. It can become a remote-controlled seedbox, a production server, a heavy-duty workstation or any thing else you can dream of.

Arch Linux is also noted for being one of the first distros to support new technologies as and when they come out (viz. python3, systemd etc.). This allows Archers to be ahead of the curve when it comes to adoption of new technologies (At times very far ahead. Elementary OS still ships with Linux 3.2.0 as default while Arch is on 3.11.1).

The Arch community is also a very active group of guys. They’ve created one of the most feature-filled and complete wikis available in Linux-land, they’re very active on the IRC and the devs are very approachable. The reason I mention this is because I’ve run into my fair share of problems on Arch, and I’ve found everything I need within the community itself.


Okay, the beginners’ guide pretty much walks you through the installation. There isn’t anything much you’d want to configure in your installation except your partition layout and the packages you wish to install.

I formatted my whole disk and used all of it for Linux. Why? Just. I don’t particularly have any Windows-specific work. My partition layout is as follows:

$ lsblk

sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   256M  0 part /boot
├─sda2   8:2    0     4G  0 part [SWAP]
├─sda3   8:3    0    28G  0 part /
├─sda4   8:4    0     8G  0 part /var
├─sda5   8:5    0 421.5G  0 part /home
├─sda6   8:6    0  1007K  0 part 
└─sda7   8:7    0     4G  0 part /var/cache/pacman/pkg
sr0     11:0    1  1024M  0 rom

I’ve made separate directories for home, boot and var and my package cache in addition to a GPT partition, root and a Swap partition. This is because I formatted all these using different filesystems.

  1. /dev/sda1 – ext2: Ext2 is generally considered a good choice for boot since it’s fast and stable. It however, does not have journalling support. That shouldn’t be much of a problem, of course, seeing that you’re not going to be writing much to /boot anyway.
  2. /dev/sda2 – SWAP: I made this partition a swap partition simply in case I wish to compile anything major. Swap partitions are recommended over swap files for a few reasons.
  3. /dev/sda3 – ext4: The root partition was formatted with ext4 because btrfs does not have an fsck utility. Until btrfs gets a reliable fsck program with the same capabilities as any other mature fsck program, I don’t wish to use it for my root. Till then, ext4 is the best general purpose file system you can get.
  4. /dev/sda4 – reiserfs: ReiserFS is considered very good for small files. /var is supposed to contain many small files, hence I decided to format it with ReiserFS. I’m considering shifting to Reiser4, however, I’ll have to patch my kernel for it. I’m also not sure just how good Reiser4 is compared to ReiserFS.
  5. /dev/sda5 – btrfs: Most people would consider their data to be more important than the system they’re storing it on. I do too. I’ve already cited the lack of a reliable and fully-featured fsck program as the barrier to my usage of btrfs. However, that’s not to say that btrfs does not have any error-tolerance built-in. It does. The “recovery” mount option does allow you to recover your data in case of any problems. The reason I have no problems with formatting my /home as btrfs is that I can always unmount it, re-mount it with the recovery option and then get all my lost data back. That’s not particularly easy with the root partition.
  6. /dev/sda6 – BIOS boot partition: This 1007K partition is required by BIOS systems using GPT. Don’t let the partition number fool you. It’s located at the beginning of the disk.
  7. /dev/sda7 – jfs: The /var/cache/pacman/pkg mount point is not normally seen in most Linux systems, or for that matter even most Arch systems. The reasons I keep it separate is to preserve my package cache in the laziest way possible in case I have to reinstall and to improve pacman performance. Jfs is another general purpose file system developed by IBM. It’s supposedly very fast and extremely light on resources. It also has a few issues with fragmentation Ext4 does not seem to suffer from. I used this because I wanted a lighter filesystem for my pacman cache. I would have used XFS (it’s good for larger files), but apparently it’s not very good for home systems.

I got all my filesystem information from here and here. For those who ask why I used GPT, it’s because it’s next-gen. The MBR is old. Even Windows is shifting away from it.

When using pacstrap, I’d recommend pulling in vim, elinks, networkmanager (or connman) and zsh as well. While nano is a perfectly serviceable editor, I’ve always preferred vim. Sure, the learning curve is steeper, but it’s vim. Along with emacs, it’s probably the oldest editor out there people still use (I’m leaving out sed for very obvious reasons). If you have no experience with it, I’d recommend running vimtutor on the command line to learn the basics.

I recommend zsh over bash for those new to the command line. While it is very important to learn bash (do learn it, btw), zsh is simply more convenient and easier to use for day-to-day usage. My .zshrc looks like this now:

# Lines configured by zsh-newuser-install
setopt appendhistory autocd extendedglob nomatch notify
unsetopt beep
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/vader/.zshrc'

autoload -Uz compinit
# End of lines added by compinstall

# Prompt
autoload -U promptinit colors
promptinit && colors

PROMPT="[%{$fg[green]%}%n %{$fg[cyan]%}%~%{$reset_color%}]%# "
RPROMPT="[Last Exit: %?]"

# Command not found hook
source /usr/share/doc/pkgfile/command-not-found.zsh

# Autocompletion options
setopt completealiases
zstyle ':completion:*' menu select
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*'   force-list always

# Ignore duplicate history lines

# Keys and stuff

typeset -A key



# setup key accordingly
[[ -n "${key[Home]}"     ]]  && bindkey  "${key[Home]}"     beginning-of-line
[[ -n "${key[End]}"      ]]  && bindkey  "${key[End]}"      end-of-line
[[ -n "${key[Insert]}"   ]]  && bindkey  "${key[Insert]}"   overwrite-mode
[[ -n "${key[Delete]}"   ]]  && bindkey  "${key[Delete]}"   delete-char
[[ -n "${key[Up]}"       ]]  && bindkey  "${key[Up]}"       up-line-or-history
[[ -n "${key[Down]}"     ]]  && bindkey  "${key[Down]}"     down-line-or-history
[[ -n "${key[Left]}"     ]]  && bindkey  "${key[Left]}"     backward-char
[[ -n "${key[Right]}"    ]]  && bindkey  "${key[Right]}"    forward-char
[[ -n "${key[PageUp]}"   ]]  && bindkey  "${key[PageUp]}"   beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]]  && bindkey  "${key[PageDown]}" end-of-buffer-or-history
# # Finally, make sure the terminal is in application mode, when zle is
# # active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
	function zle-line-init () {
		printf '%s' "${terminfo[smkx]}"
	function zle-line-finish () {
		printf '%s' "${terminfo[rmkx]}"
	zle -N zle-line-init
	zle -N zle-line-finish

# Aliases which look good
alias ls='ls --color=auto'
eval $(dircolors -b)		# Not an alias, but helps with less
alias grep='grep --color=auto'
alias blah='echo'
alias sudo='sudo '

# Time-saving random aliases

alias cower='cower --color=auto --target=/home/vader/Builds --verbose'
alias youtube-official='youtube-dl --continue --username [snipped] --password [snipped] --max-quality mp4 --output "/home/vader/Youtube Downloads/%(title)s.%(ext)s"'
alias youtube-playlist='youtube-dl --continue --username [snipped] --password [snipped] --max-quality mp4 --output "/home/vader/Youtube Downloads/%(playlist)s/%(autonumber)s-%(title)s.%(ext)s"'
alias amv='youtube-dl --continue --username [snipped] --password [snipped] --max-quality mp4 --output "/home/vader/Youtube Downloads/AMVs/%(title)s.%(ext)s"'
alias theatre-arts='youtube-dl --continue --username [snipped] --password [snipped] --max-quality mp4 --output "/home/vader/Youtube Downloads/Theatre Arts/%(title)s.%(ext)s"'
alias dcpp='tmux attach-session -t dcpp'

# Colored less
export LESS=-R
export LESS_TERMCAP_me=$(printf '\e[0m')
export LESS_TERMCAP_se=$(printf '\e[0m')
export LESS_TERMCAP_ue=$(printf '\e[0m')
export LESS_TERMCAP_mb=$(printf '\e[1;32m')
export LESS_TERMCAP_md=$(printf '\e[1;34m')
export LESS_TERMCAP_us=$(printf '\e[1;32m')
export LESS_TERMCAP_so=$(printf '\e[1;44;1m')

# Coloured man pages
man() {
    env LESS_TERMCAP_mb=$(printf "\e[1;31m") \
	LESS_TERMCAP_md=$(printf "\e[1;31m") \
	LESS_TERMCAP_me=$(printf "\e[0m") \
	LESS_TERMCAP_se=$(printf "\e[0m") \
	LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
	LESS_TERMCAP_ue=$(printf "\e[0m") \
	LESS_TERMCAP_us=$(printf "\e[1;32m") \
	man "$@"

A large portion of my .zshrc is youtube-dl aliases (I download lots of AMVs). Most of my .zshrc is not original, I’ve copied it from various sources, primarily the Arch Wiki. Do learn to utilize the power of the shell, for that is the true meaning of Linux mastery.

In the next part of this series, I’ll talk about configuring a DE to look something like this:

My current Arch Linux desktop
My current Arch Linux desktop

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s