150+ Linux Commands | An Alphabetical List With Syntax (Examples)
Linux has become an extremely popular operating system in recent years. It is a free, reliable, and secure system that is utilized for a variety of applications, including web servers and clusters for scientific computing. Linux's command-line interface enables users to interact with the system more effectively and powerfully than through a graphical user interface. It is open-source and similar to the Command Prompt application in Windows.
In this article, we will discuss the fundamentals of Linux commands, as well as some of the most popular Linux commands with their syntax and their usage.
Prerequisites
Before we move on to exploring the Linux commands there are a few prerequisites that should be taken care of:
-
Understanding of the command-line interface: As Linux commands are entered into a command-line interface, it is important to have a basic understanding of how to use it. This includes knowledge of how to navigate the file system, how to enter commands, and how to view the output.
-
Basic knowledge of Linux: Although these commands can be used on any Linux distribution, it is helpful to have a basic understanding of the Linux operating system. This includes knowledge of the file system structure, file contents, basic commands, package manager, and system administration. Linux has various package managers available in its system.
-
Access to a Linux system: In order to use these commands, you need access to a Linux system. This can be a physical machine or a virtual machine that is running Linux. There are also online platforms and virtual environments available that provide access to a Linux system.
-
User permissions: Depending on the command you want to run, you may need administrative privileges or root access. This can be granted by using the "sudo" command or logging in as the root user. You may also need file permissions before modifying them.
-
Familiarity with text editors: Some commands require the use of a text editor to edit configuration files or create scripts. It is helpful and important to have a basic understanding of text editors such as vi or nano.
-
Internet connectivity: These commands often require the installation of packages or updates. It is helpful to have internet connectivity to access the repositories and download the required files.
Commands in Linux
Linux commands are text-based instructions that can be used to interact with the Linux operating system. They are typed in the terminal or command-line interface and are used to perform a variety of tasks.
Most Linux commands follow a similar syntax, which consists of the command name followed by options and arguments. Options modify the behavior of the command, while arguments specify the input to the command. Many Linux commands have a help option that can be accessed by appending --help or -h to the command, which will display a list of available options and their usage.
Below we have discussed some of the most important and popular Linux commands arranged in alphabetical order.
A
addgroup command
The "addgroup" command is used to create a new group on the system.
Basic syntax: addgroup [groupname]
adduser command
The "adduser" command is used to create a new user account on the system. It is a symbolic link to the useradd command.
Basic syntax: adduser [username]
apt command
The "apt" command in Linux is a package management tool that is used to install, remove, and update software packages on Debian-based Linux distributions.
Basic syntax: sudo apt install git
alias Command
The "alias" command in Linux is used to create custom shortcuts for commonly used commands or to redefine existing commands in the current working directory.
Basic syntax: alias [alias-name]='[command]'
awk Command
The "awk" command in Linux is a powerful tool for text processing and manipulation. The "awk" command is commonly used in shell scripts and for command-line text-processing tasks.
Basic syntax: awk -F',' '{print $2}' [file-name]
apropos command
The "apropos" command in Linux is used to search the system's manual pages for a specific keyword.
Basic syntax: apropos [keyword]
atrm command
atrm command is used to remove/deletes jobs (identified by their job number) from at command queue:
Basic syntax: atrm [job number]
B
bash command
The "bash" command is the default shell for most Linux systems. It is used to launch a new instance of the Bash shell.
Basic syntax: bash [options] [file]
basename command
The "basename" command is used to extract the filename or directory name from a given path or URL. It is often used in shell scripts to manipulate filenames.
Basic syntax: basename [path] [suffix]
bzip2 command
The "bzip2" command is used to compress or decompress files using the bzip2 compression algorithm.
Basic syntax: bzip2 [options] [filename]
break command
The "break" command is used to exit a loop in a shell script. It is used in conjunction with the "for" or "while" commands to control program flow in the current directory.
Basic syntax: break [n]
C
cd command
It stands for "change directory" and is used to change the current working directory in the shell.
Basic syntax: cd [directory_path]
cat command
It is used to display the file contents in the terminal.
Basic syntax: cat [filename]
comm command
It is used to compare two sorted file contents line by line and display the lines that are common, unique, or different between the two files. The name "comm" is short for "compare".
Basic syntax: comm [option(s)] file1 file2
chmod command
It is used to change the file permissions of a file or parent directory. The mode specifies the new permissions that you want to set for the file/ parent directory. It specifies the name of the file or parent directory for which you want to change the permissions.
Basic syntax: chmod [options] mode file/parent directory
clear command
The "clear" command is used to clear the screen in the shell.
Basic syntax: clear
cp command
cp command is used for copying file contents and current directories from one location to another.
Basic syntax: cp [options] source_file destination
cut command
The "cut" command is used to extract columns or fields from a file or standard input in the current working directory.
Basic syntax: cut [options] file
D
date command
It displays the current date and time.
Basic syntax: date [OPTION]... [+FORMAT]
diff command
It compares two file contents and displays the differences between them.
Basic syntax: diff [OPTION]... FILE1 FILE2
dirname command
It displays the directory name of a given path.
Basic syntax: dirname [OPTION]... NAME
diff command
diff command is used to compare two files line by line. It can also be used to find the difference between two current working directories in Linux
Basic syntax: diff file1 file2
duff command
It quickly finds duplicate files present in the current working directory.
Basic syntax: duff [OPTION]... FILE...
E
echo command
Echo command prints a string of text to the terminal.
Basic syntax: echo [OPTION]... [STRING]...
eject command
It is used to eject removable media such as DVD/CD ROM or floppy disk from the system.
Basic syntax: eject /dev/cdrom
enable command
It is used to enable/disable shell builtin commands in the current directory.
Basic syntax: enable [OPTION]... [NAME]...
eval command
It evaluates a command or expression and executes it as if it were a part of the script.
Basic syntax: eval [ARGUMENTS]
exit command
It is used to exit or terminate the current terminal session. To exit the current terminal session run the following command:
Basic syntax: exit [N]
expand command
It converts tabs to spaces in an original file.
Basic syntax: expand [OPTION]... [FILE]...
F
false command
It returns a non-zero (false) exit status.
Basic syntax: false
factor command
It displays prime factors of specified integer numbers.
Basic syntax: factor [NUMBER]...
fold command
It wraps lines of text to a specified width in the current directory.
Basic syntax: fold [OPTION]... [FILE]...
free command
It displays the amount of free and used memory and disk space in the system.
Basic syntax: free [OPTION]...
ftp command
Transfers files to and from a remote server using the File Transfer Protocol (FTP).
Basic syntax: ftp [HOST]
fmt command
Used to convert text to a specified width by filling lines and removing new lines, displaying the output in the current directory.
Basic syntax: fmt [OPTION]... [FILE]...
fsck command
It checks and repairs a Linux file system.
Basic syntax: fsck [OPTION]... [DEVICE]
G
gzip command
The gzip command compresses and decompresses the file size.
Basic syntax: gzip [OPTION]... [FILE]...
gunzip command
It is used to compress or expand a file or a list of files in Linux. It accepts all the files having extension as .gz, .z, _z, -gz, -z , .Z, .taz or.tgz and replace the compressed file with the original file by default.
gunzip [Option] [archive name/file name]
grep command
It searches for a specified pattern and directory path in a file or input stream in the current directory.
Basic syntax: grep [OPTIONS] PATTERN [FILE]...
git command
git is a version control system and is used for tracking changes in source code.
Basic syntax: git [OPTIONS] COMMAND [ARGUMENTS]
gawk command
It is a powerful text-processing tool that is used for pattern scanning and processing.
Basic syntax: gawk [OPTIONS] [FILE]
grpck command
This command checks the integrity of the group files in the current directory and verifies that all entries are valid.
Basic syntax: grpck [OPTION] [FILE]
gpg command
It enables encryption and signing services as per the OpenPGP standard.
Basic syntax: gpg [OPTIONS] [FILES]
grpdel command
It is used to delete a existing group.
Basic syntax: groupdel [options] GROUP
groupmod command
It is used to modify or change the existing group on the Linux system.
Basic syntax: groupmod [option] GROUP
grpconv command
The grpconv command is a Linux command used to convert the /etc/gshadow file to the /etc/group file format. The /etc/group file contains the list of groups on the system, while the /etc/gshadow file contains the encrypted passwords for these groups.
Basic syntax: sudo grpconv
H
head command
The head command displays the first few lines of a file.
Basic syntax: head [OPTION]... [FILE]...
history command
It displays a list of previously executed commands.
Basic syntax: history [OPTION]... [ARGUMENTS]
halt command
It shuts down the system i.e. it halts the machine.
Basic syntax: halt [OPTIONS]
help command
It displays help information for a built-in shell command.
Basic syntax: help [COMMAND]
hexdump command
It displays the contents of a file in hexadecimal format.
Basic syntax: hexdump [OPTIONS] [FILE]
host command
The host command is a Linux command used to perform DNS (Domain Name System) lookups. The command queries the DNS servers and returns the IP address or the domain name associated with the provided hostname.
Basic syntax: host [options] [hostname]
hostid command
It is used to retrieve the numeric identifier (host ID) of the current host. The host ID is a unique identifier that is used by some software programs to generate license keys or to control access to specific features. It returns the host ID in hexadecimal format, with a length of 8 digits.
Basic syntax: hostid
hostname command
It displays or sets the hostname of the system.
Basic syntax: hostname [OPTION]... [NAME]
hostnamectl command
It is used to control and manage the hostname and related settings on a system.
Basic syntax: hostnamectl
hwclock command
It displays or sets the system hardware clock.
Basic syntax: hwclock [OPTIONS]
I
id command
It displays user and group information for the current user or specified user.
Basic syntax: id [OPTION]... [USERNAME]
if command
It is used to execute commands based on conditions. The ‘if COMMANDS‘ list is executed.In shell scripting, the if keyword is typically used with the fi keyword, which marks the end of the if block.
Basic syntax: if: if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi
ifconfig command
It is used to display or configure network interface parameters.
Basic syntax: ifconfig [INTERFACE] [OPTIONS]
iwconfig command
It is used to configure and display information about wireless network interfaces on a system. It is part of the wireless tools package and is commonly used for managing wireless network connections on Linux systems.
Basic syntax: iwconfig wlan0
info command
It displays documentation for a given topic in the Info format.
Basic syntax: info [OPTION]... [TOPIC]
init command
This command is the parent process of all processes on a Linux system. It is responsible for starting system services, setting the system run level, and managing the system's shutdown process.
Basic syntax: init [OPTION]... [RUNLEVEL]
ip command
This command displays or configures network interface parameters.
Basic syntax: ip [OPTIONS] OBJECT { COMMAND | help }
install command
It copies files and sets their permissions to the specified values.
Basic syntax: install [OPTION]... SOURCE... DESTINATION
ifup command
It enables a network interface.
Basic syntax: ifup [INTERFACE]
ifdown command
It disables a network interface.
Basic syntax: ifdown [INTERFACE]
iftop command
This command is used to monitor network bandwidth usage in real time. It displays the network usage for individual connections, as well as the total bandwidth usage for each network interface.
Basic syntax: iftop [options]
iptables command
It is a firewall utility used to configure the Linux kernel firewall.
Basic syntax: iptables [OPTIONS] [CHAIN] [RULE-SPECIFICATION]
J
jobs command
It shows the lists of the jobs running in the background or suspended.
Basic syntax: jobs [OPTIONS]
join command
This command in Linux is used to join lines of two files on a common field. It takes two input files, each containing sorted data on a specific field, and merges them into a single output file based on the matching field.
Basic syntax: join [OPTIONS] FILE1 FILE2
jexec command
It executes a command inside a jail. Note that this command may not be available on all Linux distributions, as it is primarily used in FreeBSD jails.
Basic syntax: jexec JID COMMAND [ARGUMENTS]
journalctl command
This command is used to view systemd, kernel and journal logs.It displays the paginated output. Therefore it is a bit easy to navigate through a lot of logs. It prints the log in chronological order with the oldest first.
Basic syntax: -- Logs begin at [date_time_stamp], end at [dat_time_stamp] [date_time_stamp] [host_name] kernel:
K
kill command
It sends a signal to a process to terminate it.
Basic syntax: kill [OPTIONS] PID
killall command
It sends a signal to all processes with a specified file name to terminate them.
Basic syntax: killall [OPTIONS] NAME
killall(5) command
It is a variant of the killall command that uses the System V init system. It sends a signal to all processes except those that are excluded, allowing the administrator to terminate all processes at once or to perform a clean shutdown of the system.
Basic syntax: killall5
kpartx command
It maps partitions on the system device.
Basic syntax: kpartx [OPTIONS] DEVICE
kmod command
It allows the users to manage kernel modules.
Basic syntax: kmod [OPTIONS] MODULE
klogd command
It is used to manage kernel log messages.
Basic syntax: klogd [OPTIONS]
kvm_stat command
It displays statistics about KVM (Kernel-based Virtual Machine).
Basic syntax: kvm_stat [OPTIONS]
L
last command
It is used to display information about recent system logins and user sessions. It shows a list of the most recent logins and logouts for each user, as well as the system reboot history.
Basic syntax: last [options] [username]
less command
It displays the contents of a source file one page at a time.
Basic syntax: less [OPTIONS] FILE
look command
It is used to search for words in a sorted file. It is a simple text search utility that displays lines beginning with a specified search string that occurs in a specified file.
look [options] [search-string] [file]
ls command
It shows the list of files and file names in the current directory.
Basic syntax: ls [OPTIONS] [DIRECTORY]
lsof command
It lists open the source files and the processes that opened them.
Basic syntax: lsof [OPTIONS] [FILE]
ln command
It creates links between files.
Basic syntax: ln [OPTIONS] SOURCE DEST
locate command
It searches for files in a database of file names and file paths.
Basic syntax: locate [OPTIONS] PATTERN
lpr command
It is used to submit files for printing.
Basic syntax: lpr -P myprinter -# 2 -o sides=two-sided-long-edge mydocument.pdf
logrotate command
This command rotates and compresses log files.
Basic syntax: logrotate [OPTIONS] CONFIGFILE
lsmod command
It is used to display the status of kernel modules in the system.
Basic syntax: lsmod [OPTIONS]
lshw command
It is a hardware probing utility that displays detailed information about the hardware configuration of a system. It is short for "list hardware" and is used to diagnose hardware problems or to obtain detailed information about the hardware components installed on a system.
Basic syntax: sudo lshw [options]
M
mkdir command
The mkdir command creates a new directory in the terminal screen after taking file permission. The name of the directory to be created using mkdir command is specified as an argument to the command.
Basic syntax: mkdir [OPTIONS] DIRECTORY
mount command
It mounts a filesystem.
Basic syntax: mount [OPTIONS] DEVICE MOUNTPOINT
more command
It displays the content of a file page by page.
Basic syntax: more [OPTIONS] FILE
man command
It is used to display the manual pages for commands, programs, and other Unix/Linux utilities. It provides a comprehensive reference guide for the various commands and utilities available on a Linux system.
Basic syntax: man [options] [command/program/utility]
mv command
This command moves or renames file names and directories.
Basic syntax: mv [OPTIONS] SOURCE DEST
mknod command
It creates a special file (e.g., a device file).
Basic syntax: mknod [OPTIONS] FILE TYPE [MAJOR MINOR]
modinfo command
It is is used to display information about a kernel module. A kernel module is a piece of code that can be loaded into or unloaded from the Linux kernel at runtime, and provides additional functionality or support for hardware devices.
Basic syntax: modinfo [options] [module-name]
N
nano command
This is a simple command-line text editor that is easy to use.
Basic syntax: nano [OPTIONS] FILE_NAME
nmap command
This command is a network exploration tool and security scanner that can be used to discover hosts and services on a computer network.
Basic syntax: nmap [OPTIONS] TARGET
nl command
It is used to add line numbers to text files, making it easier to reference specific lines of text.
Basic syntax: nl [OPTIONS] FILE
nohup command
This command is used to run a command or script in the background even after you log out.
Basic syntax: nohup COMMAND [OPTIONS] [ARGUMENTS] &
nice command
This command is used to launch a command with a specified priority level.
Basic syntax: nice [OPTIONS] COMMAND
netstat command
This command displays network status information about your system.
Basic syntax: netstat [OPTIONS]
netcat(nc) command
The netcat command in Linux is a versatile networking utility that can be used for a variety of purposes, including transferring files, port scanning, and debugging network protocols.
Basic syntax: nc [options] [host] [port]
O
openssl command
This command is used to provide a secure SSL/TLS communication between servers.
Basic syntax: openssl [OPTIONS] command [ARGS]
openvt command
It is used to open a new virtual terminal (VT) and run a command on it. This command is usually used to launch a text-based application or script that requires its own terminal window.
Basic syntax: openvt [options] [command]
objcopy command
It is used to copy and transform object files. An object file is a file that contains executable or object code that has been compiled from source code.
Basic syntax: objcopy [options] sourcefile destfile
P
passed command
The passwd command in Linux allows you to change the user password, lock accounts, expire passwords, and more.
Basic syntax: passwd [options] [username]
ping command
The ping command is used to test the connectivity between two hosts on a network.
Basic syntax: ping [options] <destination>
paste command
The paste command is a Linux command that is used to merge lines from multiple files.
Basic syntax: paste [options] [file1] [file2]...
pwd command
The pwd command is used to print the current working directory. pwd command is the short form for "print working directory".
Basic syntax: pwd [options]
ps command
The ps command is used to get information about the currently running processes on a Linux system.
Basic syntax: ps [options]
printenv command
It is used to display the values of environment variables in Linux.
Basic syntax: printenv [variable_name]
pushd command
The pushd command is used to add a directory to the top of the directory stack and change the current working directory to the new top directory.
Basic syntax: pushd [directory]
popd command
The popd command is used to remove the top directory from the directory stack and change the current working directory to the new top directory.
Basic syntax: popd [directory]
printf command
The printf command in Linux is used to format and print output to the terminal.
Basic syntax: printf format [argument]...
pkill command
The pkill command is used to send a signal (by default SIGTERM) to processes based on their name or other attributes.It is used to kill the process.
Basic syntax: pkill [options] pattern
Q
quota command
It is used to manage disk quotas on Linux systems.
Basic syntax: quota [options] [username]
quotacheck command
It is used to scan a file system for disk usage information and generate disk quota files.
Basic syntax: quotacheck [options] filesystem
R
read command
It is used to read a line from the standard input , and store it in a variable or a list of variables.
Basic syntax: read [options] [variable...]
route command
It is used to view and manipulate the IP routing table.
Basic syntax: route [options] [add/del] [destination] [netmask] [gateway]
rsync command
It is used to synchronize files and directories between two locations.
Basic syntax: rsync [options] source destination
rmdir command
It is used to remove empty directories.
Basic syntax: rmdir [options] directory
rm command
The rm command is used to remove files or directories. We can implement the rm command as follows:
Basic syntax: rm [options] file(s) or directory
reboot command
The reboot command is a Linux system command that is used to reboot or restart the system. It is typically used to initiate a system reboot after installing updates or making other changes to the system.
Basic syntax: reboot
rename command
It is used to rename multiple files or entire directories at once. It is particularly useful when you need to change the names of a large number of files with similar names.
Basic syntax: rename [options] 's/old_pattern/new_pattern/' files
S
screen command
The screen command is a powerful tool for managing multiple terminal sessions within a single shell window. It allows you to create, manage, and switch between multiple terminal sessions on a single machine or even multiple machines.
Basic syntax: screen [options] [command [arguments]]
scp command
This command secure copy files between hosts on a network.
Basic syntax: scp [options] source_file destination_file
sed command
It is basically stream editor for modifying files.
Basic syntax: sed [options] command [file]
shred command
This command overwrites and deletes the files from the absolute path to prevent recovery.
Basic syntax: shred [options] file
single command
The single command is not a standard Linux command. However, it is a command that can be used in some Linux distributions, such as Debian and Ubuntu, to boot the system into single-user mode.
ssh command
Secure shell for logging into remote machines.
Basic syntax: ssh [user@]hostname [command]
sudo command
It runs command lists with administrative privileges. It is used when you need to run something like a super user.
Basic syntax: sudo [options] command
sort command
It sort lines of text files.
Basic syntax: sort [options] [file]
shutdown command
It is used to shut down or restart a system.
Basic syntax: shutdown [options] [time] [message]
split command
This command split a file into pieces.
Basic syntax: split [options] input_file [prefix]
T
tail command
It displays and prints the last ten lines of a file.The tail command is also used for reading log files in real time.
Basic syntax: tail [options] [filename]
touch command
It creates an empty file or updates a file's modification time.
Basic syntax: touch [options] [filename]
tar command
It creates and extracts archive files.
Basic syntax: tar [options] [filename]
top command
It displays system resource usage and processes.
Basic syntax: top [options]
tee command
It reads from standard input and writes to standard output and files.
Basic syntax: tee [options] [filename]
tr command
It translates or deletes characters in the entire directory.
Basic syntax: tr [options] [string1] [string2]
tree command
It lists the contents of an entire directory in a tree-like format.
Basic syntax: tree [options] [directory]
time command
It is used to measure the execution time of a command. It displays the amount of system time, user time, and real time used by the command.
Basic syntax: time [options] command
timeout command
The timeout command is used to run a command with a time limit. If the command runs longer than the specified time limit, it is terminated.
Basic syntax: timeout [options] duration command
traceroute command
It is used to trace the route that an IP packet takes to reach a specified destination host. The Traceroute command provides information about the intermediate routers that the packet passes through before reaching its destination.
Basic syntax: traceroute [options] host
U
uptime command
The uptime command is used to show how long the system has been running, the current time, the number of users logged in, and the system load averages.
Basic syntax: uptime
unzip command
The unzip command is used to extract files from a ZIP archive.
Basic syntax: unzip [options] filename.zip
uname command
It is used to print certain system information, such as the name and version of the operating system. It can also be used to print information about the processor and machine hardware.
Basic syntax: uname [options]
uniq command
It is used to remove duplicate lines from a file or input stream. It compares adjacent lines and removes the duplicates.
Basic syntax: uniq [options] [file]
useradd command
It is used to create a new user account on a Linux system.
Basic syntax: useradd [options] username
uname command
It is used to print information about the system. The command can be used to display various information such as the operating system name, kernel release, processor type, and system architecture.
Basic syntax: uname [option]
userdel command
It is used to delete a user account and related files from the system. The command removes the user's home directory, user mail spool, and any other files associated with the user.
Basic syntax: userdel [options] username
V
vim command
The vim command is a text editor and stands for "Vi Improved" .It is an improved version of the vi editor. vim is highly configurable and can be used to edit all kinds of text files, including system configuration files, scripts, and source code.
Basic syntax: vim [options] [file]
vdir command
This command in Linux is a variation of the "ls" command, used to list the contents of a directory in a long format, but it displays the information in a vertical format instead of a horizontal format.
Basic syntax: vdir [OPTION]... [FILE]...
vi command
It is widely used text editor that is available on almost all Unix-based systems. It allows users to create and edit files in the terminal or console window.
Basic syntax: vi [options] [file]
W
watch command
This command repeatedly executes a command and displays the output in real time.
Basic syntax: watch [options] command
wc command
This command is used to count the number of lines, words, and characters in a file.
Basic syntax: wc [options] file
wget command
It used to download files from the Internet. It supports downloading over HTTP, HTTPS, and FTP protocols, and it can be used to recursively download entire websites.
Basic syntax: wget [options] [URL]
which command
This command shows the current location of a command.
Basic syntax: which command
who command
This command shows the users who are currently logged in.
Basic syntax: who [options]
whoami command
The whoami command in Linux prints the name of the current user.
Basic syntax: whoami [OPTION]...
whereis command
This command shows the location of a binary, source, and manual page files for a command.
Basic syntax: whereis command
X
xargs command
This command is used to build and execute command lines from standard input. It is commonly used to pass the output of one command as input to another command.
Basic syntax: xargs [options] command [arguments]
xxd command
The xxd command is used to create a hex dump of a given file or standard input, or convert a hex dump back into its original binary form. The command can be useful for viewing the contents of binary files and analyzing them.
Basic syntax: xxd [options] [infile [outfile]]
xz command
The xz command is a command-line tool used in Linux systems to compress and decompress files using the XZ format. The XZ format is a high-performance data compression algorithm that compresses files to a smaller size than other popular compression algorithms like gzip and bzip2.
Basic syntax: xz [OPTION]... [FILE]...
xdg-open command
The xdg-open command is a desktop-independent tool for opening files or URLs in the user's preferred application. It uses the freedesktop.org standards for opening files and URLs with the user's preferred applications, which makes it possible to use it in any desktop environment.
Basic syntax: xdg-open <file or URL>
Y
yes command
The "yes" command outputs a continuous stream of "y" (or another specified string) to the standard output.If the string is not specified, "y" is printed to the standard output. The output can be redirected to a file or piped to another command. The "yes" command is often used in shell scripts to automate user input or to simulate user interaction with a program.
Basic syntax: yes [string]
Z
zcat command
This command is used to display the contents of a compressed file without actually decompressing it.
Basic syntax: zcat [compressed file]
zip command
This command is used to compress one or more files into a zip archive.
Basic syntax: zip [options] [archive name] [files to compress]
zmore command
This command is similar to zcat, but it allows you to scroll through the contents of a compressed file one screen at a time.
Basic syntax: zmore [compressed file]
zless command
This command is similar to zmore, but it allows you to scroll through the contents of a compressed file one line at a time.
Basic syntax: zless [compressed file]
zgrep command
This command is used to search for a pattern in a compressed file.
Basic syntax: zgrep [options] [pattern] [compressed file]
If you find this article informative, we encourage you to share it with your peers. Here are other recommended readings to polish your knowledge of Linux:
- How To Copy A File in Linux | Linux cp Command | Syntax & Options
- How To Unzip A File In Linux | Unzip Syntax | 8 Unzip Commands
- How To Open A File In Linux Using 3 Different Approaches
- How To Delete A File In Linux | How To Remove A Directory
- How To Create A File In Linux: Touch, Cat, Echo, Printf Command
Login to continue reading
And access exclusive content, personalized recommendations, and career-boosting opportunities.
Comments
Add comment