Linux Articles

All articles

How to View the Start of a File in Linux (head)

head prints the first lines of a file, by default the first 10.

How to Follow a Log File in Real Time in Linux (tail -f)

tail -f prints the last lines of a file and then keeps running, displaying new lines as they're written — commonly used to watch logs live.

How to Remove Duplicate Lines in Linux (uniq)

uniq filters out adjacent duplicate lines from sorted input, leaving only unique lines.

How to Sort Lines of Text in Linux (sort)

sort orders the lines of a file or piped input alphabetically or numerically.

How to Count Lines, Words, and Characters in Linux (wc)

wc (word count) counts the number of lines, words, and characters (or bytes) in a file or piped input.

How to Check the Current User in Linux (whoami)

whoami prints the username of the currently logged-in user running the shell.

How to Check System Information in Linux (uname)

uname prints information about the current system, including the kernel name, version, and machine architecture.

How to Find Where a Command Is Installed in Linux (which)

which shows the full path to the executable that would run when you type a given command name.

Pipes and Redirection in Linux Explained (| > >> <)

Pipes and redirection connect commands and files together, letting the output of one command become the input of another.

How to Use xargs to Build Commands From Input in Linux

xargs takes input from standard input (often piped from another command) and uses it to build and execute a new command.

apt vs yum — Package Managers Compared

apt and yum (and its successor dnf) are package managers used to install and update software, but on different Linux distribution families.

sudo vs su — What's the Difference in Linux?

sudo runs a single command with elevated (root) privileges; su switches your entire shell session to another user, typically root.

How to Set Environment Variables in Linux (export)

export makes a shell variable available to any programs launched from that shell, not just the shell itself.

How to Create Command Shortcuts in Linux (alias)

alias creates a shortcut name for a longer command, saved for the duration of the shell session (or permanently if added to a shell config file).

How to View and Reuse Past Commands in Linux (history)

The history command lists previously executed shell commands, and integrates with shortcuts for quickly reusing them.

How to View System Logs With journalctl in Linux

journalctl reads and displays logs collected by systemd's journal, covering both system events and service output.

How to Manage Services With systemctl in Linux

systemctl controls systemd services — starting, stopping, enabling, and checking the status of background processes.

How to Mount a Filesystem in Linux (mount)

mount attaches a filesystem (like a disk partition or network share) to a specific directory, making its contents accessible.

How to Check Memory Usage in Linux (free -m)

free displays the amount of free and used physical memory (RAM) and swap space on the system.

top vs htop — Which Should You Use to Monitor Linux?

Both top and htop show live, updating views of running processes and system resource usage, but htop is a more modern, user-friendly alternative.

How to List Running Processes in Linux (ps aux)

ps aux lists every running process on the system along with its resource usage, owner, and process ID.

How to Change File Ownership in Linux (chown)

chown changes which user and group owns a file or directory.

How to Sync Files Efficiently in Linux (rsync)

rsync synchronizes files and directories between locations, transferring only the parts of files that have actually changed.

How to Securely Copy Files Over SSH (scp)

scp copies files between hosts over an encrypted SSH connection, using the same authentication as a normal SSH login.

curl vs wget — What's the Difference?

Both curl and wget fetch content over HTTP(S) from the command line, but they're built for different primary use cases.

How to Create and Extract .tar.gz Archives in Linux (tar)

tar bundles multiple files and directories into a single archive file, optionally compressed with gzip.

AWK Basics — Pattern Scanning and Text Processing in Linux

awk is a pattern-scanning and text-processing language, commonly used for extracting and reformatting columns of data.

What Is sed and How Does It Work? (Stream Editor)

sed (stream editor) transforms text non-interactively based on a set of rules, most commonly for search-and-replace.

How to Search for Files in Linux (find)

find searches a directory tree for files and directories matching criteria like name, type, size, or modification time.

How to Search Text With grep in Linux

grep searches input (files or piped text) for lines matching a pattern and prints those lines.

How to Delete Files and Directories in Linux (rm)

rm permanently removes files or directories — there is no built-in trash or undo.

How to Move or Rename Files in Linux (mv)

mv moves a file or directory to a new location, or renames it if the destination is in the same directory.

How to Copy Files and Directories in Linux (cp)

cp copies files or directories from a source path to a destination path.

How to List Files and Directories in Linux (ls)

ls lists the contents of a directory.

What Is a Symbolic Link (Symlink) in Linux and How to Create One

A symlink is a pointer file referencing another file or directory by path. Learn how to create one with ln -s and how it differs from a hard link.

How to Set Up SSH Key Authentication on Linux

Generate an SSH key pair, copy the public key to a server, and log in without a password using ssh-keygen and ssh-copy-id.

How to Schedule Tasks With Cron on Linux

Cron runs scheduled commands at fixed times or intervals using crontab syntax. Learn the five-field schedule format and how to add a cron job.

How to Check Disk Space and Find What's Using It on Linux

Use df -h to check overall disk usage and du -sh to find which directories are taking up the most space on a Linux server.

How to Find and Kill a Process Using a Specific Port in Linux

Find which process is using a port with lsof -i or netstat, then kill it by PID — useful when 'Address already in use' blocks a server from starting.

How to Use chmod to Change File Permissions in Linux

chmod changes read, write, and execute permissions for a file's owner, group, and others. Learn the numeric (755) and symbolic (u+x) notation.