Linux

Linux is a family of open source operating systems stemming from Unix. Common Linux distributions include: Debian, Ubuntu, and Fedora. Personally, my Linux distribution of choice is Arch Linux.

Command Line Interface

All Linux distributions have a command line interface (CLI) usually running bash. It is a way to quickly and efficiently perform tasks on the computer using available commands. The CLI is particularly suited for automation of repetitive or delayed tasks, and provides very simple inter-process communication.

I usually do 90% of my work on the command line because I have found it to be faster and easier to perform tasks (especially if it is repetitive). My shell emulator of choice is zsh for its many plugins.

File System

In Linux, everything is a file. This means that all connected hardware is represented as a file. Files are files. Directories are files. Sockets are files. Everything. This concept means the same tools can be applied when manipulating or interacting with devices.

PathDescription
/Root of the filesystem
/rootRoot user’s home directory
/homeNormal users’ home directories
/binEssential user binaries
/bootStatic boot files
/devDevice files (like hard drives)
/etcConfiguration files
/libEssential shared libraries
/optOptional packages
/procKernel and process files
/sbinSystem administration binaries
/tmpTemporary files
/usrUser binaries (and read only data)
/varVariable data files (like log files)

Kernel and User Space

System memory is divided into two distinct spaces: kernel space and user space. Kernel space is the protected memory space that runs the operating system. It has full access to the hardware, contains kernel code, and most of the memory is directly mapped to physical memory.

User space is where the normal application runs. It has limited access to resources and contains process code, data, and memory mapped files. User programs can request resources through system calls to the kernel.

Cron

Cron is a time based job scheduler. Each line in a cron table file represents a job. Here is a template describing each entry in the table.

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │                                   7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * command to execute

Anacron

Anacron is similar to cron, except it does not expect the system to always be continuously running. In other words, anacron will reschedule jobs if the system is off at the time the job was supposed to run, unlike cron which will skip the job entirely.

Tools

Working in Linux and the CLI, you will invariably learn many tools for system administration and development. Below is a list of common commands in no particular order.

ToolDescription
lsList files
cdChange directory
mvRename files
cpCopy files
touchChange file timestamps
mkdirMake directories
rmUnlink files
sedStream editor
awkPattern scanning and processing language
curlTransfer a URL
makeMaintain a group of programs
findWalk a file hierarchy
manDisplay manual pages
grepFile pattern searcher
watchExecute a program periodically with output
tmuxTerminal multiplexer
wcWord, line, and character counter
lessless is more
tarArchiving utility
gzipCompression tool
dateDisplay or set date and time
sshOpenSSH client
scpCopy files via SSH
ftpFile transfer protocol client
rsyncRemote and local file copying tool
ncatConcatenate and redirect sockets
lsblkList block devices
lsusbList USB devices
lspciList all PCI devices
dfReport file system disk space usage
duEstimate file space usage
cutRemove sections from each line of files
pasteMerge lines of files
diffCompare files line by line
commCompare two sorted files line by line
seqPrint a sequence of numbers
yesOutput a string repeatedly until killed
crontabMaintain crontab files for individual users
useraddCreate a new user
groupaddCreate a new group
usermodModify a user account
groupmodModify a group definition
cfdiskDisplay or manipulate a disk partition table
mkfsBuild a Linux filesystem
mktempCreate a temporary file or directory
mountMount a filesystem
umountUnmount a filesystem
pianobarCLI Pandora client