GO KALI FREE

Kali Linux Commands List163 Linux Commands Cheat Sheet with Examples

Complete reference of 163 essential Linux and Kali Linux terminal commands with individual pages, syntax, practical examples, and instant search.

Practice in Online TerminalLinux Commands Explained Guide

Navigation Commands

pwd

Prints the current working directory as an absolute path from the root directory.

ls

Lists directory contents, displaying file names, attributes, permissions, and metadata.

cd

Changes the current working directory of the shell environment, supporting logical and physical symlink traversal.

cd ..

Changes the current working directory to its immediate parent directory within the hierarchical Linux filesystem tree.

cd ~

Changes the current working directory to the current user's personal home directory using shell tilde expansion.

cd -

Toggles the current working directory back to the previously active directory using the OLDPWD shell tracking variable.

pushd

Pushes a directory onto the shell directory stack and changes the current working directory to that location.

popd

Removes entries from the shell directory stack and navigates to the newly exposed top directory.

dirs

Displays the list of currently remembered directories in the shell directory stack.

File Management

mkdir

Creates one or more new directories or parent directory trees on the filesystem.

touch

Creates empty files and updates access and modification timestamps of existing filesystem objects.

cp

Copies files or directories from one location to another.

mv

Moves or renames files and directories across the filesystem.

rm

Removes (deletes) files or directories from the filesystem permanently.

rmdir

Removes empty directories from the filesystem, providing a safe alternative to recursive deletion commands.

cat

Concatenates files and displays their contents on the standard output.

less

Views file contents page by page with backward and forward navigation, pattern searching, and memory-efficient streaming.

more

Filters and displays text files one screenful at a time with forward scrolling and search.

head

Displays the beginning lines or bytes of text files and command streams to standard output.

tail

Outputs the trailing portion of files and monitors real-time append events as data is written.

nano

Modeless, user-friendly terminal text editor featuring on-screen keyboard shortcut prompts, line numbering, and syntax highlighting.

vim

Highly configurable modal text editor designed for efficient text editing, programming, and configuration management across terminal sessions.

wc

Counts lines, words, characters, and bytes in a file.

ln

Creates hard links and symbolic (soft) links establishing filesystem references to existing files and directories.

stat

Displays comprehensive filesystem metadata and inode status information including timestamps, permissions, blocks, and ownership.

file

Identifies file type and encoding by inspecting filesystem metadata, magic numbers, and internal signatures.

tee

Reads from stdin and writes to both stdout and one or more files simultaneously.

diff

Compares two files line by line and shows the differences.

User Management

whoami

Displays the effective user name associated with the current running process or shell session.

who

Displays information about currently logged-in users by reading the system utmp accounting database.

w

Displays who is currently logged on and what processes each user is running along with system load averages.

id

Prints real and effective user and group IDs, names, and security contexts for the current or specified user.

su

Switches the current user context to another user account or spawns an interactive root login shell.

sudo

Executes commands with superuser privileges or as another target user with granular authorization and auditing.

passwd

Updates user authentication tokens and manages account password aging policies in the shadow password database.

useradd

Creates a new user account and initializes default environment settings in the system databases.

usermod

Modifies existing user account attributes including group memberships, login shell, home directory, and lock status.

userdel

Deletes a Linux user account and related system authentication entries from system credential databases.

groupadd

Creates a new user group definition in the system authentication databases.

groupdel

Removes an existing user group definition from the system authentication databases.

groups

Prints the names of all primary and supplementary groups the current or specified user belongs to.

last

Displays a chronological list of recent user logins, reboots, and session durations from system accounting logs.

Permission Commands

chmod

Changes file mode bits and permissions for user, group, and others.

chown

Changes file owner and group ownership across the filesystem.

chgrp

Changes group ownership of files and directories across Linux filesystems to control team access.

umask

Displays or sets the file mode creation mask determining default permissions for newly created files and directories.

getfacl

Displays POSIX Access Control Lists (ACLs) revealing granular multi-user and multi-group file permissions.

setfacl

Sets, modifies, and removes POSIX Access Control Lists (ACLs) to configure fine-grained file and directory access.

sudo -l

Queries and enumerates the active sudo security policy to display allowed and forbidden commands, target users, and execution tags for the user.

visudo

Safely edits the /etc/sudoers file to configure sudo permissions.

Networking Commands

ping

Sends ICMP ECHO_REQUEST packets to network hosts to diagnose network connectivity, measure packet latency, and detect transmission loss.

ifconfig

Configures, monitors, and queries network interface parameters in Linux network subsystems.

ip

Modern replacement for ifconfig. Shows and manipulates network interfaces, routing tables, and IP tunnels.

netstat

Legacy network analysis tool from the net-tools package for displaying active network connections, routing tables, and interface statistics.

ss

Modern, high-performance socket inspection utility that dumps detailed socket statistics directly from the Linux kernel Netlink subsystem.

curl

Transfers data from or to a server using various network protocols (HTTP, HTTPS, FTP, and more).

wget

Downloads files from the internet non-interactively via HTTP, HTTPS, and FTP protocols.

dig

Performs flexible DNS lookups and queries name servers directly with comprehensive protocol diagnostics.

nslookup

Queries Internet domain name servers interactively or non-interactively to resolve DNS records.

host

Streamlined Domain Name System (DNS) lookup utility for performing forward address resolution and reverse IP mapping.

traceroute

Tracks the packet delivery path across IP networks by exploiting IP TTL expiration to map intermediate routing hops and measure transit latencies.

arp

Manipulates and inspects the IPv4 Address Resolution Protocol neighbor cache table in the Linux kernel.

route

Displays and manipulates the IP routing table in the Linux kernel network subsystem.

hostname

Shows or temporarily sets the system's network host name and IP domain addresses.

iwconfig

Configures and inspects wireless network interfaces using legacy Linux Wireless Extensions.

Process Commands

ps

Reports a snapshot of current running processes with their PIDs.

top

Displays an interactive, real-time view of system processes, CPU utilization, and memory usage.

htop

Interactive, ncurses-based real-time process viewer and system resource monitor.

kill

Sends standard operating system signals to terminate, pause, or reload processes by PID.

killall

Terminates all running processes matching an exact name by sending specified signals.

pkill

Sends signals to running processes based on process name, command-line patterns, and user attributes.

bg

Resumes a suspended or stopped job in the background within the current shell session.

fg

Brings a background or suspended job into the foreground of the current terminal session.

jobs

Lists active background, running, and suspended jobs in the current shell session.

nice

Runs a program with a modified scheduling priority (niceness) in the Linux kernel scheduler.

renice

Alters the scheduling priority (niceness) of one or more already running processes.

nohup

Runs a command immune to hangups (SIGHUP) with output redirected to non-terminal files.

pgrep

Searches running processes and outputs the process IDs (PIDs) matching specified criteria.

System Information

uname

Prints detailed operating system, hardware architecture, and Linux kernel release information.

uptime

Displays how long the system has been running, the number of active users, and system load averages.

hostnamectl

Queries and controls the system hostname and associated system architecture metadata via systemd.

lscpu

Gathers and displays detailed CPU architecture, core topology, cache hierarchy, and hardware vulnerability mitigations.

lsblk

Lists information about all available block devices, partitions, and storage hierarchies in a tree layout.

lspci

Displays detailed information about all PCI and PCIe buses and attached hardware devices (GPUs, NICs, NVMe drives).

lsusb

Displays information about USB buses and all connected Universal Serial Bus devices (flash drives, keyboards, adapters).

free

Displays the total, used, and available physical memory (RAM) and swap space in the system.

vmstat

Reports virtual memory, process scheduling, block I/O, paging, and CPU activity statistics from kernel subsystems.

dmesg

Inspects and controls the kernel ring buffer, displaying hardware initialization, driver messages, and kernel diagnostics.

lsmod

Formats and displays the list of currently loaded Linux kernel modules and their dependencies.

modinfo

Extracts and displays detailed metadata, author, license, parameters, and dependencies from Linux kernel modules.

env

Runs a command in a modified environment or displays current exported environment variables.

echo

Outputs text strings and variable values to standard output with optional formatting.

date

Displays, formats, or sets the system date and time with advanced relative date parsing.

cal

Displays formatted monthly and yearly calendars in the terminal with day highlighting.

history

Displays, manipulates, and searches the list of previously executed commands in the current shell session.

clear

Clears the terminal screen using terminal-specific escape sequences, with an option (-x) to prevent clearing the scrollback buffer.

alias

Creates or displays command aliases, providing custom shortcuts and default arguments for commands.

unalias

Removes defined aliases from the current shell's active environment.

Package Management

apt update

Resynchronizes local package index files from remote repository sources defined in sources.list and sources.list.d directories.

apt upgrade

Installs available upgrades of all packages currently installed on the system from configured repositories without removing existing packages.

apt install

Installs new software packages and their required dependencies from configured repositories onto the Debian-based system.

apt remove

Removes specified installed packages from the system while preserving their user configuration files in /etc/.

apt purge

Completely removes specified packages along with all their global configuration files and service directories.

apt autoremove

Removes automatically installed packages that were originally brought in as dependencies but are no longer needed by any installed software.

apt search

Searches available package names and descriptions in the local APT cache for specified regular expressions or keywords.

apt show

Displays comprehensive package metadata, including version, dependencies, architecture, maintainer, size, and detailed descriptions.

apt list

Lists packages matching specified criteria such as installed, upgradable, or all available packages in the repository.

dpkg -i

Installs or upgrades local Debian package (.deb) files directly into the system filesystem without automatic remote dependency resolution.

dpkg -r

Removes an installed package from the system while leaving its configuration files intact in the /etc/ directory.

dpkg -l

Lists installed Debian and Ubuntu software packages matching an optional pattern with their installation status, version, and architecture.

snap install

Installs sandboxed, self-contained application bundles from the Canonical Snap Store onto the Linux system.

pip install

Downloads, compiles, and installs Python packages and binary wheels from the Python Package Index into user environments or virtual environments.

Compression Commands

tar

Archives multiple files into a single tarball. Use -czf to compress with gzip.

gzip

Compresses a single file using the gzip algorithm (replaces original with .gz).

gunzip

Decompresses files compressed with gzip, zip, or compress algorithms back to their original state.

bzip2

Compresses files using the Burrows-Wheeler block-sorting algorithm and Huffman coding, yielding high-density .bz2 archives.

bunzip2

Decompresses files compressed with bzip2 (.bz2), validating 32-bit CRC checksums and restoring the original uncompressed file.

zip

Creates a compressed ZIP archive of files and directories.

unzip

Extracts files from a ZIP archive.

xz

Compresses files using high-ratio LZMA/LZMA2 algorithms, creating compact .xz containers with multi-threading and CRC integrity verification.

unxz

Decompresses files compressed with xz (LZMA/LZMA2), validating stream checksums and restoring original uncompressed files.

7z

Versatile multi-format CLI archive manager providing high-ratio LZMA2 compression, strong AES-256 encryption, and multi-volume archives.

Remote Access Commands

ssh

Connects securely to a remote machine via the SSH protocol for shell access and encrypted tunneling.

scp

Copies files and directories securely between local and remote systems or between two remote hosts using encrypted SSH transport.

rsync

Synchronizes files and directories locally or across remote networks using an efficient delta-transfer algorithm and SSH encryption.

ftp

Transfers files to and from a remote host using the legacy, unencrypted File Transfer Protocol.

sftp

Provides an interactive, encrypted file transfer program operating over the secure OpenSSH transport protocol.

telnet

Connects to remote hosts via the unencrypted Telnet protocol and provides a raw TCP socket debugging utility.

ssh-keygen

Generates, manages, and converts OpenSSH public and private cryptographic key pairs for secure authentication.

ssh-copy-id

Installs your local SSH public key onto a remote server's authorized_keys file to enable seamless key-based login.

Search Commands

find

Searches for files and directories in a directory hierarchy by name, type, size, modification time, and permissions.

grep

Searches for patterns (plain text or regular expressions) inside files or standard input and prints matching lines.

locate

Fast index-based filesystem search utility that queries a pre-built file database to locate files and directories instantly.

which

Locates the executable binary associated with a command by searching the directories in the current PATH.

whereis

Locates the binary executable, source files, and manual page documentation for specified command names in standard system locations.

type

Displays how a command name would be interpreted by the shell, classifying it as an alias, keyword, function, builtin, or executable file.

awk

Powerful pattern scanning and data processing language for extracting and calculating columnar data.

sed

Stream editor for filtering, transforming, and substituting text in files or standard input.

sort

Sorts lines of text files alphabetically or numerically.

uniq

Reports or filters out repeated lines in a sorted file.

cut

Extracts selected sections, columns, or character ranges from each line of input files or standard input streams.

tr

Translates, squeezes, or deletes characters from standard input and writes the result to standard output.

xargs

Builds and executes command lines from standard input, batching arguments to prevent system limits and running tasks in parallel.

Disk Commands

df

Reports file system disk space usage, allocated blocks, free capacity, and mount points across all storage volumes.

du

Estimates file and directory space usage (disk usage).

fdisk

Manipulates disk partition tables, supporting traditional DOS/MBR, modern GPT, Sun, and SGI partition layouts with sector-level precision.

mount

Attaches storage filesystems, block devices, disk images, and network shares to the unified Linux directory hierarchy at specified mount points.

umount

Detaches mounted filesystems from the Linux directory hierarchy, committing cached write buffers and safely releasing block devices.

mkfs

Creates a filesystem (formats) on a disk partition.

fsck

Checks and optionally repairs a filesystem for errors.

dd

Copies and converts raw data at the block level (disk cloning, bootable USB creation).

blkid

Locates and displays block device attributes, querying filesystem signatures and the libblkid cache to report UUIDs, PARTUUIDs, volume labels, and filesystem types.

parted

A powerful, scriptable partition manipulation utility that supports modern GPT disk labels, large storage volumes (over 2TB), partition alignment verification, and live filesystem resizing.

ncdu

Interactive disk usage analyzer with a terminal UI (ncurses-based).

Service Commands

systemctl start

Activates one or more systemd service units immediately in the running system session.

systemctl stop

Deactivates one or more running systemd service units immediately in the active session.

systemctl restart

Stops and immediately starts one or more systemd service units, restarting all processes within their control groups.

systemctl enable

Configures a systemd service to start automatically during system boot by creating dependency symlinks in filesystem target directories.

systemctl disable

Prevents a systemd service from starting automatically at boot by removing its dependency symlinks from filesystem target directories.

systemctl status

Inspects runtime execution state, unit file configuration, process tree hierarchy, cgroup resource consumption, and recent journal logs for system services.

systemctl list-units

Lists, filters, and inspects systemd units currently loaded into memory, displaying active states, load states, and operational descriptions.

service

Executes SysV init scripts or legacy service actions, transparently redirecting to systemctl on modern systemd Linux distributions.

journalctl

Queries, filters, and analyzes structured binary event logs collected across system services and the kernel by systemd-journald.

Continue Learning Linux

Beginner guide

What Is Linux?

Understand the operating system foundations behind command-line workflows.

Learning resource

Command-Line Essentials

Build confidence with shell navigation and command-line fundamentals.

Linux fundamentals

Linux File System Explained

Learn how Linux directories, paths, and files are organized.

Linux security

Linux File Permissions

Understand chmod, ownership, and safe permission management.

Command-Line Security Tools

Network scanning

Nmap

Network discovery and service enumeration from the terminal.

Networking

Netcat

Inspect network connections and troubleshoot TCP or UDP services.

Packet analysis

Tcpdump

Capture and inspect packets directly from the command line.

Domain intelligence

WHOIS

Query domain registration information from a terminal.