10 Actually Useful Linux Commands You Probably Don't Know
In this tutorial, you'll learn about 10 actually useful linux commands you probably don't know. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
You know ls, cd, and grep. Everyone does. The commands here are different — they're the ones that, once you try them, make you wonder how you lived without them. Every entry replaces a built-in tool or solves a problem the standard tools leave unsolved. These are not niche utilities — they are the modern standard for terminal productivity that every developer should know.
In this guide, you will learn 10 Linux commands that experienced developers install immediately on any new machine. Each command solves a specific pain point — disk space analysis, fuzzy file search, JSON parsing, process monitoring — that the standard UNIX tools handle poorly or not at all. By the end, you will have a terminal toolkit that makes you significantly faster and more effective. Each command is available in major package managers, installs in seconds, and integrates with your existing shell without breaking anything you already rely on.
The Commands
ncdu — Interactive disk usage analyzer that scans your filesystem and presents a navigable, sorted view of space consumption. Arrow keys to browse, d to delete. Replaces du -sh * with something you can actually explore.
ncdu stands for NCurses Disk Usage. It scans the specified directory and displays an interactive browser where the largest directories appear at the top, sorted by size in human-readable format. You navigate with arrow keys, press Enter to drill into a directory, and press d to delete a directory or file directly from the interface. The scan is fast because ncdu reads directory metadata efficiently rather than opening each file.
The real value of ncdu becomes apparent when you need to reclaim disk space. The du -sh * | sort -rh pipeline tells you the largest directories, but it does not show the tree structure. With ncdu, you can drill down through nested directories to find the exact subdirectory or file that is consuming space. The percentage column shows what fraction of the parent directory each item consumes, so you can prioritize cleanup efforts.
ncdu also supports exporting scan results to a file for offline analysis. Run ncdu -o scan.json /path to produce a JSON file, then load it later with ncdu -f scan.json. This is useful for monitoring disk usage trends over time on servers where you cannot stay connected. The SSH integration also works over remote connections since ncdu is a terminal application with no graphical dependencies.
# Basic usage: scan the current directory
ncdu
# Scan a specific directory
ncdu /var/log
# Export scan results for later analysis
ncdu -o scan.json /home
# Load an exported scan
ncdu -f scan.json
# Scan with a progress indicator (useful for large filesystems)
ncdu -1 -o scan.json /
fzf — Fuzzy finder that pipes any list (files, processes, Git branches, command history) into an interactive search. Start typing and it narrows results instantly. Pipe it with Ctrl+R for reverse search through command history — it's transformative.
fzf is a general-purpose interactive filter that works with any input stream. Pipe a list into it, and fzf presents an interactive search prompt. As you type, it filters the list using fuzzy matching — you do not need to type the exact characters, just a subsequence. For example, typing "src/main" matches "src/main.py", "source/maintenance.log", and "src/main/controller.js" because all contain those characters in order.
The most transformative use is the Ctrl+R integration for reverse command history search. After installing fzf and sourcing its key bindings, pressing Ctrl+R opens an interactive search over your shell history instead of the traditional cycle-through-matches behavior. You type part of a previous command, and fzf shows all matching history entries with the full command visible. Select one with Enter and it fills the prompt. The time saved over cycling through dozens of history entries is substantial.
fzf also integrates with file navigation, process management, and Git. The Ctrl+T shortcut lets you fuzzy-search files in the current directory tree and paste the path into the command line. Alt+C fuzzy-searches directories and cds into the selected one. The ** trigger syntax enables tab-completion integration with commands like ssh ** to fuzzy-search SSH hosts and kill ** to fuzzy-search processes by name.
# Search through all files recursively, open selection in vim
vim $(fzf)
# Interactive grep: search file contents and open the result
vim $(rg -l "TODO" | fzf)
# Kill processes by fuzzy name
kill -9 $(ps aux | fzf | awk '{print $2}')
# Checkout a Git branch by fuzzy name
git checkout $(git branch -a | fzf | tr -d ' *')
# Browse and open files with preview window
fzf --preview 'bat --color=always {}'
bat — cat with syntax highlighting, line numbers, and Git integration. Shows a +/- gutter for modified lines when viewing tracked files. Works with pipes too — bat file.rs | head still gets highlighting.
bat is a drop-in replacement for cat that adds visual polish without losing compatibility. When you run bat file.py, it detects the file type from the extension, applies syntax highlighting using the same engine as Sublime Text (Syntect), and displays line numbers in the left gutter. The output is paginated by default, so long files do not scroll past before you can read them.
The Git integration is the killer feature. When viewing a file that is tracked by Git, bat shows a + or - symbol in the gutter next to lines that were added or modified since the last commit. This immediately tells you what changed in a file without running git diff. The modification indicators update automatically based on the current diff against HEAD.
bat also serves as a pager with bat --paging=always and supports custom themes. You can set the theme via the BAT_THEME environment variable or in bat's config file. The --style=plain option strips all formatting for pipe compatibility, and --show-all displays non-printable characters similar to cat -A. bat integrates with man pages, fzf previews, and less as a replacement pager.
# Basic file viewing with syntax highlighting
bat script.py
# View with line numbers and Git modification indicators
bat --style=numbers,changes script.py
# Use as the default pager for man pages
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
# Pipe output while preserving highlighting
bat script.py | head -20
# Show non-printable characters (like cat -A)
bat --show-all file.txt
ripgrep / rg — grep replacement that respects .gitignore, ignores binary files, and searches 10-100x faster. Recursive by default. Smart case sensitivity — only cases when the pattern has uppercase.
ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. It automatically ignores files and directories listed in .gitignore, .ignore, and .rgignore files, so you never search through node_modules, .git, or compiled output unless you explicitly ask for it. This alone makes it dramatically faster than grep for typical development workflows.
The performance advantage comes from multiple design decisions. ripgrep starts searching before reading the entire file list, uses SIMD instructions for fast pattern matching, and implements a Boyer-Moore-inspired search algorithm optimized for the typical case of searching plain text files. Benchmarks consistently show rg outperforming grep by 5-10x on codebases and by 50-100x on directories with large binary files that other tools would waste time scanning.
ripgrep supports searching by file type with the --type flag. The built-in type list covers dozens of languages and file formats: --type rust searches .rs files, --type py searches .py files. You can define custom types in the config file. The --context flag shows surrounding lines, --files-with-matches returns only filenames for piping into other tools, and --no-ignore searches everything including .gitignore-ignored files.
# Basic recursive search
rg "async fn"
# Search only Rust files
rg "impl" --type rust
# Show 3 lines of context before and after each match
rg "TODO" --context 3
# List only filenames with matches (useful for piping)
rg -l "def " --type py | xargs wc -l
# Search with case-insensitive matching
rg -i "class user"
# Search files modified in the last 24 hours
rg "error" --type json --changed-after "yesterday"
fd — find replacement with intuitive syntax. fd pattern instead of find -name 'pattern'. Respects .gitignore, supports regex, and colorizes output by default.
fd reimagines the find command with sensible defaults. The basic command fd pattern searches the current directory recursively for files whose names match the pattern. The pattern can be a simple substring, a glob, or a full regex depending on the flags. Unlike find, fd colorizes output based on file type (blue for directories, green for executables, red for archives) and respects .gitignore automatically.
The performance improvement over find is substantial. fd uses parallelized directory traversal with rayon, a Rust parallelization library, to scan multiple directories simultaneously. On large directory trees, fd completes 5-10x faster than find. It also caches file metadata in certain operations to avoid repeated stat calls.
fd supports file type filtering (-e for extension, -t for type like directory/symlink), date filtering (--changed-within and --changed-before), and file size filtering (-s). The -x flag executes a command on each matching file, like fd -e py -x wc -l to count lines in all Python files. The --exec-batch flag passes all matching files at once for commands that accept multiple arguments.
# Find CSV files modified in the last week
fd --extension csv --changed-within 1week
# Find directories named "test"
fd --type directory test
# Find files larger than 100MB
fd --size +100M
# Execute a command on each match
fd -e py -x echo "File: {}"
# Find files with regex pattern
fd '^src.*\.rs$'
# Search in a specific directory
fd pattern /path/to/search
# Exclude specific directories
fd pattern --exclude node_modules --exclude .git
tmux — Terminal multiplexer that manages multiple shell sessions in one window, keeps processes running when disconnected, and splits panes into grids. Essential for remote servers: start a long task, disconnect, reconnect later and it's still running.
tmux, short for terminal multiplexer, lets you run multiple terminal sessions within a single window. You can split the window into panes vertically and horizontally, create multiple windows within a session, and detach from a session while leaving processes running. Reattach later from any terminal and everything is exactly where you left it. This is indispensable for remote server work where you need to start long-running processes and check on them later.
The session management model is tmux's core advantage. Each session is a fully independent collection of windows and panes with its own environment. You can have one session for a web development project with a dev server and editor in separate panes, another session for database administration, and a third for monitoring production logs. Switching between sessions keeps each context isolated and organized.
tmux supports extensive customization through ~/.tmux.conf. Common configurations include rebinding the prefix key from Ctrl+B to Ctrl+A, enabling mouse support for clicking to switch panes and resize splits, setting the terminal colors to 256-color mode, and configuring the status bar to show session name, window list, hostname, and system load. The plugin manager tpm adds features like saving and restoring sessions across reboots, persistent undo, and enhanced keybindings.
# Create a named session
tmux new -s build-session
# List all sessions
tmux ls
# Attach to an existing session
tmux attach -t build-session
# Kill a session
tmux kill-session -t build-session
# Create a new window within a session (Ctrl+B c)
# Split pane vertically (Ctrl+B %)
# Split pane horizontally (Ctrl+B ")
# Navigate panes (Ctrl+B arrow keys)
# Run a command in a new detached session
tmux new-session -d -s backup 'rsync -av /data /backup'
jq — sed for JSON. Parses, filters, and transforms JSON from the command line. Indispensable for working with any API output.
jq is a lightweight and flexible command-line JSON processor. It takes JSON input, applies a filter expression, and outputs the result. The basic filter . returns the entire input, .key extracts a specific key, and .key1.key2 accesses nested properties. Arrays use .[] to iterate elements and .[index] to access by position. The language is expressive enough to handle most data transformation tasks without switching to Python or Node.js.
Common patterns include extracting specific fields from API responses, transforming JSON data between formats, and building pipelines that process streaming JSON. The -r flag outputs raw strings without JSON quotes, which is useful for piping values into other commands. The --arg flag passes shell variables into jq expressions for dynamic filtering.
jq also handles arrays and objects with functions like map, select, group_by, and sort_by. You can filter arrays with select(.status == "active"), transform objects with {key: .value} syntax, and merge objects with addition. The length function works on strings, arrays, and objects. For large documents, the streaming parser (--stream) processes input incrementally without loading the entire file into memory.
# Extract a specific field from an API response
curl api.github.com/repos/curl/curl | jq '.stargazers_count'
# Extract multiple fields as a new object
curl api.github.com/repos/curl/curl | jq '{name: .full_name, stars: .stargazers_count}'
# Filter array elements
jq '.[] | select(.status == "active")' data.json
# Transform each element in an array
jq '.[] | {id, email: .user.email}' users.json
# Pretty-print with custom indentation
jq --indent 4 '.' data.json
# Count elements in an array
jq 'length' data.json
# Use shell variable in filter
limit=10
curl api.github.com/repos | jq --arg l "$limit" '.[:($l|tonumber)]'
htop/btop — Interactive process viewer that's immediately better than top. Color-coded, sort by any column, kill processes with a single key. btop adds GPU monitoring and mouse support.
htop improves on the classic top command in almost every way. The display is color-coded: CPU bars show user/system/nice/idle time in different colors, memory shows used/buffered/cached with distinct indicators, and process lists are fully searchable and scrollable. You can sort by any column by clicking the column header or pressing F6 and selecting the sort key. Killing a process is a two-key operation: F9, select the signal, Enter.
btop is the modern successor that adds GPU monitoring, disk I/O graphs, network throughput charts, and a more polished visual design. It supports mouse interaction natively — click to select, scroll to navigate, and drag to resize panels. The process list includes tree view that shows parent-child relationships, and you can send any signal from the kill menu.
Both tools support configurable update intervals, custom color schemes, and process filtering by username or search term. The display layout in btop is modular: you can enable or disable individual panels (CPU, memory, disks, network, processes) and arrange them on the screen. The configuration file supports defining profiles for different monitoring scenarios like "development" or "production".
# Start htop
htop
# Start btop with GPU monitoring (if supported)
btop
# htop keyboard shortcuts:
# F6: Select sort column
# F9: Kill a process
# F5: Tree view
# / : Search processes
# u : Show processes for a specific user
# t : Tree view toggle
# Start btop with specific update interval (ms)
btop --update 2000
# htop command line options
htop --sort-key PERCENT_CPU
duf — Disk usage with clean, colorized tables. Better than df in every way — shows mount points, usage percentages, and available space in a human-readable format with automatic unit scaling.
duf is a modern replacement for df that presents filesystem information in clearly formatted, colorized tables. Run duf without arguments and it displays all mounted filesystems grouped by type: local devices, network filesystems, special purpose filesystems (tmpfs, devtmpfs), and FUSE mounts. Each group is separated by a horizontal line with a group label, making the output immediately parsable by humans.
The columns show filesystem, type, total size, used space, available space, usage percentage, and mount point. The usage percentage bar is rendered as a colored horizontal progress bar in the terminal. Colors change based on usage thresholds: green below 50%, yellow between 50-80%, and red above 80%. The --theme flag lets you choose between dark and light mode color schemes.
duf supports filtering by filesystem type, mount point, or device. The --only local flag shows only local physical drives, excluding tmpfs, squashfs, and network mounts. The --output flag selects which columns to display, and --width controls table width for narrow terminal windows. Like ncdu, duf supports JSON output with --json for integration with monitoring scripts.
# Display all filesystems
duf
# Show only local filesystems
duf --only local
# Show only specific types
duf --type ext4,xfs
# Customize displayed columns
duf --output mountpoint,size,used,avail,usage
# JSON output for scripting
duf --json
# Exclude specific mount points
duf --hide-fs tmpfs,squashfs
# Display with a specific theme
duf --theme dark
tldr — Simplified man pages with practical examples. When man is an information firehose, tldr gives you the 5 most common use cases. Community-maintained and significantly faster to read.
tldr (Too Long; Didn't Read) provides concise, example-driven documentation for command-line tools. Instead of the wall of text that man pages present, tldr shows a brief description of the command followed by 5-10 practical usage examples. Each example includes a description of what it does and the exact command to run, with placeholders highlighted in curly braces.
The examples are community-maintained and peer-reviewed on GitHub. Each command page goes through a review process to ensure the examples are correct, well-explained, and cover the most common use cases. New pages are added regularly, and existing pages are updated when command interfaces change. The client is a thin shell that fetches pages from the GitHub repository, so you always get current content without updating the package.
tldr is available as a standalone client (tldr tar) or as an integrated function within tools like bat and navi. The --list flag shows all available pages, --update refreshes the local cache, and --os lets you specify the operating system for platform-specific commands. The output supports color themes and can be customized through a config file.
# Get simplified help for a command
tldr tar
# Search for a command by keyword
tldr --search compress
# List all available pages
tldr --list
# Update the local page cache
tldr --update
# View platform-specific pages
tldr --os linux ss
# Pipe through a pager for long output
tldr git | less
# Show only the command examples without description
tldr --quiet curl
Setting Up Your Toolkit
Install all ten commands in one command to set up your new toolkit. On Debian-based systems, run sudo apt update && sudo apt install ncdu fzf bat ripgrep fd-find tmux jq htop duf tldr. On Red Hat-based systems, use sudo dnf install ncdu fzf bat ripgrep fd-find tmux jq htop duf tldr. On Arch Linux, sudo pacman -S ncdu fzf bat ripgrep fd tmux jq htop duf tldr.
After installation, configure fzf key bindings by adding eval "$(fzf --zsh)" to your .zshrc or eval "$(fzf --bash)" to your .bashrc. Set the BAT theme with export BAT_THEME="Dracula" in your shell rc file. Create a ~/.ripgreprc file with default flags like --smart-case --hidden to always search hidden files with smart case detection. For tmux, create a ~/.tmux.conf with set -g mouse on to enable clickable pane switching and resizing.
These configuration steps take five minutes total but significantly improve the daily experience with each tool. The configuration files are idempotent — adding settings that are already present does not cause errors — so you can safely append to them repeatedly. Verify each tool is working by running its basic command: bat --version, rg --version, fd --version, jq --version, and duf --version. Each should return version information without errors.
Real-World Task: Debug a Production Disk Full Alert
Your monitoring system alerts that /var/log has reached 95% disk usage on a production server. You SSH into the machine and have readonly access — you cannot install new tools.
- Use
dufto confirm which filesystem is full and check if other mounts have available space. - Use
ncdu /var/logto interactively find the largest log files and subdirectories. Identify which service is generating the most logs. - Use
rg "ERROR" /var/log --type syslogto search for error patterns without reading through hundreds of megabytes of logs manually. - Use
jqto parse structured JSON logs if the application uses structured logging. Extract timestamps and error counts to identify when the issue started. - Use
tldr journalctlto check the correct syntax for querying systemd logs if the service uses journald instead of plain text logs.
This workflow uses five commands from this list to diagnose and understand the issue without touching any files. In a real scenario, you would then coordinate with the team to rotate or compress logs based on the evidence gathered.
Practice Questions
- What command would you use to interactively explore disk usage and drill down into large directories?
- How does ripgrep achieve significantly faster search performance than grep?
- What is the difference between
findandfdin terms of gitignore handling? - Which command would you use to format and extract specific fields from a JSON API response?
- What makes tldr different from man pages, and when would you use each?
Answers
ncdu— it provides an interactive, navigable browser that shows disk usage sorted by size with drill-down capability.- ripgrep uses SIMD instructions, ignores
.gitignorefiles and binary files by default, and uses efficient Boyer-Moore pattern matching. - fd respects
.gitignoreautomatically and outputs results immediately without waiting for the full file scan to complete, whilefindrequires explicit-not -pathexclusion patterns. jq— it parses, filters, and transforms JSON from the command line with a powerful filter expression language.- tldr shows concise, example-focused documentation for common use cases, while man pages provide exhaustive reference documentation. Use tldr for everyday tasks and man when you need detailed option descriptions.
Challenge: Build a Terminal Monitoring Dashboard
Create a script that logs system health metrics every 30 minutes using these commands. Use duf --json to capture disk usage, read /proc/meminfo for memory, and ncdu -o for disk usage snapshots. Pipe the data into jq to extract specific metrics and append them to a CSV file for trend analysis. Use bat to view the log file with syntax highlighting at the end of each day.
The challenge: extend the script to send an alert via a webhook when disk usage exceeds 90% on any mount point. Use jq to filter the duf JSON output for entries where the usage percentage is above the threshold. This mirrors real monitoring systems like Prometheus + Alertmanager but implemented entirely with command-line tools from this list.
#!/bin/bash
# Health check script template
THRESHOLD=90
ALERT_WEBHOOK="https://hooks.example.com/alert"
duf --json | jq -c '.[] | select(.usage > $threshold)' \
--argjson threshold "$THRESHOLD" | while read -r entry; do
mount=$(echo "$entry" | jq -r '.mount')
usage=$(echo "$entry" | jq -r '.usage')
echo "ALERT: $mount at ${usage}% usage"
# curl -X POST -H "Content-Type: application/json" \
# -d "$entry" "$ALERT_WEBHOOK"
done
Mini Project: File Search and Analysis Pipeline
Combine fd, rg, bat, and jq into a pipeline that scans a project directory for TODO comments, counts them by file type, and outputs a summary. Start with fd -e js -e ts -e py -x rg --no-heading "TODO" {} to find TODOs in JavaScript, TypeScript, and Python files. Pipe the output into awk '{print $1}' | cut -d: -f1 | sort | uniq -c | sort -rn to count TODOs per file. Use jq to format the counts as JSON for integration with project management tools.
This pipeline demonstrates how combining multiple specialized tools produces results that no single command can achieve. Each tool handles one step of the pipeline, and the output of each step feeds naturally into the next.
Install one new command from this list today and practice its most common use case. Within a week, you will reach for the new tool instead of the old one by instinct.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro