DevOps is nothing but a culture where development collaborates with operations to deliver the project faster and in an efficient manner. This is about how quickly can we convert the developed changes to operations or as we call it; production.
So what is linux....what is the need of it going further?
Linux is a part of Unix family which is an open-source free software operating system which was first developed in 1991 by a university student Linus Torvalds. Today, many years later, it has become one of the most preferred OS to be worked upon by the majority of good developers. Approx. 90% of the supercomputers run on different flavours of linux.
Features:
Open source
Allows high-security
Allows multi-users and Multitasking with powerful shell and multiple flavours
Kernel:
A kernel is the heart of Linux OS. According to RedHat "The Linux® kernel is the main component of a Linux operating system (OS) and is the core interface between a computer’s hardware and its processes. It communicates between the 2, managing resources as efficiently as possible.
The kernel is so named because—like a seed inside a hard shell—it exists within the OS and controls all the major functions of the hardware, whether it’s a phone, laptop, server, or any other kind of computer."
So a prominent question arises....is linux a kernel or an OS ?
Well, there is a difference between kernel and OS. Kernel as described above is the heart of OS which is the interactive layer between hardware and application. It manages the core features of an OS while if some useful applications and utilities are added over the kernel, then the complete package becomes an OS. So, it can easily be said that an operating system consists of a kernel space and a user space.
Linux, in its nature, is not an operating system; it’s a Kernel. The Kernel is part of the operating system – And the most crucial. For it to be an OS, it is supplied with GNU software and other additions giving us the name GNU/Linux. The latter is then installed on a computer as a distribution such as Ubuntu, elementary OS, Fedora, OpenSUSE, etc. However, because there are Linux distributions that come paired with more software other than GNU, some people feel we cannot generalize all ‘Linux-Kerneled‘ operating systems as GNU/Linux.
File System Hierarchy:
The Linux Foundation maintains Linux Filesystem Hierarchy Standard (FHS). It defines the directory structure and contents in a UNIX-like operating system. Everything here is stored in the form of directory, each directory contains a file with a tree structure.
Let's have a look over some of the directories and their functionalities:
/root:
The root is the first directory in a directory structure. Every files and directory starts from the root directory.Only the root user of the system has the right to write under the root (/) directory.One another directory with name root is under the root directory (/root) is the home directory of the root user.
/sbin and /bin:
This contains all the system binary and binary executable files (commands) like ifconfig, ip, cp, etc.
/dev:
This directory contains all device files of hardwares like that of USB. Ex- /dev/ttyl, /dev/usbmon0, etc.
/var:
/var contains all the variable files that tend to grow over time. ex - /var/log has all log files generated by OS or application, /var/mail contains all mails, /var/lib has all Database and package file on it, /var/tmp has all temporary files needed for a server reboot.
/boot:
Here the boot GRUB loader is present . All the kernel files are a part of this directory.
/etc:
This directory contains all the configuration related files, which also controls the behaviours of the OS. It also homes the startup and shutdown script programs for the server.
Let's look on to some of the basic commands used:
sudo : switch user do is to allow a user with proper permissions to execute a command as another user or superuser (as per permissions in/etc/sudoers file)
pwd: to check the present working directory
ls: list all the files/directories present within that directory
uname: shows the name of OS kernel
cd: to navigate through directories
date: displays the date and time
history: displays all the commands used for that session
whoami: shows the currently logged in user
File and directory creation, removal and move/rename:
mkdir /test #for a single directory creation
mkdir /dev /test /janahvi #for multiple directory creation
mkdir -p /a/b/c/d #for nested directory creation in a single go
mkdir /multi{1..n} # for n number of directory creation
touch /file #for file creation
touch /file1 /file2 /janahvi #for multiple file creation
touch /files{1..n} #for n number of files to be created
For copy, paste, remove and rename:
cp <options> <source path> <destination path>
options are:
-r : for recurssive (ensures that all subdirectories and files within the directory are copied)
-v : verbose (The verbose option specifies that you want to display detailed processing information on your screen. This is the default. When)
-f : forced copy
cp -rvf /root/a* /home #for copy all files from /root that starts with letter 'a' to /home.
rm -rvf <path of file or directory> #for removal for file or directory
mv <path from where to> <to path where it needs be> #for moving a file
mv <name_previously> <renamed file> #for file rename
Next up we will be covering some of the advanced sections for linux like User/Grup creation, its permissions, finding, scp/ssh and some day-to-day usage of all these.