We all are very well versed with the "Windows" operating system and most of us use it daily as it is "GUI (Graphical User Interface )" based, that's why very easy to use. But if you want to become an expert in DevOps, the first thing that you have to know about Linux.
"Linux" is also an Operating system but unlike Windows, it is not GUI based, it is "CLI(Command-Line Interface)" based. So...
Permalink1. What is Linux actually?
Linux is an open-source operating system like Windows, Mac, android, etc. Linus Torvalds introduced it on 17th September 1991.
An operating system is a software that directly manages a system’s hardware and resources, like CPU, memory, and storage. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work. As I said earlier it is CLI based, So ...
What is a Command line ??
The command line is your direct access to a computer. It's where you ask the software to perform hardware actions that point-and-click graphical user interfaces (GUIs) simply can't ask. Command lines are available on many operating systems—proprietary or open source. But it’s usually associated with Linux, because both command lines and open-source software, together, give users unrestricted access to their computers.
Some benefits of using Linux::
a) As it is open-source, anyone with programming knowledge can modify it.
b) It is easy to learn Linux for beginners
c) The Linux operating systems now offer millions of programs/applications and Linux software to choose from, and most of them are free!
d) Once you have Linux installed you no longer need an antivirus! Linux is a highly secure system. More so, there is a global development community constantly looking at ways to enhance its security. With each upgrade, the OS becomes more secure and robust
e) Linux freeware is the OS of choice for Server environments due to its stability and reliability (Mega-companies like Amazon, Facebook, and Google use Linux for their Servers). A Linux-based server could run non-stop without a reboot for years on end.
Permalink2.Linux Architechture :
Hardware: physical parts of a computer, such as central processing unit (CPU), monitor, mouse, keyboard, hard disk and other connected devices to CPU.
Kernel: A kernel is a computer program and is the central, core part of an operating system. It manages the operations of the computer and the hardware, most notably memory and CPU time. It is an integral part of any operating system. It loads into memory when Linux is booted. It is a collection of routine communication with hardware directly.
Shell: Shell is an environment in which we can run our commands, programs, and shell scripts. It is a user interface for access to an operating system's services. Shell is the medium between the user and the kernel. A shell is a user interface for access to an operating system's services Shell is an environment in which we can run our commands, programs, software, and shell scripts. Computers do not have the capability of translating commands into actions, Shell does it.
When we enter commands through the keyboard, it gathers input from us and executes programs based on that input. When a program finishes executing, it displays that program's output.
Application Programs: An application, or application program, is a software program that runs on your computer. It is exciting for the user. Some inbuilt application programs in Linux are terminal, and Firefox browser.
System calls: There are over a thousand commands available in the Linux operating system. These all commands use a function to communicate with the kernel - and it is called a system call. A system call is the interface between a process and an operating system or System calls are the only entry points into the kernel system.
Some of the Linux distributions are :
Ubuntu, Centos, Fedora Linux, RedHat, Debian, Kali Linux, etc.
Permalink3.Some Basic commands in Linux everyone should know while working with Linux :
In the case of Windows, we create a Folder by right-clicking and then selecting New-Folder, but in Linux, we call it Directory and the command is for
1.making a new directory is mkdir (syntax: mkdir <directory name> )
eg: $ mkdir xyz
To make multiple directories at the same time :
eg: $ mkdir A B C D
To create a nested subdirectory
eg: $ mkdir -p A/B/C/D
2. ls: The ls command is used to display a list of content of a directory (syntax <ls>)
eg: $ ls
ls - l: to list the files and directories in long list format with extra information (like file permissions )
ls -a: list all hidden directories and files.
3. pwd (present working directory ): The pwd command is used to display the location of the current working directory.
4. cd command: The cd command is used to change the current directory. ( syntax: cd <directory name> )
eg: $ mkdir Name
$ cd Name
5. touch Command: The touch command is used to create empty files. We can create multiple empty files by executing them once. (touch <file name>
touch <file1> <file2> .... )
6. cat Command: The cat command is a multi-purpose utility in the Linux system. It can be used to create a file and display the content of the file. (Syntax cat [OPTION]... [FILE].. )
eg: $ cat <file name>
// Enter file content
7. rm Command: The rm command is used to remove a file.
(Syntax :rm <file name>)
8. rmdir command: To remove an empty directory, use the command as
(syntax : rmdir <dir name>) , but If the directory still contains files or subdirectories, the rmdir command does not remove the directory.
To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option -r :
(syntax: rm -r <dir name>)
9. cp Command: The cp command is used to copy a file or directory.
(syntax: cp <existing file name> <new file name>)
10.mv Command: The mv command is used to move a file or a directory from one location to another location.
(Syntax: mv <file name> <directory path> )
11. head Command: The head command is used to display the content of a file. It displays the first 10 lines of a file.
(Syntax: head <file name**>** )
12. tail Command: 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: tail <file name**>** )
Linux User Commands:
13. su (switch user) Command: The su command provides administrative access to another user. In other words, it allows access to the Linux shell to another user.
(Syntax: su <user name>)
14. id Command: The id command is used to display the user ID (UID) and group ID (GID).
(Syntax: id )
15. useradd Command: The useradd command is used to add or remove a user on a Linux server.
(Syntax: useradd <username >)
16. passwd Command: The passwd command is used to create and change the password for a user.
(Syntax: passwd <username> )
17. groupadd Command: The groupadd command is used to create a user group.
(Syntax: groupadd <group name> ).
18. clear command: To clear a full screen ( Syntax : $clear) or from keyboard press ctrl+l
19. history command: It is used to view the previously executed command.
(Syntax: $ history)