0% found this document useful (0 votes)
6 views

Linux Commands

Uploaded by

mussabazhari88
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Linux Commands

Uploaded by

mussabazhari88
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Linux Commands

Read
Courses
Video


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 the 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
Used to check whether the calling program has access to a specified
access file. It can be used to check whether a file exists or not
Used to turn on or turn off the process for accounting or change info
accton process accounting file
aclocal Used to automatically generate aclocal.m4 files from configure.in file
acpi Used to display the battery status and other ACPI information
Tests whether ACPI (Advanced Configuration and Power Interface)
acpi_available subsystem is available or not
It provides intelligent power management on a system and is used to
acpid notify the user-space programs about the ACPI events
addr2line Used to convert addresses into file names and line numbers
It is a Linux version of getty, which is a Unix program running on a
host computer that manages physical or virtual terminals to allow
agetty multi-user access
Instructs the shell to replace one string with another string while
alias executing the commands
It is a command-line mixer for ALSA(Advanced Linux Sound
amixer Architecture) sound-card driver
It is a command-line audio player for ALSA(Advanced Linux Sound
aplay Architecture) sound card drivers.
Used to play standard MIDI(Musical Instrument Digital Interface)
files, by sending the content of a MIDI file to an ALSA(Advanced
aplaymidi Linux Sound Architecture) MIDI port
It helps the user when they don’t remember the exact command but
knows a few keywords related to the command that define its uses or
apropos functionality
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 apt-get
apt-get It is a command-line tool which helps in handling packages in Linux
Opens up a highly built-in interface to interact with the package
aptitude manager of the machine
ar Used to create, modify and extract the files from the archives
arch Used to print the computer architecture
It manipulates the System’s ARP cache. It also allows a complete
arp dump of the ARP cache
aspell Used as a spell checker in Linux
It is a job scheduler daemon that runs jobs scheduled for later
atd execution
Used to remove the specified jobs. To remove a job, its job number is
atrm passed in the command
atq It displays the list of pending jobs which are scheduled by the user
autoconf Used in Linux to generate configuration scripts
Used to create a template file of C “#define” or any other template
autoheader header for configure to use
Used for automatically generating Makefile.in files compliant with the
automake set GNU Coding Standards
Used to create automatically buildable source code for Unix-like
autoreconf systems
Used to update configure.in file in our Linux system to a newer
autoupdate Autoconf.
It is a scripting language used for manipulating data and generating
awk reports

banner Used to print the ASCII character string in large letter to standard output

It strips directory information and suffixes from file names i.e. it prints the
basename
file name NAME with any leading directory components removed

Used to read commands from standard input or a specified file and execute
batch them when system load levels permit i.e. when the load average drops below
1.5

bc Used for command line calculator


bg Used to place foreground jobs in background

A mail notification system for unix that notifies the user at the command line
biff
when new mail arrives and tells from whom it is

bind Used to set Readline key bindings and variables

bison It is basically a parser generator similar to yacc

break Used to terminate the execution of for loop, while loop and until loop

Used to run a shell builtin, passing it arguments(args), and also to get the
builtin
exit status

bzcmp Used to invoke the cmp utility on bzip2 compressed files

bzdiff Used to compare the bzip2 compressed files

Used to search for a pattern or an expression but inside a bzip2-compressed


bzgrep
file

bzip2 Used to compress and decompress the files

It does not have to read the entire input file before starting, so with a large
bzless
file, it starts up faster

Used as a filter for CRT viewing of bzip2 compressed files, which are saved
bzmore
with .bz2 suffix

Used to see the calendar of a specific month or a whole year. By default, it


cal
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

Reads data from file and gives their content as output. It helps us to create, view,
cat
concatenate files
cc It is used to compile the C language codes and create executables

ccrypt It is a command line tool for encryption and decryption of data

Known as change directory command. It is used to change current working


cd
directory

It displays or manipulates the disk partition table by providing a text-based


cfdisk
“graphical” interface

chage Used to view and change the user password expiry information

It is a file system command which is used for changing the attributes of a file in
chattr
a directory

It allows you to change a user’s name and other details easily. chfn stands for
chfn
Change finger

chgrp Used to change the group ownership of a file or directory

chkconfig Used to list all available services and view or update their run level settings

chmod Used to change the access mode of a file

chown Used to change the file Owner or group

chpasswd Used to change password for multiple users at a time

chroot Used to change the root directory

chrt Used for manipulating the real-time attributes of a process

chsh Used to change the user’s login shell(currently login shell)

chvt Used to switch between the different TTY (TeleTYpewriter) terminals available
Used to display a CRC(Cyclic Redundancy Check) value, the byte size of the
cksum
file and the name of the file to standard output

clear Used to clear the terminal screen

Used to compare the two files byte by byte and helps you to find out whether the
cmp
two files are identical or not

It is used to filter out reverse line feeds. The col utility simply reads from the
col
standard input and writes to standard output

Used to format the text processor output so that it can be viewed on Cathode
colcrt
Ray Tube displays

colrm Removes selected columns from a file

column Used to display the contents of a file in columns

Compares two sorted files line by line and write to standard output; the lines that
comm
are common and the lines that are unique

Used to reduce the file size. After compression, the file will be available with an
compress
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

cpio stands for “copy in, copy out“. It is used for processing the archive files
cpio
like *.cpio or *.tar. This command can copy files to and from archives

It is automatically used by C compiler to transform your program before


cpp
compilation

A software utility, offered by Linux-like operating system which automates the


cron
scheduled task at a predetermined time
A list of commands that you want to run on a regular schedule, and also the
crontab
name of the command used to manage that list

csplit Used to split any file into many parts as required by the user

It allows quick access across the files (For example quickly seeing definition of
ctags
a function)

It is a type of scheduler for CUPS (Common Unit Printing System). It


cupsd
implements the printing system on the basis of the Internet Printing Protocol

curl A tool to transfer data to or from a server, using any of the supported protocols

For cutting out the sections from each line of files and writing the result to
cut
standard output

Used to store the history of a file. Whenever a file gets corrupted or anything
cvs
goes wrong “cvs” help us to go back to the previous version and restore our file

Used to display the system date and time. It is also used to set date and time of
date
the system

Used to evaluate arithmetic expressions. It evaluates expressions in the form of


dc
a postfix expression

It is a command-line utility for Unix and Unix-like operating systems whose


dd
primary purpose is to convert and copy files

Used to declare shell variables and functions, set their attributes and display
declare
their values

Used to generate a list of dependency description of kernel modules and its


depmod
associated map files

Used to display information related to file systems about total space and
df
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

Used to remove the trailing forward slahes “/” from the NAME and prints the
dirname
remaining portion

dirs Used to display the list of currently remembered directories

disable Used to stop the printers or classes

dmesg Used to examine the kernel ring buffer and print the message buffer of

Beginner’s Guide to Linux System


Administration
A Linux System Administrator manages the operations such as maintaining proper
software, observing them, and even taking care of backup and hardware systems.
It is recommended that before reading this article please go through the
article What is Linux System Administration. Here we have some basics of Linux
System Administration.

Some Basic Configurations

Set the Hostname: Open terminal and enter the following command in order to
change the hostname.
sudo hostname your_hostname
Replace “your_hostname” with the hostname that you want to keep.
Setting up the time zone: Move to /usr/share/zoneinfo/your_zone and then link
the zone file with /etc/localtime to set the time zone.
sudo ln -sf Kolkata /etc/localtime
File System and Management

Managing files is the most important task in Linux as all devices, directories, and
packages are just a type of file in Linux.
1. To know about File system read the article File System in Linux.
2. To learn more about Linux file hierarchy structure you can read the article Linux
File System Hierarchy
3. To get the difference between Linux and Windows File System read the
article Windows vs Linux
Below is the list of some file management commands in Linux:

Command Description

cd Used to change the current directory

ls Used to list the directories and files in a directory

vi A good text editor to edit files

touch Used to create new files

nano A good text editor to edit files

cp Used to copy files and directories.

mv Used to move files and directories.

rm Used to remove files and directories.

fdisk Used to partition disks and to work with file systems


Command Description

mount Used to mount a file system or a device

You can also read the file management in Linux from the
article https://www.geeksforgeeks.org/file-management-in-linux/

Networking Commands

Networking commands play an important role in system Administration and a good


system Administrator must have good hands-on networking commands. Here is a
list of such commands that are mostly used for networking in Linux.

Command Description

route used to view and manipulate ip routing tables.

Used to send some packets to a server and receive them back in case of a good
ping
network connection.

traceroute Used to trace the path taken by the traffic.

Used for querying the Domain Name System to obtain domain name or IP
nslookup
address mapping, or other DNS records.

Used to view and change the configuration of the network interfaces on your
ifconfig
system

tracepath Used to traces path to destination discovering MTU along this path
Command Description

Provides a secure encrypted connection between two hosts over an insecure


ssh
network

telnet Used to test if a port is open and even to work with telnet protocol.

Used to transfer data to or from a server, using any of the supported


curl
protocols.

Used to securely copy files and directories between two locations over a
scp
network.

w Provides a quick summary of every user logged into a computer

used for performing any operation in Linux related to TCP, UDP, or UNIX-
netcat
domain sockets

nmap Used for network exploration and security auditing

Used for monitoring network connections both incoming and outgoing as well
netstat
as viewing routing tables, interface statistics, etc

Used to assign an address to a network interface and/or configure network


ip
interface parameters on Linux operating systems

To learn more about Linux networking commands then read the article Linux
Networking Tools
Managing Users and Group in Linux

A system administrator has to manage the users working on the system. Users are
the accounts which are logged in to your system or may log in to the system. Each
user in Linux has a unique UID to identify the user. All information of the users is
stored in /etc/passwd file and all hashed passwords are stored in /etc/shadow file.
There are basically 2 types of user in Linux on the basis of their rights to access.
 Superuser or Administrator
 General users
Each user may or may not be a part of a group which is a collection of users. To
learn more about users in Linux go through the article Users in Linux System
Administration. Here is a list of commands that are used to manage users.
Command Description

usermod Used to modify users and their respective settings

useradd Used to add a new user

su and sudo Used to change the user and work with root

change Used to change the user’s aging/expiry information

groupdel Used to delete a group

gpasswd Used to change password of group

groupmod Used to modify group and its settings

groupadd Used to add a new group

To learn more about how to manage users read the article User Management in
Linux
To learn more about how to manage groups read the article Group Management in
Linux

System Diagnostics/Monitor Performance

A System Administrator should be able to diagnose problems in a system and even


to monitor the performance of the system so that it may be improved. Here is the
list of some useful commands for the same.

Command Description

top Used to display the running processes.

Used to get information about processes, memory, paging, block IO, disk, and
vmstat
CPU scheduling

lsof Used to check list of open files.

htop Used to determine the cause of load of each process

iostat Used to monitor IO devices loading

It displays performance about the CPU, MEMORY, NETWORK, DISKS, FILE


nmon
SYSTEM, NFS, TOP PROCESSES, RESOURCES, AND POWER MICRO-PARTITION

Reading and Analysing Logs

A good system Administrator must have an idea of how to read and manage logs
as they give a lot of crucial and required information.
Command Description

dmesg Used to print the message buffer of the kernel

tail Used to print details from the log files located in the folder /var/log

journalctl Used to read systemd logs

Whether you're preparing for your first job interview or aiming to upskill in this ever-
evolving tech landscape, GeeksforGeeks Courses are your key to success. We
provide top-quality content at affordable prices, all geared towards accelerating
your growth in a time-bound manner. Join the millions we've already empowered,
and we're here to do the same for you. Don't miss out - check it out now!
Looking for a place to share your ideas, learn, and connect? Our Community portal
is just the spot! Come join us and see what all the buzz is about!

You might also like