Unit 5 Linux
Unit 5 Linux
What is Linux ?
Linux is a powerful and flexible family of operating systems that are free to
use and share. It was created by a person named Linus Torvalds in 1991.
What’s cool is that anyone can see how the system works because its source
code is open for everyone to explore and modify. This openness encourages
people from all over the world to work together and make Linux better and
better. Since its beginning, Linux has grown into a stable and safe system used
in many different things, like computers, smartphones, and big
supercomputers. It’s known for being efficient, meaning it can do a lot of tasks
quickly, and it’s also cost-effective, which means it doesn’t cost a lot to use.
Lots of people love Linux, and they’re part of a big community where they
share ideas and help each other out. As technology keeps moving forward,
Linux will keep evolving and staying important in the world of computers.
Linux Distribution
Linux Distribution is an operating system that is made up of a collection of
software based on Linux kernel or you can say distribution contains the Linux
kernel and supporting libraries and software. And you can get Linux based
operating system by downloading one of the Linux distributions and these
distributions are available for different types of devices like embedded devices,
personal computers, etc. Around 600 + Linux Distributions are available and
some of the popular Linux distributions are:
• MX Linux
• Manjaro
• Linux Mint
• elementary
• Ubuntu
• Debian
• Solus
• Fedora
• openSUSE
• Deepin
LINUX DIRECTORY STRUCTURE
The Linux/Unix file system hierarchy base begins at the root and everything
starts with the root directory.
These are the common top-level directories associated with the root
directory:
Directories Description
Directories Description
It contains all the boot-related information files and folders such as conf,
grub, etc.
/boot
It is a virtual file system for modern Linux distributions to store and allows
modification of the devices connected to the system.
/sys
LINUX BASIC COMMANDS
Commands Description
acpi Used to display the battery status and other ACPI information
addr2line Used to convert addresses into file names and line numbers
Instructs the shell to replace one string with another string while
alias executing the commands
It helps the user when they don’t remember the exact command
but knows a few keywords related to the command that define its
apropos uses or 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
apt tools like apt-cache and apt-get
ar Used to create, modify and extract the files from the archives
Used to remove the specified jobs. To remove a job, its job number
atrm is passed in the command
atq It displays the list of pending jobs which are scheduled by the user
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
A mail notification system for unix that notifies the user at the command
biff
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
Used to run a shell builtin, passing it arguments(args), and also to get the
builtin
exit status
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
Reads data from file and gives their content as output. It helps us to create,
cat
view, concatenate files
chage Used to view and change the user password expiry information
It allows you to change a user’s name and other details easily. chfn stands
chfn
for Change finger
chkconfig Used to list all available services and view or update their run level settings
Used to compare the two files byte by byte and helps you to find out
cmp
whether the 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
Compares two sorted files line by line and write to standard output; the lines
comm
that are common and the lines that are unique
Used to reduce the file size. After compression, the file will be available
compress
with an added .Z extension
continue Used to skip the current iteration in for, while and until loop
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
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
ctags
of a function)
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
date
time of the system
Used to evaluate arithmetic expressions. It evaluates expressions in the
dc
form of a postfix expression
Used to declare shell variables and functions, set their attributes and
declare
display their values
Used to display information related to file systems about total space and
df
available space
Used to display the differences in the files by comparing the files line by
diff
line
Used to remove the trailing forward slahes “/” from the NAME and
dirname
prints the remaining portion
Used to examine the kernel ring buffer and print the message buffer of
dmesg
kernel
dosfsck Diagnoses MS-DOS file system for problems and attempts to repair them
Used to track the files and directories which are consuming excessive
du
amount of space on hard disk drive
Used to print the super block and blocks group information for the
dumpe2fs
filesystem present on device
Used for launching the ed text editor which is a line-based text editor with a
ed minimal interface which makes it less complex for working on text files i.e
creating, editing, displaying and manipulating files
It treats the pattern as an extended regular expression and prints out the lines
egrep
that match the pattern
It is a editor having simple user interface. Also, there is no insert mode in this
emacs
editor. It only have editing mode.
It is a text editor in Linux which is also termed as the line editor mode of the vi
ex
editor
Allows you to convert tabs into spaces in a file and when no file is specified it
expand
reads from standard input
This command or scripting language works with scripts that expect user inputs.
expect
It automates the task by providing inputs
Used to print the prime factors of the given numbers, either given from
factor
command line or read from standard input
It scans the font directories and build font cache for applications which use
fc-cache
fontconfig for their font handling
It is used to list the available fonts and font styles. Using the format option,
fc-list
the list of all fonts can be filtered and sorted out
find Used to find files and directories and perform subsequent operations on them
It is a user information lookup command which gives details of all the users
finger
logged in.
It wraps each line in an input file to fit a specified width and prints it to the
fold
standard output
Used to repeatedly execute a set of command for every element present in the
for
list
Displays the total amount of free space available along with the amount of
free memory used and swap memory in the system, and also the buffers used by
the kernel
getent Used to get the entries in a number of important text files called databases
Searches a file for a particular pattern of characters, and displays all lines
grep
that contain that pattern
Groups are the collection of users. Groups make it easy to manage users
groups
with the same security and access privileges
It verifies the integrity of the groups information. It checks that all entries in
grpck
/etc/group and /etc/gshadow have the proper format and contain valid data
This command compresses files. Each single file is compressed into a single
gzip
file.
Used to instruct the hardware to stop all the CPU functions. Basically, it
halt
reboots or stops the system.
Used to get statistics about the hard disk, alter writing intervals, acoustic
hdparm
management, and DMA settings
Used to filter and display the specified files, or standard input in a human
hexdump
readable specified format
Used to obtain the DNS(Domain Name System) name and set the
hostname
system’s hostname or NIS(Network Information System) domain name.
Provides a proper API used to control Linux system hostname and change
hostnamectl
its related settings
Utility for accessing the hardware clock, also called Real Time Clock
hwclock
(RTC)
iconv Used to convert some text in one encoding into another encoding
Used to find out user and group names and numeric ID’s (UID or group ID)
id
of the current user or any other user in the server
Used for capturing a screenshot for any of the active pages we have and it
import
gives the output as an image file
iostat Used for monitoring system input/output statistics for devices and partitions
Used to display and monitor the disk IO usage details and even gets a table
iotop
of existing IO utilization by the process
iptables- It will save the current iptables rules in a user specified file, that can be
save used later when the user wants
Used to display the parameters, and the wireless statistics which are
iwconfig
extracted from /proc/net/wireless
It is a command line utility for joining lines of two files based on a key field
join
present in both the files
Used to display the list of all the users logged in and out since the file
last
/var/log/wtmp was created
less Used to read contents of text file one page(one screen) per time
Used to display details about block devices and these block devices(Except ram
lsblk
disk) are basically those files that represent devices connected to the pc.
Used to display the information about USB buses and the devices connected to
lsusb
them
This command in Linux prints the mail queue i.e the list of messages that are
mailq
there in the mail queue
Used to display the user manual of any command that we can run on the
man
terminal
Allows the user to create directories. This command can create multiple
mkdir
directories at once
Used to view the text files in the command prompt, displaying one screen at a
more
time in case the file is large (For example log files)
Used to move one or more files or directories from one place to another in file
mv
system like UNIX
Used to convert the content of input in different formats with octal format as the
od
default format
pidof Used to find out the process IDs of a specific running program
ping Used to check the network connectivity between host and server/host
It is a user information lookup command which gives details of all the users
pinky logged in. Unlike finger, in the pinky, you may trim the information of your
interest.
Used to display the memory map of a process. A memory map indicates how
pmap
memory is spread out
poweroff Sends an ACPI signal which instructs the system to power down
Used to display the given string, number or any other format specifier on the
printf
terminal window
Used to list the currently running processes and their PIDs along with some
ps
other information depends on different options
pwd It prints the path of the working directory, starting from the root
Reads up the total number of bytes from the specified file descriptor into the
read
buffer
rename Used to rename the named files according to the regular expression perlexpr
Used to initialize the terminal. This is useful once a program dies leaving a
reset
terminal in an abnormal state
restore Used for restoring files from a backup created using dump
It is a software utility for Unix-Like systems that efficiently sync files and
rsync
directories between two hosts or machines
Provides the ability to launch and use multiple shell sessions from a single
screen
ssh session
Used to compare two files and then writes the results to standard output in
sdiff
a side-by-side format
select Used to create a numbered menu from which a user can select an option
prints to standard output either the scan codes or the key code or the
showkey
`ascii’ code of each key pressed
sudo Used as a prefix of some command that only superuser are allowed to run
Used to examine and control the state of “systemd” system and service
systemctl
manager
Reads the standard input and writes it to both the standard output and one or
tee
more files
Used to execute a command and prints a summary of real-time, user CPU
time time and system CPU time spent by executing a command when it
terminates
tracepath Used to traces path to destination discovering MTU along this path
traceroute Prints the route that a packet takes to reach the host
type Used to describe how its argument would be translated if used as commands
Converts each spaces into tabs writing the produced output to the standard
unexpand
output
It is a command line utility that reports or filters out the repeated lines in a
uniq
file
Uptime Used to find out how long the system is active (running)
useradd Used to add user accounts to your system
usermod Used to change the properties of a user in Linux through the command line
users Used to show the user names of users currently logged in to the current host
It is the default editor that comes with the UNIX operating system is called
vi
visual editor.
Used to find out number of lines, word count, byte and characters count in the
wc
files specified in the file arguments
Used to download files from the server even when the user has not logged on
Wget to the system and it can work in background without hindering the current
process
whoami Displays the username of the current user when this command is invoked
Allows a user to communicate with other users, by copying lines from one
write
user’s terminal to others
Used to build and execute commands from standard input. It converts input
xargs
received from standard input into arguments of a command
xdg-
Used to open a file or URL in the user’s preferred application
open
zdiff Used to invoke the diff program on files compressed via gzip
Used to print the current time in the specified zone or you can say prints the
zdump
current time in each zonename named on the command line
zgrep Used to search out expressions from a given a file even if it is compressed
It is a compression and file packaging utility for Unix. Each file is stored in
zip
single .zip {.zip-filename} file with the extension .zip