Fundamentals 17 min read

Essential Linux Command-Line Tools Every Developer Should Know

This guide introduces the most frequently used Linux terminal commands—such as lsb_release, pwd, ls, cp, mv, rm, and many others—explaining their purpose, common options, and practical examples to help developers efficiently navigate and manage files on Linux servers.

Lobster Programming
Lobster Programming
Lobster Programming
Essential Linux Command-Line Tools Every Developer Should Know

lsb_release

A utility for querying Linux distribution information, showing details defined by the Linux Standard Base (LSB). Common options include:

-a: display all available information (ID, description, version, codename)

-d: show only the description

-r: show only the release number

-c: show only the codename

-v: display LSB version in a module‑description list

-s: output in a concise format suitable for scripts

-h: show help

pwd

Print Working Directory – displays the absolute path of the current directory.

pwd output example
pwd output example

ls

Lists directory contents. Frequently used options:

-a: include hidden files (those beginning with a dot)

-l: long format showing permissions, owner, size, etc.

-al: combine -a and -l for a detailed view of all files

Example output fields are explained (permissions, link count, owner, group, size, modification date, filename).

ls -al output example
ls -al output example

clear

Clears the terminal screen; the same effect can be achieved with Ctrl+L.

touch

Creates an empty file or updates the timestamps of an existing file. touch longxia.txt If the file does not exist, a zero‑byte file is created; if it exists, its access and modification times are refreshed without altering content.

vi

A powerful text editor with three primary modes:

Command mode – cursor movement, text deletion, copy/paste, mode switching

Insert mode – entered with i/a/o to insert text before, after, or on a new line

Ex commands – e.g., :w to save, :q to quit, :q! to quit without saving, :wq to save and quit

Esc returns to command mode.

cp

Copies files or directories.

cp source_file target_file

cp -r source_dir target_dir (recursive copy)

cp -p source_file target_file (preserve attributes such as timestamps and permissions)

mkdir

Creates directories.

-p: create parent directories as needed; ignore if the directory already exists

-m mode : set directory permissions explicitly (e.g., mkdir -m 750 private)

-v: verbose output showing each created directory

mv

Moves or renames files and directories. Frequently used options:

-i: interactive, prompt before overwriting

-f: force overwrite without prompting

-n: never overwrite existing files

-v: verbose, show each rename operation

-u: overwrite only when the source is newer

-t dir : move multiple files into the specified target directory

cd

Changes the current working directory. Useful shortcuts:

~: home directory

..: parent directory

/: root of the filesystem

rm

Removes files or directories.

-f: force removal, ignore nonexistent files

-i: interactive, ask before each deletion

-r: recursive removal of directories and their contents

-v: verbose, display each removal

-d: remove empty directories only

history

Manages the command history.

-c: clear the current session’s history (in memory only)

-d n : delete the entry at line number n

-w: write the in‑memory history to .bash_history -a: append new commands to .bash_history -r: read and merge the history file back into the session

df

Displays filesystem disk space usage.

-h: human‑readable sizes (e.g., 124K, 345M)

-i: show inode information instead of block usage

-T: display filesystem type

-k: show sizes in 1024‑byte blocks

cat

Concatenates and prints file contents. Common uses:

Display a file: cat myFile.txt Create a file: cat > newfile.txt Merge files: cat file1.txt file2.txt > combined.txt Append to a file: cat file2.txt >> file1.txt Useful options:

-n: number all lines (including blanks)

-b: number non‑blank lines only

-A: show all control characters

-e: display $ at end of each line

-t: display tabs as ^I

-v: show non‑printing characters

less

A pager for viewing file contents with navigation, search, and line‑number display.

less log.txt
less -i file.txt   # ignore case in searches
/error   # search forward for "error"
?warning # search backward for "warning"
n        # repeat previous search forward
N        # repeat previous search backward

type

Shows how the shell would interpret a command (builtin, alias, file, etc.). Options:

-p: display the full path of external commands

-a: list all possible definitions

whoami

Prints the effective username of the current user.

whoami output example
whoami output example

which

Locates the executable file associated with a command by searching the directories in $PATH.

-a: show all matching paths

-V: display version information

man

Displays the manual page for a command or topic. man ls: view the manual for

ls
man -k keyword

: search manual page names and descriptions for a keyword

alias

Creates a shortcut name for a command or series of commands (e.g., alias ll='ls -l'). The alias is only valid for the current shell session.

sort

Sorts lines of text files.

-n: numeric sort

-r: reverse order

-f: ignore case

-t sep : use sep as field delimiter (e.g., -t ',')

-k pos : sort by the specified field

grep

Searches files for lines matching a regular expression.

-c: count matching lines

-n: show line numbers

-i: ignore case

-v: invert match (show non‑matching lines)

wc

Counts bytes, words, and lines in a file.

-c: byte count

-l: line count

-w: word count

head

Shows the beginning of a file (default first 10 lines).

-n NUM : display the first NUM lines

-c NUM : display the first NUM bytes

-q: suppress file name headers

-v: always show file name headers

tail

Shows the end of a file (default last 10 lines) and can follow file growth.

-n NUM : display the last NUM lines

-c NUM : display the last NUM bytes

-f: follow the file as it grows

-q: suppress headers

-v: always show headers

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxCommand LineUnix
Lobster Programming
Written by

Lobster Programming

Sharing insights on technical analysis and exchange, making life better through technology.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.