List of Linux Bash Commands
List of Linux Bash Commands
com/trinib/Linux-Bash-Commands
▾ A to Z command list
Note
Use Ctrl+f to search keywords in desktop browsers, for mobile go to menu > find in page .
Table
│A│B│C│D│E│F│G│H│I│J│K│L│M│N│O│P│Q│R│S│T│U│V│W│X│Y│Z│
Command Description
access Check a user’s RWX(read, write and execute) permission for a file.
accton Used to turn on or turn off the process for accounting or change info process accounting file.
acpi Show information about the Advanced Configuration and Power Interface.
acpi_available Check if ACPI(Advanced Configuration and Power Interface) functionality exists on the system.
addr2line Used to convert addresses into file names and line numbers.
agetty An alternative Linux Getty that manages physical or virtual terminals to allow multi-user access
apm Show Advanced Power Management (APM) hardware info on older systems.
apropos Shows the list of all man pages containing a specific keyword.
apt Advanced Package Tool, a package management system for Debian and derivatives.
arecord Just like aplay, it’s a sound recorder and player for ALSA soundcard driver.
1 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
arecord Just like aplay, it’s a sound recorder and player for ALSA soundcard driver.
at Used to schedule command execution at specified date & time, reading commands from an input file.
autoconf Generate configuration scripts from a TEMPLATE-FILE and send the output to standard output.
awk A scripting language used for manipulating data and generating reports. Also used to find and replace text in a file(s).
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
biff Notify about incoming mail and sender’s name on a system running comsat server.
builtin Used to run shell builtin commands, make custom functions for commands extending their functionality.
bzdiff Used to call the diff program for bzip2 compressed files.
bzless Used to apply ‘less’ (show info one page at a time) to bzip2 compressed files.
bzmore Used to apply ‘more’ (an inferior version of less) to bzip2 compressed files.
2 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
cdrdao Used to write all the content specified to a file to a CD all at once.
col Filter reverse (and half-reverse) line feeds from the input.
command Used to execute a command with arguments ignoring shell function named command.
compress Used to compress one or more file(s) and replacing the originals ones.
3 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ctags Make a list of functions and macro names defined in a programming source file.
Concurrent Versions System. Used to track file versions, allow storage/retrieval of previous versions, and enables multiple
cvs
users to work on the same file.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
dd Used to convert and copy a file, create disk clone, write disk headers, etc.
dircolors Set colors for ‘ls’ by altering the LS_COLORS environment variable.
dirname Display pathname after removing the last slash and characters thereafter.
Used when the user wants to retrieve system’s hardware related information such as Processor, RAM(DIMMs), BIOS
dmidecode
detail, etc. of Linux system in a readable format.
4 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
dnssec-keygen Generate encrypted Secure DNS keys for a given domain name.
dnssec-
Produce domain key set from one or more DNS security keys generated by dnssec-keygen.
makekeyset
dnssec-signkey Sign a secure DNS keyset with key signatures specified in the list of key-identifiers.
dnssec-signzone Sign a secure DNS zonefile with the signatures in the specified list of key-identifiers.
domainname Show or set the name of current NIS (Network Information Services) domain.
Used to retrieve information or statistics form components of the system such as network connections, IO devices, or
dosfsck
CPU, etc.
dumpkeys Show information about the keyboard driver’s current translation tables.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
echo Send input string(s) to standard output i.e. display text on the screen.
edquota Used to edit filesystem quotas using a text editor, such as vi.
elvtune Used to set latency in the elevator algorithm used to schedule I/O activities for specified block devices.
Start the Enlightenment Sound Daemon (EsounD or esd). Enables multiple applications to access the same audio device
esd
simultaneously.
esddsp Used to reroute non-esd audio data to esd and control all the audio using esd.
esdmon Used to copy the sound being sent to a device. Also, send it to a secondary device.
5 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Used to create a list of functions and macros from a programming source file. These etags are used by emacs. For vi, use
etags
ctags.
ethtool Used to query and control network driver and hardware settings.
ex Interactive command
expand Convert tabs into spaces in a given file and show the output.
expect An extension to the Tcl script, it’s used to automate interaction with other applications based on their expected output.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
fc Used to list, edit or re-execute the commands previously entered into an interactive shell.
fetchmail Fetch mail from mail servers and forward it to the local mail delivery system.
fgrep Display lines from a file(s) that match a specified string. A variant of grep.
finger Display user data including the information listed in .planand .projectin each user’s home directory.
fmt Used to convert text to a specified width by filling lines and removing new lines, displaying the output.
for Expand words and run commands for each one in the resultant list.
6 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
gawk Used for pattern scanning and language processing. A GNU implementation of AWK language.
getent Shows entries from Name Service Switch Libraries for specified keys.
gpg Enables encryption and signing services as per the OpenPGP standard.
gpm It enables cut and paste functionality and a mouse server for the Linux console.
grep Searches input files for a given pattern and displays the relevant lines.
gs Invokes Ghostscript, and interpreter and previewer for Adobe’s PostScript and PDF languages.
gzexe Used compress executable files in place and have them automatically uncompress and run at a later stage.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
hash Shows the path for the commands executed in the shell.
7 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
hash Shows the path for the commands executed in the shell.
hexdump Shows specified file output in hexadecimal, octal, decimal, or ASCII format.
hostnamectl Provides a proper API used to control Linux system hostname and change its related settings.
htdigest Manage the user authentication file used by the Apache web server.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
iftop It is a network analyzing tool used by system administrators to view the bandwidth related stats.
inetd Extended internet services daemon, it starts the programs that provide internet services.
install Used to copy files to specified locations and set attributions during the install process.
iostat Shows statistics for CPU, I/O devices, partitions, network filesystems.
iotop Used to display and monitor the disk IO usage details and even gets a table of existing IO utilization by the process.
ipcrm Used to remove System V interprocess communication (IPC) objects and associated data structures.
ipcs Show information on IPC facilities for which calling process has read access.
iptables-restore Used to restore IP tables from data specified in the input or a file.
iwconfig Used to display the parameters, and the wireless statistics which are extracted from /proc/net/wireless.
8 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
isodump A utility that shows the content iso9660 images to verify the integrity of directory contents.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
join For each pair of input lines, join them using a command field and display on standard output.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
kbd_mode Set a keyboard mode. Without arguments, shows the current keyboard mode.
killall5 A SystemV killall command. Kills all the processes excluding the ones which it depends on.
klogd Control and prioritize the kernel messages to be displayed on the console, and log them through syslogd.
kudzu Used to detect new and enhanced hardware by comparing it with existing database. Only for RHEL and derivatives.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
last Shows a list of recent logins on the system by fetching data from /var/log/wtmp file.
lastb Shows the list of bad login attempts by fetching data from /var/log/btmpfile.
lastlog Displays information about the most recent login of all users or a specified user.
ld The Unix linker, it combines archives and object files. It then puts them into one output file, resolving external references.
less Displays contents of a fileone page at a time. It’s advanced than more command.
lftpget Uses lftop to retrieve HTTP, FTP, and other protocol URLs supported by lftp.
ln Create links between files. Links can be hard (two names for the same file) or soft (a shortcut of the first file).
9 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ln Create links between files. Links can be hard (two names for the same file) or soft (a shortcut of the first file).
lockfile Create semaphore file(s) which can be used to limit access to a file.
logout Performs the logout operation by making changes to the utmp and wtmp files.
logrotate Used for automatic rotation, compression, removal, and mailing of system log files.
look Shows any lines in a file containing a given string in the beginning.
lpadmin Used to configure printer and class queues provided by CUPS (Common UNIX Printing System).
lpc Line printer control program, it provides limited control over CUPS printer and class queues.
lpinfo Shows the list of available devices and drivers known to the CUPS server.
lpstat Displays status information about current classes, jobs, and printers.
lsblk Lists information about all available or the specified block devices.
lshw Used to generate the detailed information of the system’s hardware configuration from various files in the /proc directory.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
m4 Macro processor.
mailq Shows to list all emails queued for delivery (sendmail queue).
10 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
makemap Creates database maps used by the keyed map lookups in sendmail.
mdel, mdeltree Used to delete MS-DOS file. mdeltree recursively deletes MS-DOS directory and its contents.
merge Three-way file merge. Includes all changes from file2 and file3 to file1.
metamail For sending and showing rich text or multimedia email using MIME typing metadata.
mkfifo Used to create named pipes (FIFOs) with the given names.
mkmanifest Makes alist of file names and their DOS 8.3 equivalent.
mknod Create a FIFO, block (buffered) special file, character (unbuffered) special file with the specified name.
11 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
nslookup Used performs DNS queries. Read this article for more info.
12 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
Operator access, allows system administrators to grant users access to certain root operations that require superuser
op
privileges.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
Merge lines of files. Write to standard output, TAB-separated lines consisting of sequentially corresponding lines from each
paste
file.
patch Apply a patchfile (containing differences listing by diff program) to an original file.
pgrep List process IDs matching the specified criteria among all the running processes.
pkill Send kill signal to processes based on name and other attributes.
popd Removes directory on the head of the directory stack and takes you to the new directory on the head.
pushd Appends a given directory name to the head of the stack and then cd to the given directory.
13 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
python Computer programming language often used to build websites and software, automate tasks, and conduct data analysis.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
quota Shows disk usage, and space limits for a user or group. Without arguments, only shows user quotas.
quotastats Shows the report of quota system statistics gathered from the kernel.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
ram RAM disk device used to access the RAM disk in raw mode.
ranlib Generate index to the contents of an archive and store it in the archive.
rdate Set system date and time by fetching information from a remote machine.
rdev Set or query RAM disk size, image root device, or video mode.
rdist Remote file distribution client, maintains identical file copies over multiple hosts.
readelf Shows information about ELF (Executable and Linkable format) files.
14 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
rev Show contents of a file, reversing the order of characters in every line.
Acts as the server for rlogin.It facilitates remote login, and authentication based on privileged port numbers from trusted
rlogind
hosts.
rndc Name server control utility. Send command to a BIND DNS server over a TCP connection.
rpcgen An RPC protocol compiler. Parse a file written in the RPC language.
rpcinfo Shows RPC information. Makes an RPC call to an RPC server and reports the findings.
rpm A package manager for Linux distributions. Originally developed for RedHat Linux.
rshd A daemon that acts as a server for rsh and rcp commands.
rup Remote status display. Shows current system status for all or specified hosts on the local network.
ruptime Shows uptime and login details of the machines on the local network.
rusers Shows the list of the users logged-in to the host or on all machines on the local network.
rusersd The rsuerd daemon acts as a server that responds to the queries from rsuers command.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
sane-find-
Find SCSI and USB scanner and determine their device files.
scanner
15 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
scanner
sar Used to monitor Linux system’s resources like CPU usage, Memory utilization, I/O devices consumption, etc..
scanadf Retrieve multiple images from a scanner equipped with an automatic document feeder (ADF).
Read images from image acquisition devices (scanner or camera) and display on standard output in PNM (Portable
scanimage
aNyMap) format.
screen A window manager that enables multiple pseudo-terminals with the help of ANSI/VT100 terminal emulation.
script Used to make a typescript of everything displayed on the screen during a terminal session.
scriptreplay Used to replay a typescript/terminal_activity stored in the log file that was recorded by the script command.
sed Stream editor for filtering and transforming text (from a file or a pipe input).
It’s a mail router or an MTA (Mail Transfer Agent). sendmail support can send a mail to one or more recipients using
sendmail
necessary protocols.
setmetamode Define keyboard meta key handling. Without arguments, shows current meta key mode.
sha1sum Compute and check 160-bit SHA1 checksum to verify file integrity.
showkey Examines codes sent by the keyboard displays them in printable form.
shred Overwrite a file to hide its content (optionally delete it), making it harder to recover it.
size Lists section size and the total size of a specified file.
slocate Display matches by searching filename databases. Takes ownership and file permission into consideration.
16 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ssh An SSH client for logging in to a remote machine. It provides encrypted communication between the hosts.
A daemon that listens for reboot notifications from other hosts, and manages the list of hosts to be notified when the
statd
local system reboots.
Search a specified file and prints any printable strings with at least four characters and followed by an unprintable
strings
character.
sysklogd Linux system logging utilities. Provides syslogd and klogd functionalities.
syslogd Read and log system messages to the system console and log files.
systemctl This command can be used to start, stop, and check the status of system services.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
tac Concatenate and print files in reverse order. Opposite of cat command.
talk A two-way screen-oriented communication utility that allows two user to exchange messages simultaneously.
tar GNU version of the tar archiving utility. Used to store and extract multiple files from a single archive.
17 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Dump traffic on network. Displays a description of the contents of packets on a network interface that match the boolean
tcpdump
expression.
tee Read from standard input and write to standard output and files.
telnet Telnet protocol user interface. Used to interact with another host using telnet.
tftp User interface to the internet TFTP (Trivial File Transfer Protocol).
times Shows accumulated user and system times for the shell and it’s child processes.
tload Shows a graph of the current system load average to the specified tty.
tmpwatch Recursively remove files and directories which haven’t been accessed for the specified period of time.
tr Translate, squeeze, or delete characters from standard input and display on standard output.
tracepath Traces path to a network host discovering MTU (Maximum Transmission Unit) along this path.
traceroute Traces the route taken by the packets to reach the network host.
trap Trap function responds to hardware signals. It defines and creates handlers to run when the shell receives signals.
tree A recursive directory listing program that produces a depth-indented listing of files.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
ul Underline text.
ulimit Get and set user limits for the calling process.
18 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
username It provides a set of commands to fetch username and its configurations from the Linux host.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
vidmode Set the video mode for a kernel image. Displays current mode value without arguments. Alternative: rdev -v
vmstat Shows information about processes, memory, paging, block IO, traps, disks, and CPU activity.
Used by system administrators in order to monitor network parameters such as bandwidth consumption or maybe some
vnstat
traffic flowing in or out.
volname Returns volume name for a device formatted with an ISO-9660 filesystem. For example, CD-ROM.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
19 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
wait Waits for a specified process ID(s) to terminate and returns the termination status.
wall Display a message on the terminals all the users who are currently logged-in.
warnquota Send mail to the users who’ve exceeded their disk quota soft limit.
watch Runs commands repeatedly until interrupted and shows their output and errors.
wc Print newline, word, and byte count for each of the specified files.
whereis Locate the binary, source, and man page files for a command.
which For a given command, lists the pathnames for the files which would be executed when the command runs.
whoami Displays the username tied to the current effective user ID.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
xargs Runs a command using initial arguments and then reads remaining arguments from standard input.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
ypcat Shows the NIS map (or database) for the specified MapName parameter.
yppasswdd Acts as a server for the yppasswd command. Receives and executes requests.
yppoll Shows the ID number or version of NIS map currently used on the NIS server.
ypserv A daemon activated at system startup. It looks for information in local NIS maps.
20 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ypwhich Shows the hostname for NIS server or master server for a given map.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Command Description
zic Creates time conversion information files using the specified input files.
zless Displays information of a compressed file (using less command) on the terminal one screen at a time.
zmore Displays output of a compressed file (using more command) on the terminal one page at a time.
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
▾ Quick cheatsheet
Note
• Both short and long options were incorporated for educational purposes, allowing users to choose the preferred format.
• It's important to note that not all commands have both short and long options. Some commands may only have short options, while
others may only have long options.
Contents
• Command Information
• Command History
• Navigating Directories
• Creating Directories
• Moving Directories
• Deleting Directories
• Creating Files
• Standard Output, Error and Input
• Moving Files
• Deleting Files
• Reading Files
• Sorting Files
• File Permissions
21 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
• Finding Files
• Find in Files
• Replace in Files
• File Editor
• Symbolic Links
• Compressing Files
• Decompressing Files
• Packages
• Disk Usage
• Memory Usage
• Shutdown and Reboot
• Identifying Processes
• Process Priority
• Killing Processes
• Date & Time
• Scheduled Tasks
• User Mangement
• HTTP Requests
• Network Troubleshooting
• DNS
• Hardware
• System Information
• Terminal Multiplexers
• Secure Shell Protocol (SSH)
• Secure Copy
• Bash Profile
• Bash Script
Command Information
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Command History
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Navigating Directories
22 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Navigating Directories
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Creating Directories
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Moving Directories
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Deleting Directories
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Creating Files
23 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
read foo # Read from standard input and write to the variable foo
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Moving Files
rsync -z|--compress -v|--verbose /foo.txt /bar # Copy file quickly if not changed
rsync -z|--compress -v|--verbose /foo.txt /bar.txt # Copy and rename file quickly if not changed
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Deleting Files
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Reading Files
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Sorting Files
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
File Permissions
24 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
6 4 4 User can read and write, everyone else can read (Default file permissions)
7 5 5 User can read, write and execute, everyone else can read and execute (Default directory permissions)
• u - User
• g - Group
• o - Others
• a - All of the above
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Finding Files
Find binary files for a command.
25 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
find /path -type f -mtime +30 Find files that haven't been modified in 30 days
find /path -type f -mtime +30 -delete # Delete files that haven't been modified in 30 days
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Find in Files
Replace in Files
sed 's/fox/bear/g' foo.txt # Replace fox with bear in foo.txt and output to console
sed 's/fox/bear/gi' foo.txt # Replace fox (case insensitive) with bear in foo.txt and output to console
sed 's/red fox/blue bear/g' foo.txt # Replace red with blue and fox with bear in foo.txt and output to console
sed 's/fox/bear/g' foo.txt > bar.txt # Replace fox with bear in foo.txt and save in bar.txt
sed -i|--in-place 's/fox/bear/g' foo.txt # Replace fox with bear and overwrite foo.txt
sed -i|--in-place '/red fox/i\blue bear' foo.txt # Insert blue bear before red fox and overwrite foo.txt
sed -i|--in-place '/red fox/a\blue bear' foo.txt # Insert blue bear after red fox and overwrite foo.txt
sed -i|--in-place '10s/find/replace/' foo.txt # Replace the 10th line of the file
sed -i|--in-place '10,20s/find/replace/' foo.txt # Replace in the file 10-20 lines
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
File Editor
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Symbolic Links
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Compressing Files
zip
Compresses one or more files into *.zip files.
26 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
zip foo.zip /bar.txt /baz.txt # Compress bar.txt and baz.txt into foo.zip
zip foo.zip /{bar,baz}.txt # Compress bar.txt and baz.txt into foo.zip
zip -r|--recurse-paths foo.zip /bar # Compress directory bar into foo.zip
gzip
Compresses a single file into *.gz files.
gzip /bar.txt foo.gz # Compress bar.txt into foo.gz and then delete bar.txt
gzip -k|--keep /bar.txt foo.gz # Compress bar.txt into foo.gz
tar -c
Compresses (optionally) and combines one or more files into a single *.tar, *.tar.gz, *.tpz or *.tgz file.
tar -c|--create -z|--gzip -f|--file=foo.tgz /bar.txt /baz.txt # Compress bar.txt and baz.txt into foo.tgz
tar -c|--create -z|--gzip -f|--file=foo.tgz /{bar,baz}.txt # Compress bar.txt and baz.txt into foo.tgz
tar -c|--create -z|--gzip -f|--file=foo.tgz /bar # Compress directory bar into foo.tgz
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Decompressing Files
unzip
gunzip
gunzip foo.gz # Unzip foo.gz into current directory and delete foo.gz
gunzip -k|--keep foo.gz # Unzip foo.gz into current directory
tar -x
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Packages
27 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
cd sourcecode
./configure
make
make install
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Disk Usage
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Memory Usage
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Identifying Processes
sleep 30 & # Sleep for 30 seconds and move the process into the background
jobs # List all background jobs
jobs -p # List all background jobs with their PID
lsof # List all open files and the process using them
lsof -itcp:4000 # Return the process listening on port 4000
28 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Process Priority
Process priorities go from -20 (highest) to 19 (lowest).
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Killing Processes
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
date -s "02 DEC 2020 12:02:02" # Manually change date and time
dpkg-reconfigure tzdata # Change date/timezone
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Scheduled Tasks
* * * * *
Minute, Hour, Day of month, Month, Day of the week
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
29 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
User Management
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
HTTP Requests
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Network Troubleshooting
ping example.com # Send multiple ping requests using the ICMP protocol
ping -c 10 -i 5 example.com # Make 10 attempts, 5 seconds apart
traceroute example.com # List all servers the network traffic goes through
mtr -w|--report-wide example.com # Continually list all servers the network traffic goes through
mtr -r|--report -w|--report-wide -c|--report-cycles 100 example.com # Output a report that lists network traffic 100 times
nmap 0.0.0.0 # Scan for the 1000 most common open ports on localhost
nmap 0.0.0.0 -p1-65535 # Scan for open ports on localhost between 1 and 65535
nmap 192.168.4.3 # Scan for the 1000 most common open ports on a remote IP address
nmap -sP 192.168.1.1/24 # Discover all machines on the network by ping'ing them
30 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
DNS
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Hardware
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
System Information
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Terminal Multiplexers
Start multiple terminal sessions. Active sessions persist reboots. tmux is more modern than screen .
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
ssh hostname # Connect to hostname using your current user name over the default SSH port 22
ssh -i foo.pem hostname # Connect to hostname using the identity file
ssh user@hostname # Connect to hostname using the user over the default SSH port 22
ssh user@hostname -p 8765 # Connect to hostname using the user over a custom port
31 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
ssh user@hostname -p 8765 # Connect to hostname using the user over a custom port
ssh ssh://user@hostname:8765 # Connect to hostname using the user over a custom port
Set default user and port in ~/.ssh/config , so you can just enter the name next time:
$ cat ~/.ssh/config
Host name
User foo
Hostname 127.0.0.1
Port 8765
$ ssh name
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Secure Copy
scp foo.txt ubuntu@hostname:/home/ubuntu # Copy foo.txt into the specified remote directory
scp ubuntu@hostname:/home/ubuntu/foo.txt /C:\Users\Admin # Copy foo.txt from the specified remote directory
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Bash Profile
• bash - .bashrc
• zsh - .zshrc
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Bash Script
Variables
#!/bin/bash
Environment Variables
#!/bin/bash
32 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Functions
#!/bin/bash
greet() {
local world="World"
echo "$1 $world"
return "$1 $world"
}
greet "Hello"
greeting=$(greet "Hello")
Exit Codes
#!/bin/bash
Conditional Statements
Boolean Operators
• $foo - Is true
• !$foo - Is false
Numeric Operators
• -eq - Equals
• -ne - Not equals
• -gt - Greater than
• -ge - Greater than or equal to
• -lt - Less than
• -le - Less than or equal to
• -e foo.txt - Check file exists
• -z foo - Check if variable exists
String Operators
• = - Equals
• == - Equals
• -z - Is null
• -n - Is not null
• < - Is less than in ASCII alphabetical order
• > - Is greater than in ASCII alphabetical order
If Statements
#!/bin/bash
[[
if [[$foo = 'bar']]; then
echo 'one'
elif [[$foo = 'bar']] || [[$foo = 'baz']]; then
echo 'two'
elif [[$foo = 'ban']] && [[$USER = 'bat']]; then
echo 'three'
else
33 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
else
echo 'four'
fi
]]
Inline If Statements
#!/bin/bash
While Loops
#!/bin/bash
[
declare -i counter
counter=10
while [$counter -gt 2]; do
echo The counter is $counter
counter=counter-1
done
]
For Loops
#!/bin/bash
for i in {0..10..2}
do
echo "Index: $i"
done
for filename in *;
do
echo "Content: " >> $filename
done
Case Statements
#!/bin/bash
case $weather in
sunny | warm ) echo "Nice weather: " $weather
;;
cloudy | cool ) echo "Not bad weather: " $weather
;;
rainy | cold ) echo "Terrible weather: " $weather
;;
* ) echo "Don't understand"
;;
esac
Inspired by RehanSaeed/Bash-Cheat-Sheet
ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ
Special characters
34 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
▾ Special characters
Char. Description
Escape [backslash]. A quoting mechanism for single characters. It preserves the literal value of the next character that follows,
\
with the exception of newline.
Pipe. This is a method of chaining commands together. Connects the output (stdout) of command1 to the input (stdin) of
|
command2. Each command reads the previous command’s output.
|& This operator connects the output (stdout) and error (stderr) of command1 to the input (stdin) of command2.
The OR operator is used to chain commands. It will execute the first command then stop if successful, if not, it will proceed pass
||
failed commands until one is successful and stop.
The AND operator is used to chain commands. It will execute commands only if the first command is successful and proceed
&&
until one fails.
; Command separator [semicolon]. Used to separate multiple commands and output all successful and failed ones.
& Run job in background [and]. A command followed by an & will run in the background.
>, >>,
Redirect a command's standard output (stdout) or input (stdin) into a file.
<
&>,
Redirects a command's both standard output (stdout) and error (stderr) into a file.
>&
>| Force redirection (even if the noclobber option is set). This will forcibly overwrite an existing file.
Partial quoting [double quotes]. Protects the text inside them from being split into multiple words or arguments, yet allow
"
substitutions to occur, meaning most other special characters is usually prevented.
. Source command [period]. To evaluate commands in the current execution context. This is a bash builtin.
"As a component of a filename. When working with filenames, a leading dot is the prefix of a "hidden" file, a file that an ls will
└─>
not normally show.
└─> Character match. When matching characters, as part of a regular expression, a "dot" matches a single character.
Full quoting [single quotes]. Protects the text inside them so that it has a literal meaning. This is a stronger form of quoting than
'
double quotes.
# Comment [number sign]. Lines in files beginning with a # (with the exception of #!) are comments and will not be executed.
Reverse (or negate) [exclamation]. The ! operator inverts the exit status of the command to which it is applied. It also inverts the
!
meaning of a test operator.
Wild card [asterisk]. The * character serves as a "wild card" for filename expansion in globbing. By itself, it matches every
*
filename in a given directory.
35 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Wild card [question mark]. The ? character serves as a single-character "wild card" for filename expansion in globbing, as well as
?
representing one character in an extended regular expression.
└─> Test operator. Within certain expressions, the ? indicates a test for a condition.
{} Inline group [curly brackets]. Commands inside the curly braces are treated as if they were one command.
Subshell group [parentheses]. Commands within are executed in a subshell (a new process) Used much like a sandbox, if a
()
command causes side effects (like changing variables), it will have no effect on the current shell.
└─> Array element. Brackets set off the numbering of each element.
└─> Range of characters. As part of a regular expression, brackets delineate a range of characters to match.
Test/Evaluate [double brackets] a condition expression to determine whether true or false. It is more flexible than the single-
[[ ]]
bracket [ ] test.
(( )) Arithmetic expression [double parentheses]. Characters such as +, -, *, and / are mathematical operators used for calculations.
Null command [colon]. This is the shell equivalent of a "NOP" (no op, a do-nothing operation). It may be considered a synonym
:
for the shell builtin true.
;; Terminator [double semicolon]. Only used in case constructs to indicate the end of an alternative.
Whitespace. This is a tab, newline, vertical tab, form feed, carriage return, or space. Bash uses whitespace to determine where
""
words begin and end.
$ Variable substitution. A $ prefixing a variable name indicates the value the variable holds
└─> End-of-line. In a regular expression, a "$" addresses the end of a line of text.
$$ The process number of the current shell. For shell scripts, this is the process ID under which they are executing.
Expands to the current option flags as specified upon invocation, by the set builtin command, or those set by the shell itself
$-
(such as the -i option).
$0 Used to reference the name of the current shell or current shell script.
These variables correspond to the arguments with which a script was invoked. Here n is a positive decimal number
$n
corresponding to the position of an argument (the first argument is $1, the second argument is $2, and so on).
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
▾ Keyboard controls
36 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
▾ Keyboard controls
Key Function
Cursor Movement
Text Editing
Alt+R Revert any changes to a previously executed command that's being edited
Alt+. Fetch and paste the last word at end of a command from previous commands
Ctrl+T Reverse the position of the character the cursor is on with the previous character
Alt+T Reverse the position of the word the cursor is in with the previous word
Alt+U Capitalize every character from cursor left to right to the end of one word
Alt+L Uncapitalize every character from cursor left to right to the end of one word
Command History
Process Control
Terminal Control
Ctrl+O Accept the current line for execution and fetch the next command
Ctrl+X (twice) Toggle cursor between current position and beginning of the line
37 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Ctrl+Shift+C Copy
Ctrl+Shift+V Paste
Some of these shortcuts may vary depending on your terminal and system.
Key Function
Movement
Editing
Alt+A Start text selection (can be used with Ctrl+K to cut specific text)
Ctrl+W Start forward search (press Alt+W to search for the same term again)
File Operations
Miscellaneous
38 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Key Function
Movement
h Move left
j Move down
k Move up
l Move right
Ctrl+b Page up
Editing
39 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Visual Mode
Text Objects
File Operations
:q Quit Vim
Multiple Files
:sp filename Open a file in a new buffer and split the window horizontally
:vsp filename Open a file in a new buffer and split the window vertically
Macros
40 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
Tabs
Miscellaneous
ʀᴇᴛᴜʀɴ ᴛᴏ ᴛᴏᴩ
Usage (Online)
Terminal :
curl cht.sh/keyword
# or
curl cheat.sh/keyword
Browser :
https://cht.sh/keyword
41 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
or
https://cheat.sh/keyword
Run :
cht.sh keyword
https://cht.sh/:help
A complete beginner's guide to learning shell scripting from scratch, with videos, practice scenarios,
shell-scripting-tutorial
and project ideas.
Shell Cheat Sheet A detailed and organized shell scripting cheat sheet for quick reference.
A comprehensive collection of 1000+ DevOps bash scripts for AWS, GCP, Kubernetes, Docker, CI/CD,
DevOps Bash Tools
databases, and more.
Bash Booster A modular bash framework that simplifies the process of writing bash scripts.
A collection of pure bash snippets for common tasks like string manipulation, file handling, etc., with
pure-bash-bible
no external dependencies.
A list of awesome shell tools and resources, including libraries and scripts for enhancing the
awesome-shell
command-line experience.
cli-apps A curated list of (mainly) CLI/TUI applications with source data organized into CSV files.
awesome-cli A curated list of awesome resources for building immersive CLI experiences.
awesome-cli A simple command line tool to give you a fancy command line interface to dive into Awesome lists.
shell_gpt A command-line productivity tool powered by AI large language models like GPT-4.
42 of 43 5/4/2025, 8:17 PM
GitHub - trinib/Linux-Bash-Commands: :godmode: Ultimate list of Lin... https://github.com/trinib/Linux-Bash-Commands
shell_gpt A command-line productivity tool powered by AI large language models like GPT-4.
Warp is a modern, Rust-based terminal with AI built in so you and your team can build great
warp
software, faster.
plandex AI driven development in your terminal. Designed for large, real-world tasks.
terminals-are-sexy A curated list of Terminal frameworks, plugins, and resources for CLI lovers.
43 of 43 5/4/2025, 8:17 PM