Linux Command Reference

9 October 2025 · Updated 9 October 2025

commandslinuxbashshellreference

Shell commands I keep coming back to. Grouped by task, not alphabetically, so it’s usable when you’ve got a specific job in front of you.

SSH Key Management

Generate ED25519 SSH Key

ssh-keygen -t ed25519 -C "Comment"

Source: Adding SSH Keys to Linux Servers

Generate RSA SSH Key

ssh-keygen -t rsa -b 2048 -C "Comment"

Source: Adding SSH Keys to Linux Servers

Copy SSH Key to Remote Server

ssh-copy-id user@remote_host

Source: Adding SSH Keys to Linux Servers

Use when: Setting up passwordless SSH authentication

Manual SSH Key Installation

cat ~/.ssh/id_ed25519.pub | ssh user@remote-host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Source: Adding SSH Keys to Linux Servers

Use when: ssh-copy-id is not available


Package Management

Arch Linux (pacman/yay)

Install Packages

sudo pacman -S cups samba

Source: Configuring Printers on Arch Linux

Install MariaDB

sudo pacman -S mariadb

Source: MariaDB Installation

Install Tidal HiFi (AUR)

yay tidal-hifi

Source: Tidal HiFi Git on Linux

Install Development Tools

sudo pacman -S tmux prettier clang fzf

Source: Neovim Configuration

Install Music Tools

sudo pacman -S mpd ncmpcpp mpc

Source: MPD Config

Install ZSH

sudo pacman -S zsh

Source: Arch Linux Installation

Install Network Discovery

sudo pacman -S avahi nss-mdns

Source: Arch Linux Installation

Ubuntu/Debian (apt)

Install exFAT Support

sudo apt-get install exfat-fuse exfat-utils

Source: Mounting exFAT on Linux

Install Image Optimization Tools

sudo pacman -S jpegoptim optipng

Source: Compressing Images


System Service Management (systemd)

Enable and Start Services

CUPS Printing Service

sudo systemctl enable cups.socket
sudo systemctl enable cups.service
sudo systemctl start cups.service

Source: Configuring Printers on Arch Linux

Avahi (mDNS) Service

sudo systemctl enable avahi-daemon.service
sudo systemctl start avahi-daemon.service

Source: Arch Linux Installation

MPD Music Server

systemctl --user enable mpd
systemctl --user start mpd

Source: MPD Config

MariaDB Database

sudo systemctl enable mariadb.service && sudo systemctl start mariadb.service

Source: MariaDB Installation

Disable systemd-resolved

sudo systemctl disable systemd-resolved.service

Source: Arch Linux Installation


System Configuration

Time and Timezone

sudo hwclock --systohc
timedatectl set-timezone Australia/Melbourne

Source: Arch Linux Installation

Use when: Setting up new Linux installation


Shell Configuration

ZSH and Oh My Zsh Setup

Install Oh My Zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Source: ZSH Configuration

Install Autosuggestions Plugin

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Source: ZSH Configuration

Install Syntax Highlighting Plugin

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Source: ZSH Configuration

Install Powerlevel10k Theme

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Source: ZSH Configuration

Starship Prompt

Install Starship

curl -sS https://starship.rs/install.sh | sh

Source: Linux Terminal Ricing

Check Current Shell

echo $SHELL

Source: Linux Terminal Ricing

Change Default Shell to ZSH

chsh -s $(which zsh)

Source: Linux Terminal Ricing

Configure Starship for ZSH

echo 'eval "$(starship init zsh)"' >> .zshrc

Source: Linux Terminal Ricing

Download Starship Configuration

mkdir -p ~/.config
curl -o $HOME/.config/starship.toml https://gitlab.com/-/snippets/4872470/raw/main/starship.toml

Source: Linux Terminal Ricing


Docker

Validate Docker Compose File

docker compose config --quiet && printf "OK\n" || printf "ERROR\n"

Source: Docker Compose Validation

Use when: Checking docker-compose.yml syntax before deployment


Image Optimization

Optimize PNG Images

optipng -o7 -zc9 <image>

Source: Compressing Images

Options:

  • -o7 - Optimization level 7 (highest)
  • -zc9 - Compression level 9 (maximum)

File System Management

exFAT Mounting

List Available Drives

sudo fdisk -l

Source: Mounting exFAT on Linux

Create Mount Point

sudo mkdir /media/exfat

Source: Mounting exFAT on Linux

Mount exFAT Drive

sudo mount -t exfat /dev/*drive* /media/exfat

Source: Mounting exFAT on Linux


Proxy Configuration

View APT Proxy Configuration

sudo cat /etc/apt/apt.conf.d/proxy.conf

Source: Unix Proxy Server Configuration

Edit APT Proxy Configuration

sudo vim /etc/apt/apt.conf.d/proxy.conf

Source: Unix Proxy Server Configuration


Database Management

MariaDB Initialization

mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Source: MariaDB Installation

Use when: First-time MariaDB setup on Arch Linux


System Maintenance

Remove Ubuntu Pro Nag

sudo mkdir /etc/apt/apt.conf.d/off
sudo mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/off

Source: Removing the Ubuntu Pro Security Updates Nag

Use when: Disabling Ubuntu Pro upgrade prompts


User Management

Create Veeam Service User

sudo useradd -m -s /bin/bash veeamuser

Source: Adding a Veeam Service User

Options:

  • -m - Create home directory
  • -s /bin/bash - Set default shell

Login Manager

Install and Enable Greetd

yay -S greetd greetd-tuigreet
sudo systemctl enable greetd.service

Source: Greetd Login Greeter Arch Linux

Configure Greetd

sudo vim /etc/greetd/config.toml

Source: Greetd Login Greeter Arch Linux


AUR Package Management

Install Cisco Packet Tracer from AUR

cd ~/aur
yay -G packettracer

Source: Installing Cisco Packet Tracer on Arch Linux

Build and Install AUR Package

cd ~/aur/packettracer
makepkg
yay -U packettracer-8.1.0-1-x86_64.pkg.tar.zst

Source: Installing Cisco Packet Tracer on Arch Linux


Music Player Daemon (MPD)

Copy Default Configuration

cp /usr/share/doc/mpd/mpdconf.example ~/.config/mpd/mpd.conf

Source: MPD Config

Update Music Database

mpc update

Source: MPD Config

Add All Music to Playlist

mpc ls | mpc add

Source: MPD Config


  • PowerShell Command Reference - Windows equivalents
  • Git Command Reference - Version control
  • Systemd Command Reference - Detailed systemd info
  • SSH Command Reference - SSH details

Tips and Best Practices

Using sudo

  • Prefer sudo for individual commands over su - for security
  • Configure /etc/sudoers with visudo for custom permissions
  • Use sudo !! to repeat last command with sudo

Service Management Pattern

# Enable (start on boot) and start (start now) in one command
sudo systemctl enable --now service-name

# Disable and stop in one command
sudo systemctl disable --now service-name

Package Management Safety

# Always update package database first
sudo pacman -Sy

# Then install
sudo pacman -S package-name

# Or do both at once
sudo pacman -Syu package-name

Last Updated: 2025-10-09 Commands: 40+ commands from 20+ source files