WHAT IS LINUX OS
What is Linux Os?
Just like Windows, iOS, and Mac OS, Linux is an operating system. In fact, one of the most popular platforms on the planet, Android, is powered by the Linux operating system. An operating system is software that manages all of the hardware resources associated with your desktop or laptop. To put it simply, the operating system manages the communication between your software and your hardware. Without the operating system (OS), the software wouldn?t function.
From smartphones to cars, supercomputers and home appliances, home desktops to enterprise servers, the Linux operating system is everywhere.
Linux has been around since the mid-1990s and has since reached a user-base that spans the globe. Linux is actually everywhere: It?s in your phones, your thermostats, in your cars, refrigerators, Roku devices, and televisions. It also runs most of the Internet, all of the world’s top 500 supercomputers, and the world’s stock exchanges.
But besides being the platform of choice to run desktops, servers, and embedded systems across the globe, Linux is one of the most reliable, secure and worry-free operating systems available.
The Linux operating system comprises several different pieces:
- Bootloader – The software that manages the boot process of your computer. For most users, this will simply be a splash screen that pops up and eventually goes away to boot into the operating system.
- Kernel – This is the one piece of the whole that is actually called ?Linux?. The kernel is the core of the system and manages the CPU, memory, and peripheral devices. The kernel is the lowest level of the OS.
- Init system – This is a sub-system that bootstraps the user space and is charged with controlling daemons. One of the most widely used init systems is systemd? which also happens to be one of the most controversial. It is the init system that manages the boot process, once the initial booting is handed over from the bootloader (i.e., GRUB or GRand Unified Bootloader).
- Daemons – These are background services (printing, sound, scheduling, etc.) that either start up during boot or after you log into the desktop.
- Graphical server – This is the sub-system that displays the graphics on your monitor. It is commonly referred to as the X server or just X.
- Desktop environment – This is the piece that the users actually interact with. There are many desktop environments to choose from (GNOME, Cinnamon, Mate, Pantheon, Enlightenment, KDE, Xfce, etc.). Each desktop environment includes built-in applications (such as file managers, configuration tools, web browsers, and games).
- Applications – Desktop environments do not offer the full array of apps. Just like Windows and macOS, Linux offers thousands upon thousands of high-quality software titles that can be easily found and installed. Most modern Linux distributions (more on this below) include App Store-like tools that centralize and simplify application installation. For example, Ubuntu Linux has the Ubuntu Software Center (a rebrand of GNOME Software? Figure 1) which allows you to quickly search among the thousands of apps and install them from one centralized location.
Why use Linux?
This is the one question that most people ask. Why bother learning a completely different computing environment, when the operating system that ships with most desktops, laptops, and servers works just fine?
To answer that question, I would pose another question. Does that operating system you?re currently using really work ?just fine?? Or, do you find yourself battling obstacles like viruses, malware, slow downs, crashes, costly repairs, and licensing fees?
If you struggle with the above, Linux might be the perfect platform for you. Linux has evolved into one of the most reliable computer ecosystems on the planet. Combine that reliability with zero cost of entry and you have the perfect solution for a desktop platform.
That’s right, zero cost of entry… as in free. You can install Linux on as many computers as you like without paying a cent for software or server licensing.
Let’s take a look at the cost of a Linux server in comparison to Windows Server 2016. The price of the Windows Server 2016 Standard edition is $882.00 USD (purchased directly from Microsoft). That doesn’t include Client Access License (CALs) and licenses for other software you may need to run (such as a database, a web server, mail server, etc.). For example, a single user CAL, for Windows Server 2016, costs $38.00. If you need to add 10 users, for example, that’s $388.00 more dollars for server software licensing. With the Linux server, it?s all free and easy to install. In fact, installing a full-blown web server (that includes a database server), is just a few clicks or commands away (take a look at ?Easy LAMP Server Installation? to get an idea how simple it can be).
If zero cost isn’t enough to win you over? what about having an operating system that will work, trouble free, for as long as you use it? I’ve used Linux for nearly 20 years (as both a desktop and server platform) and have not had any issues with ransomware, malware, or viruses. Linux is generally far less vulnerable to such attacks. As for server reboots, they’re only necessary if the kernel is updated. It is not out of the ordinary for a Linux server to go years without being rebooted. If you follow the regular recommended updates, stability and dependability are practically assured.
Components of Linux System
Linux Operating System has primarily three components
- Kernel − Kernel is the core part of Linux. It is responsible for all major activities of this operating system. It consists of various modules and it interacts directly with the underlying hardware. Kernel provides the required abstraction to hide low level hardware details to system or application programs.
- System Library − System libraries are special functions or programs using which application programs or system utilities accesses Kernel’s features. These libraries implement most of the functionalities of the operating system and do not requires kernel module’s code access rights.
- System Utility − System Utility programs are responsible to do specialized, individual level tasks.
Kernel Mode vs User Mode
Kernel component code executes in a special privileged mode called kernel mode with full access to all resources of the computer. This code represents a single process, executes in single address space and do not require any context switch and hence is very efficient and fast. Kernel runs each processes and provides system services to processes, provides protected access to hardware to processes.
Support code which is not required to run in kernel mode is in System Library. User programs and other system programs works in User Mode which has no access to system hardware and kernel code. User programs/ utilities use System libraries to access Kernel functions to get system’s low level tasks.
Following are some of the important features of Linux Operating System.
- Portable − Portability means software can works on different types of hardware in same way. Linux kernel and application programs supports their installation on any kind of hardware platform.
- Open Source − Linux source code is freely available and it is community based development project. Multiple teams work in collaboration to enhance the capability of Linux operating system and it is continuously evolving.
- Multi-User − Linux is a multiuser system means multiple users can access system resources like memory/ ram/ application programs at same time.
- Multiprogramming − Linux is a multiprogramming system means multiple applications can run at same time.
- Hierarchical File System − Linux provides a standard file structure in which system files/ user files are arranged.
- Shell − Linux provides a special interpreter program which can be used to execute commands of the operating system. It can be used to do various types of operations, call application programs. etc.
- Security − Linux provides user security using authentication features like password protection/ controlled access to specific files/ encryption of data.
WHAT IS LINUX COMMAND LINE
The Linux command line is a text interface to your computer. Often referred to as the shell, terminal, console, prompt or various other names, it can give the appearance of being complex and confusing to use. Yet the ability to copy and paste commands from a website, combined with the power and flexibility the command line offers, means that using it may be essential when trying to follow instructions online, including many on this very website!
Basic Linux Commands
Now, let us look at the most important 20 commands in Linux. Linux commands are case sensitive hence you need to be careful about what you are keying in.
1. ls –
List directory contents. If you know windows you would know that the command dir is used to list the contents in a directory. In Linux, the ls command is used to list out files and directories. Some versions may support color-coding. The names in blue represent the names of directories.
ls -l | more – this helps to paginate the output so you can view page by page. Otherwise the listing scrolls down rapidly. You can always use ctrl c to go back to the command line.
$ ls -l filename
2. cd /var/log –
Change the current directory. The forward slash is to be used in Linux. The example is a Linux directory that comes with all versions of Linux.
When you use ls –I you will be able to see more details of the contents in the directory
It will list down the
- Permissions associated with the file
- The owner of the file
- The group associated with the file
- The size of the file
- The time stamp
- The name of the file
$ cd /var/log
3. grep –
Find text in a file. The grep command searches through many files at a time to find a piece of text you are looking for.
grep PATTERN [FILE]
grep failed transaction.log
The above command will find all of the words in the files that matched the word ‘failed’.
$ grep ‘failed’ transaction.log
4. su / sudo command –
There are some commands that need elevated rights to run on a Linux system. So you run them as a System Administrator which normal users cannot do.
su command changes the shell to be used as a super user and until you use the exit command you can continue to be the super user
sudo – if you just need to run something as a super user, you can use the sudo command. This will allow you to run the command in elevated rights and once the command is executed you will be back to your normal rights and permissions.
Example – shutdown command the shutdown command safely turns off the computer system.
- sudo shutdown 2 – shutdown and turns of the computer after 2 minutes
- sudo shutdown –r 2 – shuts down and reboots in 2 minutes
- Using ctrl C or shutdown –c helps in stopping the shutdown process.
$ sudo shutdown 2 $ sudo shutdown –r 2
5. pwd – Print Working Directory
One way to identify the directory you are working in is the pwd command
It displays the current working directory path and is useful when directory changes are often
6. passwd –
Though looks similar to the pwd command the role it plays is different.
This command is used to change the user account password. You could change your password or the password of other users. Note that the normal system users may only change their own password, while root may modify the password for any account.
passwd [username] – changes the password for the user.
$ passwd admin
7. mv – Move a file
To move a file or rename a file you would use the mv command.
Here the file name gets changed from first.txt to second.txt.
Type ls to view the change
$ mv first.txt second.txt
8. cp – Copy a file
cp source file destination file. In case you need a copy of the file second.txt in the same directory you have to use the cp command
$ cp second.txt third.txt
You can use ls – l to see the new file created. The two files will be exactly of the same size.
9. rm –
This command is used to remove files in a directory or the directory itself. A directory cannot be removed if it is not empty.
rm [name of the file]
rm –r removes all the contents in a directory and the directory as well.https://8a7ea16355f8be1df7a66ae72a5a7273.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.htmlhttps://8a7ea16355f8be1df7a66ae72a5a7273.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html
$ rm file1 $ rm -r myproject
10. mkdir – to make a directory.
mkdir [directory name] if you would like to create a directory in the name ‘myproject’ type
$ mkdir myproject
11. chmod –
To change mode of a file system object. Files can have r – read, w- write and x-execute permissions.
- chmod mode FILE
- chmod 744 script.sh
- The first number stands for the user who is associated with the file
- The second number is for the group associated with the file
- The third number is associated with everyone else who is not a part of the user or group
$ chmod 744 script.sh
|Octal Notation||Permission||Symbolic Representation|
|1||Execute Permission Only||–x|
|2||Write Permission Only||-w-|
|3||Write and Execute Permissions (1+2)=3||-wx|
|4||Read Permission Only||r–|
|5||Read and Execute Permissions (1+4)=5||r-x|
|6||Read and Write Permissions (2+4)=6||rw-|
|7||Read, Write and Execute Permissions, Means Full Permissions (1+2+4)=7||rwx|
From the table you will see that the rights given will be as
- -rwxr- – r- – rwx for user
- r – – for the group (read only)
- r – – for others (read only)
Other ways of using chmod are
- chmod a-w first.txt
This means all users have no write access to the file first.txt.
- chmod u + x script.sh
The owner of script.sh can execute the file
12. chown –
This command is used to change the ownership of a file/folder or even multiple files/folders for a specified user/group.
chown owner_name file_name
$ chown user1 script.sh
Assume that if you are a user named user1 and you want to change ownership to root use “sudo” before syntax.
$ sudo chown root script.sh
13. cat –
The cat command (short for “concatenate “) is one of the most frequently used commands in Linux. cat command allows you to create single or multiple files, view contents of file, concatenate files and redirect output in terminal or files.
$ cat file.txt $ cat file1.txt file2.txt
Output will show the entire contents of the file(s).
14. echo –
This command is used to display a text or a string to the standard output or a file.
$ echo “This is an article on basic linux commands”https://8a7ea16355f8be1df7a66ae72a5a7273.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.htmlhttps://8a7ea16355f8be1df7a66ae72a5a7273.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html
This is an article on basic linux commands
The echo –e option acts as an interpretation of escape characters that are back-slashed.
$ echo –e “This is an article is for beginners. \nIt is on basic linux commands
Will display the output as
This is an article is for beginners. It is on basic linux commands
\n the newline character is interpreted by the echo –e command
15. wc –
The wc (word count) command in Linux operating system is used to find out the number of new lines, word count, byte and characters count in a file specified by the file arguments.
wc [options] filenames.
$ wc –l readme.txt
Shows the output as – 120 readme.txt
- wc -l : Prints the number of lines in a file.
- wc -w : prints the number of words in a file.
- wc -c : Displays the count of bytes in a file.
- wc -m : prints the count of characters from a file.
- wc -L : prints only the length of the longest line in a file.
16. man –
This command is used to view the on-line reference manual pages for commands/programs.
$ man grep $ man mkdir
17. history –
This command is used to show previously used commands or to get information about the commands executed by a user.
18. clear –
This command lets you clear the terminal screen.https://8a7ea16355f8be1df7a66ae72a5a7273.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.htmlhttps://8a7ea16355f8be1df7a66ae72a5a7273.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html
19. apt –get
apt -get is a powerful and free front-end package manager for Debian/Ubuntu systems. It is used to install new software packages, remove available software packages, upgrade existing software packages as well as upgrade the entire operating system. apt – stands for advanced packaging tool.
$ sudo apt-get update
20. reboot –
This command may be used to halt, power-off or reboot a system as follows.
Well, Linux doesn’t end here. If you want to learn more Linux commands or Linux in-depth then these are great courses for beginners:
LINUX COMMAND LINE TOOLS
Wikit is a command line utility to search Wikipedia in Linux. It basically displays Wikipedia summaries. Once you have it installed, simply provide the search term as an argument (for example wikit linux).
Googler is a full-featured Python-based command line tool for accessing Google (Web & News) and Google Site Search within the Linux terminal. It is fast and clean with custom colors and no ads, stray URLs or clutter included. It supports navigation of search result pages from omniprompt.
In addition, it supports fetching of number of results in a go, users can start at the nth result, and supports limiting of search by attributes such as duration, country/domain specific search (default: .com), language preference.
Browsh is a small, modern text based browser that play videos and render anything that a modern browser can, in TTY terminal environments.
It supports HTML5, CSS3, JS, video as well as WebGL. It is a bandwidth-saver, designed to run on a remote server and accessed via SSH/Mosh or the in-browser HTML service so as to notably reduce bandwidth.
It is practically useful when you don’t have good Internet connection.
Lolcat is a command-line program to output rainbow of colors in the Linux terminal. It concatenates the output of a command in a similar way as cat command and adds rainbow coloring to the final output.
To use lolcat, simply pipe the output of any command to lolcat.
Boxes is a configurable program and text filter which can draw ASCII art boxes around its input text in a Linux terminal. It comes with a number of pre-configured box designs in example config file. It comes with several command-line options and supports regular expression substitutions on input text.
You can use it to: draws ASCII art boxes and shapes, generate regional comments in source code and more.
Drop your comment