grep -rl "terminal" ./blog

Linux Terminal and Command Line

The shell and the tools you drive it with. Individual command explainers, pipelines, job control, and the habits that make the terminal faster than a GUI for most administrative work.

66 articles

Debugging Bash Scripts: set -x, PS4, and ShellCheck How to find out what a misbehaving shell script is actually doing: syntax checks with bash -n, tracing with set -x and a better PS4, tracing to a file, catching errors with trap, and finding bugs before they run with ShellCheck. The nmap Command Explained: Scanning Your Own Network the Right Way How to use nmap to discover devices on your network, find open ports, identify services and versions, and read the results, with the scan types that matter and the legal line you should not cross. zstd and 7-Zip on Linux: Fast Modern Compression Explained zstd has become the default compressor for packages, filesystems, and kernels because it is fast at every level. How to use zstd and tar --zstd, choose levels, use long-range mode, and when 7-Zip and its .7z format make more sense. fzf and ripgrep Explained: Faster Searching in the Terminal ripgrep searches file contents faster than grep and respects .gitignore; fzf turns any list into an interactive fuzzy finder. How each works, the shell keybindings that change daily terminal use, and how to combine them. The ip Command Explained: Addresses, Routes, Links, and Neighbours ip replaced ifconfig, route, and arp as the standard Linux networking tool. How its object and command structure works, the commands you will actually use for addresses, links, routes, and neighbours, and why changes do not survive a reboot. Neovim Basics: Getting From Vim to a Modern Editor Setup Neovim keeps Vim's modal editing and adds Lua configuration, a built-in LSP client, Tree-sitter highlighting, and a plugin ecosystem built around them. How it differs from Vim, a minimal init.lua, and how to add language support. Rust Coreutils Explained: What uutils Changes on Ubuntu and What Still Differs From GNU Ubuntu now ships uutils, a Rust rewrite of ls, cp, cat and the rest of coreutils, in place of the GNU versions. What changed, why Canonical did it, where the two still behave differently, and how to switch back. FFmpeg Explained: The Flags That Actually Matter Why -crf controls quality and -b:v usually should not, what preset really trades, when copy beats re-encoding, and how to use hardware acceleration without quietly ruining your files. getopts Explained: Parsing Script Arguments Without Regret Reading positional parameters works until someone passes flags in a different order. getopts is built into bash and handles short options properly, getopt handles long ones, and there is a reason to avoid one of them. Git Basics on Linux: The Commands You Actually Need How Git tracks changes, what the staging area is for, and the eight commands that cover most day-to-day work. Includes the recovery commands for when something goes wrong. nano Editor Basics: The Terminal Editor You Can Actually Use Immediately How to open, edit, search, and save files in nano, what the caret symbols at the bottom mean, and why nano is the right default for config file edits. screen vs tmux: Which Terminal Multiplexer Why a multiplexer keeps your session alive when SSH drops, where screen still wins, and how to reattach to the session you left running last week. Zsh vs Bash vs Fish: Choosing an Interactive Shell Bash is everywhere and scripts run on it. Zsh has the best completion. Fish is the most pleasant out of the box and is not POSIX compatible. Here is what that actually costs. Heredocs and Process Substitution in Bash Feed multi-line text to a command without a temporary file, and present a command's output where a filename is expected. Two syntaxes that remove most of the need for temporary files in scripts. nl, rev, and fold: Three Small Text Utilities Worth Knowing Numbering lines with control over the format, reversing characters on a line, and wrapping long lines to a width. Each solves one problem that is awkward otherwise. seq Command Explained: Generating Number Sequences seq prints a range of numbers, with control over step, padding, and separator. It drives loops, generates test data, and builds padded filenames in one line. basename and dirname Explained: Splitting Paths in Scripts Two small commands that take a path apart reliably. They handle the edge cases that string manipulation gets wrong, and knowing the shell alternatives is worth as much as knowing the commands. comm Command Explained: Comparing Two Sorted Files comm tells you what is only in the first file, only in the second, and in both. It is faster and clearer than diff for set comparisons, with one strict requirement. paste Command Explained: Merging Files Side by Side paste joins lines from several files into columns, or folds a single column into rows. It is the counterpart to cut and the quickest way to rebuild a table from separate pieces. realpath and readlink Explained: Resolving Symlinks and Relative Paths Turn a messy relative path full of symlinks and dot-dot components into the one canonical absolute path. Essential whenever a script must know where it really is. column Command Explained: Making Terminal Output Readable Ragged output from cut, awk, or a CSV becomes an aligned table with one extra command. column is the least known and most immediately satisfying formatting tool on Linux. split Command Explained: Breaking Large Files Into Pieces Split a file by size, by line count, or into a fixed number of chunks, then put it back together with cat. Useful for transfer limits, parallel processing, and log handling. tee Command Explained: Writing to a File and the Screen at Once tee splits a stream so it goes to a file and onward down the pipeline. It is also the standard way to write to a root-owned file without running your editor as root. wc Command Explained: Counting Lines, Words, and Bytes wc counts what passes through it. Most of its real use is one flag, -l, at the end of a pipeline, and there are a few traps worth knowing about what it counts as a line. virt-manager and virsh: Running Virtual Machines on Linux One is a graphical console for libvirt and the other is its command line. Here is how to create, manage, snapshot, and connect to virtual machines with both. dig Explained: Diagnosing DNS From the Command Line Half of all networking problems are DNS problems, and dig is how you find out which half. Here is how to query specific servers, trace a lookup from the root, and read what comes back. ldd and Shared Libraries: Why Your Binary Says No Such File A program that exists, is executable, and still reports file not found is almost always missing a shared library. Here is how dynamic linking works and how to find what is missing. netcat Explained: Testing Ports, Moving Files, and Debugging Protocols netcat reads and writes arbitrary TCP and UDP connections, which makes it the fastest way to answer is this port actually open and what is that service really saying. jq Explained: Querying JSON From the Command Line APIs, container tooling, and cloud CLIs all speak JSON, and grep is the wrong tool for structured data. jq is a small language for filtering and reshaping it, and a handful of patterns cover most real use. lsof Explained: Finding What Has a File, Port, or Mount Open Everything on Linux is a file, which means one tool can answer what is using this port, why can I not unmount this disk, and what is holding onto deleted data. That tool is lsof. nice, renice, and ionice: Controlling Process Priority on Linux A backup job should not make your desktop stutter. Priority tools let you tell the kernel which work matters less, for both CPU time and disk access, and the disk one is usually the fix people actually need. Bash Scripting Part 2: Conditionals, Loops, and Functions Your first script ran commands top to bottom. Real scripts make decisions, repeat work, and organize into functions. This is the control-flow layer of bash: if, test brackets, for, while, case, and functions with local variables. The cut Command Explained: Extracting Columns from Text cut slices lines of text by delimiter, field number, or character position. It is the fastest way to pull one column out of a CSV, a log line, or /etc/passwd without reaching for awk. Symlinks vs Hard Links Explained: The ln Command and How Links Actually Work Symbolic links point to a path; hard links point to the data itself. Understanding the difference explains why one survives renames, why the other breaks, and what ln -s actually creates. The tr Command Explained: Translating and Deleting Characters tr transforms characters in a stream: uppercasing text, squeezing repeated spaces, deleting carriage returns, and converting delimiters. Small tool, constant usefulness in pipelines. The watch Command Explained: Rerunning Commands on Repeat watch reruns any command at a fixed interval and shows the latest output full-screen, turning one-shot commands like df, ss, or sensors into live monitors. Flags like -d highlight what changed between runs. The xargs Command Explained: Turning Output Into Arguments xargs takes lines of input and turns them into command arguments, letting you chain find, grep, and other tools into pipelines that act on hundreds of files at once. Here is how it works and where it bites. The awk Command Explained awk is a field-based text processing language built into every Linux system, ideal for extracting columns, summing values, and reformatting structured text. This guide covers its pattern-action model, built-in variables, and common one-liners. Bash History Explained Bash remembers every command you type, and knowing how to search, reuse, and configure that history turns repetitive typing into a handful of keystrokes. This guide covers the history command, reverse search, event expansion like !! and !n, and the variables that control what gets remembered. curl and wget Explained curl and wget are the two standard command-line tools for making HTTP requests and downloading files on Linux. This guide covers when to use each, common flags, and practical examples for downloads, APIs, and scripting. I/O Redirection and Pipes Explained Every Linux command reads from standard input and writes to standard output and standard error. This guide explains those three streams and how to redirect and chain them with >, >>, <, 2>&1, pipes, and xargs. Job Control: bg, fg, jobs, and nohup Explained How to run multiple tasks in a single terminal session, move commands between foreground and background, and keep a process running after you disconnect, using Bash job control and nohup. Reading Man Pages Explained Man pages are the built-in reference documentation for nearly every Linux command, and their terse formatting confuses a lot of newcomers. This guide covers man page structure, sections, searching, and the other help tools available from the command line. The sed Command Explained sed is the standard Linux stream editor for find-and-replace, line deletion, and text transformation from the command line. This guide covers substitution syntax, in-place editing, addressing specific lines, and common real-world patterns. tmux Basics for Beginners tmux lets you run terminal sessions that survive disconnects and split a single terminal into multiple panes. This guide covers sessions, windows, panes, and the detach/reattach workflow that makes tmux essential for remote work over SSH. Vim Basics for Beginners Vim is the terminal text editor you will run into on nearly every Linux system, and its modal design confuses almost everyone at first. This guide covers modes, essential navigation, editing, saving, and quitting, enough to use vim confidently for everyday config file edits. cat Command Explained cat prints file contents to the terminal and concatenates multiple files together. This guide covers basic usage, combining files, numbering lines, and why cat is not the right tool for very large files. cd Command Explained cd changes your shell's current working directory. This guide covers relative and absolute paths, useful shortcuts like cd - and cd .., and why cd must be a shell builtin rather than a separate program. cp Command Explained cp copies files and directories in Linux. This guide covers recursive copying, preserving permissions and timestamps, and the difference between cp and cp -a for backups and migrations. file Command Explained the file command identifies what type of file something actually is, based on its content rather than its name. This guide covers how file works, why it matters, and common use cases. head Command Explained head prints the first lines of a file, the fastest way to peek at large files without opening them fully. This guide covers basic usage, combining head with pipes, and how it compares to tail. less Command Explained less is a terminal pager for viewing large files one screen at a time. This guide covers navigation, searching inside less, and why it loads faster than more or cat for huge files. ls Command Explained ls lists the contents of a directory and is one of the most used commands in Linux. This guide covers the essential flags, how to read the output of ls -l, and practical patterns for everyday use. mkdir Command Explained mkdir creates new directories in Linux. This guide covers basic usage, the -p flag for nested paths, setting permissions on creation, and common errors mkdir throws. mv Command Explained mv moves and renames files and directories in Linux. This guide covers how mv works on the same filesystem versus across filesystems, safe overwrite habits, and common renaming patterns. pwd Command Explained pwd prints the full path of your current working directory. This guide covers how pwd works, the difference between pwd and pwd -P, and how it interacts with symbolic links. rm Command Explained rm deletes files and directories in Linux, permanently and without a recycle bin. This guide covers safe usage, the -r and -f flags, and how to avoid the most common catastrophic rm mistakes. stat Command Explained stat shows detailed metadata about a file, far beyond what ls -l provides. This guide covers reading stat output, understanding inode numbers, and the three different timestamps every file has. tail Command Explained tail prints the last lines of a file and can follow a growing file in real time. This guide covers basic usage, the essential tail -f for watching live logs, and how it compares to head. touch Command Explained touch creates empty files and updates file timestamps in Linux. This guide covers basic usage, updating access and modification times independently, and common uses in scripts and build systems. bzip2 Explained bzip2 sits between gzip and xz in the compression tradeoff, offering better ratios than gzip at slower speed using the Burrows-Wheeler transform. This guide covers usage, how it compares to gzip and xz, and where it still makes sense today. gzip Explained gzip is the most widely used compression tool on Linux, balancing speed and compression ratio for everyday use. This guide covers basic usage, compression levels, how it compares to bzip2 and xz, and its role in tar.gz archives and HTTP compression. The tar Command Explained tar is the standard Linux tool for bundling files into a single archive, and it can compress that archive at the same time using gzip, bzip2, or xz. This guide covers core tar flags, common archive formats, and practical create/extract/list examples. The unzip Command Explained unzip extracts .zip archives on Linux, with options to list contents first, extract to a specific directory, and handle password-protected or partially corrupted archives. This guide covers the practical day-to-day usage. xz Compression Explained xz achieves the best compression ratio of the common Linux compressors, at the cost of being the slowest to compress. This guide covers usage, multi-threaded compression, and why xz has become the default for software release archives. The zip Command Explained zip is the cross-platform archive format most useful when files need to be shared with Windows or macOS users. This guide covers basic usage, password protection, recursive archiving, and how zip differs from the tar-plus-compressor approach common on Linux.