Linux Commands Cheatsheet 2026
Interactive handbook for terminal navigation, file administration, permissions, process handling, and basic networking utilities.
Interactive Skill Mastery
Mark commands as learned to build your customized reference tracker. Retained locally in this browser.
Navigation
When to Use
When exploring directory trees and listing file statistics inside your active shell session.
Common Mistakes
Using backslashes (\) like Windows instead of forward slashes (/) for folder paths.
Shortcut / Pro-Tip
Press 'Tab' key once or twice to trigger autocomplete for directories and files.Example
pwdOutput Example
Success. (Command executed on system, check outputs)When to Use
When listing directory contents and you need to review hidden files (starting with dot, like .env or .git) alongside permissions and owners.
Common Mistakes
Thinking the system is frozen because 'ls -la' output is extremely long. Pipette it to a pager if needed.
Shortcut / Pro-Tip
Create shell alias: alias ll='ls -la'Example
ls -laOutput Example
drwxr-xr-x 14 admin staff 448 Jul 12 09:00 .
drwxr-xr-x+ 78 admin staff 2496 Jul 12 08:30 ..
-rw-r--r-- 1 admin staff 350 Jul 12 09:12 .env
-rw-r--r-- 1 admin staff 1024 Jul 12 09:00 package.jsonWhen to Use
When exploring directory trees and listing file statistics inside your active shell session.
Common Mistakes
Using backslashes (\) like Windows instead of forward slashes (/) for folder paths.
Shortcut / Pro-Tip
Press 'Tab' key once or twice to trigger autocomplete for directories and files.Example
cd <directory_path>Output Example
Success. (Command executed on system, check outputs)When to Use
When exploring directory trees and listing file statistics inside your active shell session.
Common Mistakes
Using backslashes (\) like Windows instead of forward slashes (/) for folder paths.
Shortcut / Pro-Tip
Press 'Tab' key once or twice to trigger autocomplete for directories and files.Example
cd ..Output Example
Success. (Command executed on system, check outputs)File Ops
When to Use
When modifying filesystems—creating, moving, copying, or permanently deleting folders and files.
Common Mistakes
Deleting essential files recursively with 'rm -rf' without verifying path arguments.
Shortcut / Pro-Tip
Use 'mv' for both moving files and renaming them inside the same directory.Example
mkdir <name>Output Example
Success. (Command executed on system, check outputs)When to Use
When you absolutely must delete a directory and all of its nested contents (e.g. cleaning a bloated node_modules folder).
Common Mistakes
Executing this command with typos, especially with a leading slash or wildcard (e.g. 'rm -rf /' or 'rm -rf *' on wrong working folder).
Shortcut / Pro-Tip
Use with caution. Always type 'pwd' first to double-check which directory you are currently in.Example
rm -rf node_modulesOutput Example
(Forcefully deletes the directory. No confirmation prompt or output is returned)When to Use
When modifying filesystems—creating, moving, copying, or permanently deleting folders and files.
Common Mistakes
Deleting essential files recursively with 'rm -rf' without verifying path arguments.
Shortcut / Pro-Tip
Use 'mv' for both moving files and renaming them inside the same directory.Example
cp -r <source> <destination>Output Example
Success. (Command executed on system, check outputs)When to Use
When modifying filesystems—creating, moving, copying, or permanently deleting folders and files.
Common Mistakes
Deleting essential files recursively with 'rm -rf' without verifying path arguments.
Shortcut / Pro-Tip
Use 'mv' for both moving files and renaming them inside the same directory.Example
mv <source> <destination>Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
touch <file>Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
cat <file>Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
grep "<pattern>" <file>Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
find /path -name "*.txt"Output Example
Success. (Command executed on system, check outputs)System Info
When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
df -hOutput Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
du -sh *Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
uname -aOutput Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
free -mOutput Example
Success. (Command executed on system, check outputs)Permissions
When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
chmod +x <file>Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
chmod 755 <file>Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
chown <user>:<group> <file>Output Example
Success. (Command executed on system, check outputs)Processes
When to Use
When monitoring background execution states, evaluating RAM/CPU loads, or terminating unresponsive software applications.
Common Mistakes
Killing processes indiscriminately, causing system instability or uncommitted data loss.
Shortcut / Pro-Tip
Use 'killall <process_name>' to kill all instances of a program simultaneously.Example
ps auxOutput Example
Success. (Command executed on system, check outputs)When to Use
When monitoring background execution states, evaluating RAM/CPU loads, or terminating unresponsive software applications.
Common Mistakes
Killing processes indiscriminately, causing system instability or uncommitted data loss.
Shortcut / Pro-Tip
Use 'killall <process_name>' to kill all instances of a program simultaneously.Example
topOutput Example
Success. (Command executed on system, check outputs)When to Use
When monitoring background execution states, evaluating RAM/CPU loads, or terminating unresponsive software applications.
Common Mistakes
Killing processes indiscriminately, causing system instability or uncommitted data loss.
Shortcut / Pro-Tip
Use 'killall <process_name>' to kill all instances of a program simultaneously.Example
kill -9 <pid>Output Example
Success. (Command executed on system, check outputs)When to Use
When monitoring background execution states, evaluating RAM/CPU loads, or terminating unresponsive software applications.
Common Mistakes
Killing processes indiscriminately, causing system instability or uncommitted data loss.
Shortcut / Pro-Tip
Use 'killall <process_name>' to kill all instances of a program simultaneously.Example
htopOutput Example
Success. (Command executed on system, check outputs)Network
When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
curl -I <url>Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
ping <host>Output Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
netstat -tulnOutput Example
Success. (Command executed on system, check outputs)When to Use
Use this shell command in your Linux/bash terminal to perform system admin, directory exploration, or process tasks.
Common Mistakes
Typing arguments incorrectly or executing commands with administrative superuser privileges (sudo) unnecessarily.
Shortcut / Pro-Tip
Use the Up/Down arrow keys to browse through your local shell terminal command history.Example
ip addr showOutput Example
Success. (Command executed on system, check outputs)Linux Commands Best Practices
1Never Run as Root Unnecessarily
Avoid logging in as root. Run commands with normal privileges and use 'sudo' selectively for admin actions.
2Use Relative Paths for Local Work
Keep local file operations simple and safe by avoiding raw absolute paths when executing file creations.
3Double-Check Destructive Commands
Always run pwd to verify your working folder before executing rm or recursive move commands.
4Write Modular Bash Scripts
Isolate terminal automations in clean, permission-restricted executable scripts ending in .sh.
5Leverage Pipelining with Pipe (|)
Chain simple, modular tools together (e.g. cat logs.txt | grep 'ERROR' | wc -l) to extract precise terminal records.
Common Linux Commands Errors & Solutions
Permission denied
Prepend 'sudo' to run as root, or check file permission states with 'chmod +x <file>' or 'chown'.
Command not found
The executable is missing or not in your system $PATH. Check package installs or use full paths (e.g. ./script.sh).
No space left on device
Run 'df -h' to check disk levels, and 'du -sh *' to find heavy cache directories or logs that need purging.
File name too long or ambiguous
Wrap directory paths containing spaces inside quotes (e.g. cd "my documents") to prevent syntax interpretation errors.
Connection refused
A network port is blocked, or the background server is offline. Check active listeners with 'netstat -tuln'.
Common Linux Commands Interview Questions
Q1What do the permissions rwxr-xr-x (or chmod 755) represent?
The permissions represent: owner can read, write, and execute (7/rwx); group can read and execute (5/r-x); other users can read and execute (5/r-x).
Q2What is the difference between hard links and soft (symbolic) links?
A hard link points directly to the physical inode of the file on disk. A soft link is a shortcut pointing to the filename path; if the source file is deleted, the soft link breaks.
Q3What does the pipe (|) operator do in Linux?
The pipe operator redirects the standard output (stdout) stream of the first command directly into the standard input (stdin) of the second command.
Q4How do you monitor system processes in real-time?
Use top or htop inside the terminal to display a live, interactive, resource-sorted list of running CPU and memory processes.
Q5What is the difference between backgrounding a task with & and using nohup?
Adding & runs a task in the terminal background but terminates if the shell closes. nohup prevents the task from receiving the HUP (hang up) signal, keeping it running even after logout.
Related Resources
REST API Tester
Test API routes and endpoints directly in your browser with full request controls.
JSON Formatter & Validator
Beautify, validate, and minify JSON structures instantly.
Best Free Online Developer Tools
An expert review of must-have online utilities for developers.
Git Cheatsheet
Essential command reference for local and remote version control repositories.
Generated from LearnHubly Developer Cheatsheets
Access interactive sandbox tests, tools, and developer code bases at https://www.learnhubly.com