Linux Commands

Linux is a Unix-Like operating system. All the Linux/Unix commands are run in the terminal provided by the Linux system. This terminal is just like command prompt of Windows OS. Linux/Unix commands are case-sensitive. The terminal can be used to accomplish all Administrative tasks. This includes package installation, file manipulation, and user management. Linux terminal is user-interactive. The terminal outputs the results of commands which are specified by the user itself. Execution of typed command is done only after you press the Enter key.

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
 
 



Commands Description

access Used to check whether the calling program has access to a specified file. It can be used to check whether a file exists or not
acpi Used to display the battery status and other ACPI information
acpi_available Tests whether ACPI (Advanced Configuration and Power Interface) subsystem is available or not
alias Instructs the shell to replace one string with another string while executing the commands
apt Provides a high-level CLI (Command Line Interface) for the package management system and is intended as an interface for the end user which enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-cache and apt-get
apt-get It is a command-line tool which helps in handling packages in Linux
aptitude Opens up a highly built-in interface to interact with the package manager of the machine
arch Used to print the computer architecture
aspell Used as a spell checker in Linux
awk It is a scripting language used for manipulating data and generating reports

banner Used to print the ASCII character string in large letter to standrad output
basename It strips directory information and suffixes from file names i.e. it prints the file name NAME with any leading directory components removed
bc Used for command line calculator
bg Used to place foreground jobs in background
biff A mail notification system for unix that notifies the user at the command line when new mail arrives and tells from whom it is
break Used to terminate the execution of for loop, while loop and until loop
builtin Used to run a shell builtin, passing it arguments(args), and also to get the exit status
bzcmp Used to invoke the cmp utility on bzip2 compressed files
bzdiff Used to compare the bzip2 compressed files
bzgrep Used to search for a pattern or an expression but inside a bzip2-compressed file
bzip2 Used to compress and decompress the files
bzless It does not have to read the entire input file before starting, so with a large file, it starts up faster

cal Used to see the calendar of a specific month or a whole year. By default, it shows current month’s calendar as output
case It is the best alternative when we had to use multiple if/elif on a single variable
cat Reads data from file and gives their content as output. It helps us to create, view, concatenate files
ccrypt It is a command line tool for encryption and decryption of data
cd Known as change directory command. It is used to change current working directory
chage Used to view and change the user password expiry information
chattr It is a file system command which is used for changing the attributes of a file in a directory
chmod Used to change the access mode of a file
chpasswd Used to change password for multiple users at a time
cksum Used to display a CRC(Cyclic Redundancy Check) value, the byte size of the file and the name of the file to standard output
clear Used to clear the terminal screen
cmp Used to compare the two files byte by byte and helps you to find out whether the two files are identical or not
comm Compares two sorted files line by line and write to standard output; the lines that are common and the lines that are unique
compress Used to reduce the file size. After compression, the file will be available with an added .Z extension
continue Used to skip the current iteration in for, while and until loop
cp Used to copy files or group of files or directory
cron A software utility, offered by Linux-like operating system which automates the scheduled task at a predetermined time
crontab A list of commands that you want to run on a regular schedule, and also the name of the command used to manage that list
curl A tool to transfer data to or from a server, using any of the supported protocols
cut For cutting out the sections from each line of files and writing the result to standard output

date Used to display the system date and time. It is also used to set date and time of the system
dc Used to evaluate arithmetic expressions. It evaluates expressions in the form of a postfix expression
dd It is a command-line utility for Unix and Unix-like operating systems whose primary purpose is to convert and copy files
df Used to display information related to file systems about total space and available space
diff Used to display the differences in the files by comparing the files line by line
diff3 Used to compare the three files line by line
dir Used to list the contents of a directory
dirname Used to remove the trailing forward slahes “/” from the NAME and prints the remaining portion
disable Used to stop the the printers or classes
dmesg Used to examine the kernel ring buffer and print the message buffer of kernel
dos2unix Converts a DOS text file to UNIX format
du Used to track the files and directories which are consuming excessive amount of space on hard disk drive

echo Used to display line of text/string that are passed as an argument
eject It allows ejecting a removable media (typically a CD-ROM, floppy disk, tape, or JAZ or ZIP disk) using the software
emacs It is a editor having simple user interface. Also, there is no insert mode in this editor. It only have editing mode.
enable Used to start the printers or classes
env Used to either print environment variables. It is also used to run a utility or command in a custom environment
eval Built-in command used to execute arguments as a shell command
ex It is a text editor in Linux which is also termed as the line editor mode of the vi editor
exit Used to exit the shell where it is currently running
expand Allows you to convert tabs into spaces in a file and when no file is specified it reads from standard input
expect This command or scripting language works with scripts that expect user inputs. It automates the task by providing inputs
export It is bash shell BUILTINS commands, which means it is part of the shell. It marks an environment variables to be exported to child-processes
expr It evaluates a given expression and displays its corresponding output

factor Used to print the prime factors of the given numbers, either given from command line or read from standard input
fc Used to list, edit or re-execute the commands previously entered into an interactive shell
fg Used to put a background job in foreground
fgrep Used to search for the fixed-character strings in a file
find Used to find files and directories and perform subsequent operations on them
fmt Works as a formatter for simplifying and optimizing text files
fold It wraps each line in an input file to fit a specified width and prints it to the standard output
for Used to repeatedly execute a set of command for every element present in the list
free Displays the total amount of free space available along with the amount of memory used and swap memory in the system, and also the buffers used by the kernel
Fun Used to draw various type of patterns on the terminal
function Used to create functions or methods



grep Searches a file for a particular pattern of characters, and displays all lines that contain that pattern
groupadd Used to create a new user group
groupdel Used to delete a existing group
groupmod Used to modify or change the existing group on Linux system
groups Groups are the collection of users. Groups make it easy to manage users with the same security and access privileges
gzip This command compresses files. Each single file is compressed into a single file.

halt Used to instruct the hardware to stop all the CPU functions. Basically, it reboots or stops the system.
Head Prints the top N number of data of the given input
help Displays information about shell built-in commands
hexdump Used to filter and display the specified files, or standard input in a human readable specified format
history Used to view the previously executed command
host Used for DNS (Domain Name System) lookup operations
hostid Used to displays the Host’s ID in hexadecimal format
hostname Used to obtain the DNS(Domain Name System) name and set the system’s hostname or NIS(Network Information System) domain name.
hwclock Utility for accessing the hardware clock, also called Real Time Clock (RTC)

if Used to execute commands based on conditions
ifconfig Used to configure the kernel-resident network interfaces.
ipcs Shows information on the inter-process communication facilities for which the calling process has read access
iptables Used to set up and maintain tables for the Netfilter firewall for IPv4, included in the Linux kernel

join It is a command line utility for joining lines of two files based on a key field present in both the files

kill Used to terminate processes manually. kill command sends a signal to a process which terminates the process

less Used to read contents of text file one page(one screen) per time
ln Used to create links between files
locate Used to find the files by name
lsmod Used to display the status of modules in the Linux kernel. It results in a list of loaded modules

man Used to display the user manual of any command that we can run on the terminal
md5sum To verify data integrity using MD5 (Message Digest Algorithm 5)
mkdir Allows the user to create directories. This command can create multiple directories at once
more Used to view the text files in the command prompt, displaying one screen at a time in case the file is large (For example log files)
mv Used to move one or more files or directories from one place to another in file system like UNIX

netstat Displays various network related information such as network connections, routing tables, interface statistics, masquerade connections, multicast memberships, etc.
nslookup It is a network administration tool for querying the Domain Name System (DNS) to obtain domain name or IP address mapping or any other specific DNS record



od Used to convert the content of input in different formats with octal format as the default format

passwd Used to change the user account passwords
paste Used to join files horizontally (parallel merging) by outputting lines consisting of lines from each file specified, separated by tab as delimiter, to the standard output
ping Used to check the network connectivity between host and server/host
poweroff Sends an ACPI signal which instructs the system to power down
printf Used to display the given string, number or any other format specifier on the terminal window
ps Used to list the currently running processes and their PIDs along with some other information depends on different options
pwd It prints the path of the working directory, starting from the root

rcp Used to copy files from one computer to another computer
reboot Instructs the system to restart or reboot
return Used to exit from a shell function.
rm Used to remove objects such as files, directories, symbolic links and so on from the file system like UNIX

sar Used to monitor Linux system’s resources like CPU usage, Memory utilization, I/O devices consumption, etc.
sdiff Used to compare two files and then writes the results to standard output in a side-by-side format
sed Used for finding, filtering, text substitution, replacement and text manipulations like insertion, deletion search etc.
select Used to create a numbered menu from which a user can select an option
seq Used to generate numbers from FIRST to LAST in steps of INCREMENT
shutdown Used to shutdown the system in a safe way
sleep Used to create a dummy job. A dummy job helps in delaying the execution
sort Used to sort a file, arranging the records in a particular order
sudo Used as a prefix of some command that only superuser are allowed to run
systemctl Used to examine and control the state of “systemd” system and service manager

Tail Prints the last N number of data of the given input
tar Used to create Archive and extract the Archive files
tee Reads the standard input and writes it to both the standard output and one or more files
time Used to execute a command and prints a summary of real-time, user CPU time and system CPU time spent by executing a command when it terminates
touch Used to create, change and modify timestamps of a file
tr It is a command line utility for translating or deleting characters
Tree A recursive directory listing program that produces a depth-indented listing of files

uname Displays the information about the system
unexpand Converts each spaces into tabs writing the produced output to the standard output
uniq It is a command line utility that reports or filters out the repeated lines in a file
unix2dos Converts a Unix text file to DOS format
until Used to execute a set of commands as long as the final command in the ‘until’ Commands has an exit status which is not zero
Uptime Used to find out how long the system is active (running)

vmstat It is a performance monitoring command of the system as it gives the information about processes, memory, paging, block IO, disk and CPU scheduling

wc Used to find out number of lines, word count, byte and characters count in the files specified in the file arguments
Wget Used to download files from the server even when the user has not logged on to the system and it can work in background without hindering the current process
which Used to locate the executable file associated with the given command by searching it in the path environment variable
while Used to repeatedly execute a set of command as long as the COMMAND returns true
who Used to get information about currently logged in user on to system
whoami Displays the username of the current user when this command is invoked

xargs Used to build and execute commands from standard input. It converts input recieved from standard input into arguments of a command

yes Used to print a continous output stream of given STRING. If STRING is not mentioned then it prints ‘y’

zip It is a compression and file packaging utility for Unix. Each file is stored in single .zip {.zip-filename} file with the extension .zip

Recent Articles on Linux/Unix!

More on Linux Commands:



My Personal Notes arrow_drop_up


Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.