You are on page 1of 30

Meaning of Linux OS:

Linux OS is a type of computer operating system that is free and open-


source, distributed under the GNU(Gnu’s Not Unix) General Public License
(GPL) that allows users to download, install, and modify the operating system’s
source code for free. Linux OS consists of the Linux kernel developed by Linus
Torvalds and various software developed by the open-source community.

History of Linux OS:


Unix is one of the most popular operating systems worldwide because of
its large support base and distribution. It was originally developed as a
multitasking system for minicomputers and mainframes in the mid-1970s.
Versions of Unix exist for many systems, ranging from personal
computers to supercomputers such as the Cray Y-MP. Most versions of Unix
for personal computers are quite expensive.
Linux is a freely distributable version of Unix, originally developed by
Linus Torvalds, who began work on Linux in 1991 as a student at the
University of Helsinki in Finland.
Linus released the initial version of Linux for free on the Internet,
inadvertently spawning one of the largest software-development phenomena
of all time. Today, Linux is authored and maintained by a group of several
thousand (if not more) developers loosely collaborating across the Internet.

Benefits of Linux:
1. pen Source
As it is open-source, its source code is easily available. Anyone having
programming knowledge can customize the operating system. One can
contribute, modify, distribute, and enhance the code for any purpose.
2. Security
The Linux security feature is the main reason that it is the most favourable
option for developers. It is not completely safe, but it is less vulnerable than
others. Each application needs to authorize by the admin user. The virus is not
executed until the administrator provides the access password. Linux systems
do not require any antivirus program.
3. Free
Certainly, the biggest advantage of the Linux system is that it is free to use. We
can easily download it, and there is no need to buy the license for it. It is
distributed under GNU GPL (General Public License). Comparatively, we have
to pay a huge amount for the license of the other operating systems.
4. Lightweight
Linux is lightweight. The requirements for running Linux are much less than
other operating systems. In Linux, the memory footprint and disk space are
also lower. Generally, most of the Linux distributions required as little as
128MB of RAM around the same amount for disk space.
5. Stability
Linux is more stable than other operating systems. Linux does not require to
reboot the system to maintain performance levels. It rarely hangs up or slow
down. It has big up-times.
6. Performance
Linux system provides high performance over different networks. It is capable
of handling a large number of users simultaneously.
7. Flexibility
Linux operating system is very flexible. It can be used for desktop applications,
embedded systems, and server applications too. It also provides various
restriction options for specific computers. We can install only necessary
components for a system.
8. Software Updates
In Linux, the software updates are in user control. We can select the required
updates. There a large number of system updates are available. These updates
are much faster than other operating systems. So, the system updates can be
installed easily without facing any issue.
9. Distributions/ Distros
There are many Linux distributions available in the market. It provides various
options and flavours of Linux to the users. We can choose any distros
according to our needs. Some popular distros are Ubuntu, Fedora, Debian,
Linux Mint, Arch Linux, and many more.
For the beginners, Ubuntu and Linux Mint would be useful and, Debian and
Fedora would be good choices for proficient programmers.
10. Live CD/USB
Almost all Linux distributions have a Live CD/USB option. It allows us to try or
run the Linux operating system without installing it.
11. Graphical User Interface
Linux is a command-line based OS but, it provides an interactive user interface
like Windows.
12. Suitable for programmers
It supports almost all of the most used programming languages such as C/C+
+, Java, Python, Ruby, and more. Further, it offers a vast range of useful
applications for development.

Features of Linux:
1. Free Operating System
Linux is a free operating system. The operating system is cost-free so you can
view, modify, and customize the code without any cost. It facilitates the users
by providing:
 Free to use this OS for personal use, on the server, and for educational
use.
 A free License and collaborative project that can be developed by the
user contribution.
2. Open-source operating System
The code of the core component and other software are open to all the users.
The facilities the feature includes are:
 Anyone can go through the code so one can understand how the kernel
works.
 Modification is possible according to the user’s preference. One can
distribute the modified version to other Linux distributions.
 Open-source characteristics have made it more versatile.
3. Flexibility
The customization, modular design, embedded system, package managers, and
various distributions make it the most flexible operating system. The code of
the kernel can be customized according to the user. Linux follows a modular
design that includes very small tools that make it do many complex functions
and users can use it as an embedded system by scaling up.
4. Customizability
The Linux shell offers a higher degree of customization to improve accessibility.
Let’s take a look at which customization facility it provides:
 Supports multiple languages, so the keyboard can be customized to
one’s preference.
 Change the font size and the background colour according to one’s
convenience.
5. Stability
The Operating system provides more stability because of its kernel’s strong
code which was written by Torvalds. The reasons behind the stability:
 Strong structured Monolithic kernel
 Proper Distribution of resources and utilization of memory.
 Not susceptible to viruses and malware.
6. Lightweight
This operating system is so lightweight that it can be installed on any small
hardware and it uses quite small disk space while installation. Again, other
operating systems have many default apps and graphical interfaces but Linux is
only a kernel that can be customized. The property that makes it lightweight
than other OS are:
 The modular property is more in Linux than Windows.
 On the top of a monolithic kernel, other things are added by the
developers.
7. Portability
Portability allows it to be used on a wide range of hardware architectures. This
feature has earned this operating system worldwide recognition. This feature
enriches the uses of Linux by providing:
 Hardware to wearables applications.
 Its compatibility with various hardware makes it highly adaptable.
8. Graphical User Interface
Linux supports the graphical user interface (GUI) just like Windows. You can
install the packages on the command line or from the server.
 Support to make the system user-friendly.
 Provides a wide range of desktop environments including KDE, GNOME,
and Cinnamon.
9. Multiuser and Multitask support
It allows numerous users to work on various tasks at once. There are two
approaches to this:
 Single users doing multiple tasks.
 Multiple users do multiple tasks which includes editing file, and using
browsing facility at the same time.
The process can be prioritized by scheduling the tasks.
10. Well Structure File System
Linux has a hierarchical file system in which all files are sorted according to
their type and located in a particular directory. There are various types of
directories in Linux, such as Binary Directory (bin), Unix System Resource (usr),
Configuration Directory (conf), Data Directory, and Memory Directory.

Linux Distribution:
A "Linux distribution", often shortened to "distro", is an operating
system made from a group of software that includes the Linux kernel and,
often, a package management system. Linux users often download one of the
Linux distributions, which are available for everything from powerful
supercomputers (like OpenWrt) to embedded devices (like Linux Mint) and
personal computers (like Ubuntu Desktop).
These are the top Linux distributions:
 Ubuntu: Ubuntu is a free and open-source Linux distribution that comes
in three flavours: Desktop, Server, and Core for IoT. Ubuntu is easy to
use. It comes with free software like LibreOffice, Firefox, Thunderbird,
and Transmission, as well as games like Sudoku and chess. Aside from its
ease of use, the operating system is known to be more secure than
Windows. It is not immune to viruses, but it has a much lower risk of
exposure. Also, it is easy to change, so you can make your Ubuntu
environment fit your needs.
 CentOS: Because its software is simple and light, CentOS runs faster than
other Linux distributions. The operating system has a longer upgrade
cycle, lasting approximately five years.
 Fedora: Fedora is also known for being a stable and dependable
operating system. Fedora has a lot of graphical tools and useful software
for office work, virus protection, system management, playing media,
learning, and other things.
 Debian: Debian is a stable Linux distribution, but it also lets early
adopters try out packages that aren't quite ready yet. In comparison to
the alternatives, Debian provides the most packages. People think it's a
great distribution for running servers because its software is stable and it
comes out less often.
 Red Hat Enterprise Linux: Red Hat Enterprise Linux (RHEL), which calls
itself the "world's leading enterprise Linux platform," is used for a lot of
different things, such as making software and running hardware. RHEL is
well-known for its stability and speed.
 Linux Mint: Mint has become one of the most popular Linux
distributions since it first came out in beta in 2006. If you use Windows,
you will be familiar with its user interface. When switching to a new
Linux distribution, there may be a learning curve, but Mint's simple UI
and ease of use can help to reduce that.
 Kali Linux: Kali Linux is the best distribution for ethical hacking
objectives. Frankly, no other distribution can compete with Kali Linux.
The release includes a variety of tools that may be used for ethical
hacking. Device categories include wireless assaults, stress testing,
online applications, vulnerability analysis, and exploration instruments,
among others. Because Kali Linux is derived from the Debian Testing
branch, the majority of packages are imported from the Debian
repository.
Distribution Why To Use
UBuntu It works like Mac OS and easy to use.
Linux mint It works like windows and should be use by new comers.
Debian It provides stability but not recommended to a new user.
Fedora If you want to use red hat and latest software.
Red Hat Enterprise To be used commercially.
CentOS If you want to use red hat but without its trademark.
OpenSUSE It works same as Fedora but slightly older and more stable.
Arch Linux It is not for the beginners because every package has to be
installed by yourself.

Linux - System Logging:


Everything from kernel events to user actions is logged by Linux,
allowing you to see almost any action performed on your servers.
Linux has a special directory for storing logs called /var/log. This
directory contains logs from the OS itself, services, and various applications
running on the system. Here’s what this directory looks like on a typical
Ubuntu system.

Some of the most important Linux system logs include:


 /var/log/syslog and /var/log/messages store all global system activity
data, including startup messages. Debian-based systems like Ubuntu
store this in /var/log/syslog, while Red Hat-based systems
like RHEL or CentOS use /var/log/messages.
 /var/log/auth.log and /var/log/secure store all security-related events
such as logins, root user actions, and output from pluggable
authentication modules (PAM). Ubuntu and Debian
use /var/log/auth.log, while Red Hat and CentOS use /var/log/secure.
 /var/log/kern.log stores kernel events, errors, and warning logs, which
are particularly helpful for troubleshooting custom kernels.
 /var/log/cron stores information about scheduled tasks (cron jobs). Use
this data to verify your cron jobs are running successfully.

Logging In
Since more than one person can have an account on a single system, each user
must log in using his or her own unique user name and password. Logging in
indicates who is using the system and what files they can access.
To log in:
1. Type your user name at the login prompt and press Return.
The user name tells the system who you are. Your user name should have been
defined during installation. For more information, refer to the installation
manual for your specific platform. The Solaris operating environment
recognizes the difference between uppercase and lowercase letters, so make
sure you type the user name using the correct case.
The login prompt usually consists of your machine name (assigned as the
Hostname during the installation) followed by the word login:, as shown in the
example in Table 1-1.
Table 1-1 The login: prompt

genius login: johndoe

2. Type your password at the Password: prompt and press Return.


You do not see the characters on the screen as you type your password, as
shown in the example in Table 1-2.
Table 1-2 The Password Prompt

genius login: johndoe


Password:
If you mistype the user name or password and have already pressed Return,
the system asks you to start over with your user name. See the example
in Table 1-3.
Table 1-3 Log in again with your user name

genius login: johndoe


Password:
Login incorrect.
login:

After you type your password, OpenWindows launches automatically ( if a full


installation was performed.)

Note -
If OpenWindows does not launch automatically (for example, you may have
OpenWindows configured differently), you can start OpenWindows manually.
If you are unsure, contact your system administrator.

3. To start OpenWindows manually after you login, type openwin and press
Return.

Logging Out
When you are done working on the system, you will need to log out. If you are
sharing a system, this allows other people to log in to your computer under
their own accounts.
To log out:
1. You must exit OpenWindows to log out. Press the MENU button and
select Exit.
A Notice appears asking you to confirm that you want to exit from
OpenWindows.
2. SELECT Exit.
Normally, when you exit OpenWindows, the system automatically logs you
out. However, if it does not, go to Step 3.
3. Type exit (or logout) and press Return.
The login: prompt appears, as shown in the example in Table 1-4. Now another
user can log in under their own account and use the system.
Table 1-4 Type Exit to Log Out

genius% johndoe
genius login:

Linux Commands List with Examples


The Linux command is a utility of the Linux operating system. All basic and
advanced tasks can be done by executing commands. The commands are
executed on the Linux terminal. The terminal is a command-line interface to
interact with the system, which is similar to the command prompt in the
Windows OS. Commands in Linux are case-sensitive.
Linux provides a powerful command-line interface compared to other
operating systems such as Windows and MacOS. We can do basic work and
advanced work through its terminal. We can do some basic tasks such as
creating a file, deleting a file, moving a file, and more. In addition, we can also
perform advanced tasks such as administrative tasks (including package
installation, user management), networking tasks (ssh connection), security
tasks, and many more.
Linux terminal is a user-friendly terminal as it provides various support options.
To open the Linux terminal, press "CTRL + ALT + T" keys together, and execute
a command by pressing the 'ENTER' key.
In this topic, we will discuss the top 50 most frequently used Linux commands
with their examples. These commands are very useful for a beginner and
professional both.
Linux Directory Commands
1. pwd Command
The pwd command is used to display the location of the current working
directory.
Syntax:
1. pwd
Output:
2. mkdir Command
The mkdir command is used to create a new directory under any directory.
Syntax:
1. mkdir <directory name>
Output:

3. rmdir Command
The rmdir command is used to delete a directory.
Syntax:
1. rmdir <directory name>
Output:

4. ls Command
The ls command is used to display a list of content of a directory.
Syntax:
1. ls
Output:

5. cd Command
The cd command is used to change the current directory.
Syntax:
1. cd <directory name>
Output:
Linux File commands
6. touch Command
The touch command is used to create empty files. We can create multiple
empty files by executing it once.
Syntax:
1. touch <file name>
2. touch <file1> <file2> ....
ADVERTISEMENT
Output:

7. cat Command
The cat command is a multi-purpose utility in the Linux system. It can be used
to create a file, display content of the file, copy the content of one file to
another file, and more.
Syntax:
1. cat [OPTION]... [FILE]..
To create a file, execute it as follows:
1. cat > <file name>
2. // Enter file content
Press "CTRL+ D" keys to save the file. To display the content of the file, execute
it as follows:
1. cat <file name>
Output:

8. rm Command
The rm command is used to remove a file.
Syntax:
rm <file name>
Output:

9. cp Command
The cp command is used to copy a file or directory.
Syntax:
To copy in the same directory:
1. cp <existing file name> <new file name>
To copy in a different directory:
Output:

10. mv Command
The mv command is used to move a file or a directory form one location to
another location.
Syntax:
1. mv <file name> <directory path>
Output:

11. rename Command


The rename command is used to rename files. It is useful for renaming a large
group of files.
Syntax:
1. rename 's/old-name/new-name/' files
For example, to convert all the text files into pdf files, execute the below
command:
1. rename 's/\.txt$/\.pdf/' *.txt
Output:

Linux File Content Commands


12. head Command
The head command is used to display the content of a file. It displays the first
10 lines of a file.
Syntax:
1. head <file name>
Output:

13. tail Command


ADVERTISEMENT
The tail command is similar to the head command. The difference between
both commands is that it displays the last ten lines of the file content. It is
useful for reading the error message.
Syntax:
1. tail <file name>
Output:
14. tac Command
The tac command is the reverse of cat command, as its name specified. It
displays the file content in reverse order (from the last line).
Syntax:
1. tac <file name>
Output:

15. more command


The more command is quite similar to the cat command, as it is used to display
the file content in the same way that the cat command does. The only
difference between both commands is that, in case of larger files, the more
command displays screenful output at a time.
In more command, the following keys are used to scroll the page:
ENTER key: To scroll down page by line.
Space bar: To move to the next page.
ADVERTISEMENT
b key: To move to the previous page.
/ key: To search the string.
Syntax:
1. more <file name>
Output:

16. less Command


The less command is similar to the more command. It also includes some extra
features such as 'adjustment in width and height of the terminal.'
Comparatively, the more command cuts the output in the width of the
terminal.
Syntax:
1. less <file name>
Output:
Linux User Commands
17. su Command
The su command provides administrative access to another user. In other
words, it allows access of the Linux shell to another user.
Syntax:
1. su <user name>
Output:

18. id Command
The id command is used to display the user ID (UID) and group ID (GID).
Syntax:
1. id
Output:

19. useradd Command


The useradd command is used to add or remove a user on a Linux server.
Syntax:
1. useradd username
Output:

20. passwd Command


The passwd command is used to create and change the password for a user.
Syntax:
1. passwd <username>
Output:

21. groupadd Command


The groupadd command is used to create a user group.
Syntax:
1. groupadd <group name>
Output:

Linux Filter Commands


22. cat Command
The cat command is also used as a filter. To filter a file, it is used inside pipes.
Syntax:
1. cat <fileName> | cat or tac | cat or tac |. . .
Output:
23. cut Command
The cut command is used to select a specific column of a file. The '-d' option is
used as a delimiter, and it can be a space (' '), a slash (/), a hyphen (-), or
anything else. And, the '-f' option is used to specify a column number.
Syntax:
1. cut -d(delimiter) -f(columnNumber) <fileName>
Output:

24. grep Command


The grep is the most powerful and used filter in a Linux system. The 'grep'
stands for "global regular expression print." It is useful for searching the
content from a file. Generally, it is used with the pipe.
Syntax:
1. command | grep <searchWord>
Output:
25. comm Command
The 'comm' command is used to compare two files or streams. By default, it
displays three columns, first displays non-matching items of the first file,
second indicates the non-matching item of the second file, and the third
column displays the matching items of both files.
Syntax:
1. comm <file1> <file2>
Output:

26. sed command


The sed command is also known as stream editor. It is used to edit files using a
regular expression. It does not permanently edit files; instead, the edited
content remains only on display. It does not affect the actual file.
Syntax:
1. command | sed 's/<oldWord>/<newWord>/'
Output:

27. tee command


The tee command is quite similar to the cat command. The only difference
between both filters is that it puts standard input on standard output and also
write them into a file.
Syntax:
1. cat <fileName> | tee <newFile> | cat or tac |.....
Output:

28. tr Command
The tr command is used to translate the file content like from lower case to
upper case.
Syntax:
1. command | tr <'old'> <'new'>
Output:

29. uniq Command


The uniq command is used to form a sorted list in which every word will occur
only once.
Syntax:
1. command <fileName> | uniq
Output:
30. wc Command
The wc command is used to count the lines, words, and characters in a file.
Syntax:
1. wc <file name>
Output:

31. od Command
The od command is used to display the content of a file in different s, such as
hexadecimal, octal, and ASCII characters.
Syntax:
1. od -b <fileName> // Octal format
2. od -t x1 <fileName> // Hexa decimal format
3. od -c <fileName> // ASCII character format
Output:

32. sort Command


The sort command is used to sort files in alphabetical order.
Syntax:
1. sort <file name>
Output:

33. gzip Command


The gzip command is used to truncate the file size. It is a compressing tool. It
replaces the original file by the compressed file having '.gz' extension.
Syntax:
1. gzip <file1> <file2> <file3>...
Output:

34. gunzip Command


The gunzip command is used to decompress a file. It is a reverse operation of
gzip command.
Syntax:
1. gunzip <file1> <file2> <file3>. .
Output:
Linux Utility Commands
35. find Command
The find command is used to find a particular file within a directory. It also
supports various options to find a file such as byname, by type, by date, and
more.
The following symbols are used after the find command:
(.) : For current directory name
(/) : For root
Syntax:
1. find . -name "*.pdf"
Output:

36. locate Command


The locate command is used to search a file by file name. It is quite similar to
find command; the difference is that it is a background process. It searches the
file in the database, whereas the find command searches in the file system. It is
faster than the find command. To find the file with the locates command, keep
your database updated.
Syntax:
1. locate <file name>
Output:
37. date Command
The date command is used to display date, time, time zone, and more.
Syntax:
1. date
Output:

38. cal Command


The cal command is used to display the current month's calendar with the
current date highlighted.
Syntax:
1. cal<
Output:

39. sleep Command


The sleep command is used to hold the terminal by the specified amount of
time. By default, it takes time in seconds.
Syntax:

1. sleep <time>
Output:

40. time Command


The time command is used to display the time to execute a command.
Syntax:
1. time
Output:

41. zcat Command


The zcat command is used to display the compressed files.
Syntax:
1. zcat <file name>
Output:

42. df Command
The df command is used to display the disk space used in the file system. It
displays the output as in the number of used blocks, available blocks, and the
mounted directory.
Syntax:
1. df
Output:

43. mount Command


The mount command is used to connect an external device file system to the
system's file system.
Syntax:
1. mount -t type <device> <directory>
Output:

44. exit Command


Linux exit command is used to exit from the current shell. It takes a parameter
as a number and exits the shell with a return of status number.
Syntax:
1. exit
Output:

After pressing the ENTER key, it will exit the terminal.


45. clear Command
Linux clear command is used to clear the terminal screen.
Syntax:
1. clear
Output:

After pressing the ENTER key, it will clear the terminal screen.
Linux Networking Commands
46. ip Command
Linux ip command is an updated version of the ipconfig command. It is used to
assign an IP address, initialize an interface, disable an interface.
Syntax:
1. ip a or ip addr
Output:

47. ssh Command


Linux ssh command is used to create a remote connection through the ssh
protocol.
Syntax:
1. ssh user_name@host(IP/Domain_name)</p>
48. mail Command
The mail command is used to send emails from the command line.
Syntax:
1. mail -s "Subject" <recipient address>
Output:

49. ping Command


The ping command is used to check the connectivity between two nodes, that
is whether the server is connected. It is a short form of "Packet Internet
Groper."
Syntax:
1. ping <destination>
Output:

50. host Command


The host command is used to display the IP address for a given domain name
and vice versa. It performs the DNS lookups for the DNS Query.
Syntax:
1. host <domain name> or <ip address>
Output:

You might also like