Everythings about Linux

Everythings about Linux

Linux is a Unix-like, open source and community-developed operating system (OS) for computers, servers, mainframes, and mobile devices. Linux is a kernel, not an actual operating system. It is true that there are some same commands on Linux and Unix but Linux is not made up of UNIX. It was written from scratch. A Linux distribution is the Linux kernel and a collection of software that together, create an operating system. Linux OS/Linux distribution is the combination of Linux kernel and GNU.

Features of Linux/Advantages:-

⇒ Linux is open-source code, it is the free version of code. With the help of this code, we can build our operating system.

⇒ It is the secure version of the operating system(window).

⇒ It is very difficult to hack Linux in comparison to normal Windows because there are plenty of commands on Linux which is a challenge for hackers.

⇒ It is very easy to update the software on Linux or simplify updates for all installed software.

⇒ It occupies very little space so , it is lightweight to use.

⇒ Multiple users - Multiple tasks.

File System Hierarchy :-

⇒ Folder ——> Directory

⇒ Administrator ——> Root User

⇒ File ——→ File

⇒ Software ——→ Package

⇒ / ——→Top Level Directory

⇒ /root ——> It is the home directory for the root user. if we didn’t log in as a user, or work as an administrator then by default we log inside the root. It works as an admin.

⇒ /home ——> Home directory for other users.

⇒ /boot ——> It contains bootable files for Linux. (POST —> power on self-testing).

⇒ /etc ——> It contains all the configuration files, and it contains all the information on hardware (machine).

⇒ /usr ——> By default software is installed in this directory (folder).

⇒ /bin ——> Bin means binary. It contains commands used by all users including the root user (administrator).

⇒ /sbin ——> Sbin means system binary. It contains special commands which are only used by the root user (Administrator).

⇒ /opt ——> Optional application software packages

⇒ /dev ——> Essential devices files This includes terminal devices, USB or any device attached to the system.

Ways of creating files in LINUX:-

There are four ways to create a file in Linux, They are listed below:-

1) Cat:- This is one of the most universal tools, yet all it does is copy standard input to standard output. Once the file is created then it is uneditable or we cannot able to edit the file. There are main four purposes of a cat. They are

⇒Create file

⇒Concatenate file

⇒Copy files

⇒ Add two or more files

2) Touch:- It is used to create an empty file. There are four purposes of using touch command in Linux that are given below:-

⇒ Create an Empty file.

⇒ Create multiple empty files.

⇒ Change all timestamps of a file.

⇒ Update only the access time of the file, and modify the time of the file . It means we can change or update only one file.

3) Vi/Vim:- It is a programmer text editor. It can be used to edit all kinds of plain text, it is specially used for editing programs mainly used for Unix programs. Vi/Vim is more powerful than Nano. Vi/Vim can be easily found in every Linux whereas Nano is only found in specific versions of Linux.

4) Nano:- It is quite easy than Vi/Vim. It is a user-friendly command.

Commands for removing files & directories:-

rmdir ——> This command is used to remove the specific directory (empty).

rmdir -p ——> Remove both the parents and Child directory.

rmdir -pv ——> Remove all the parent and subdirectories along with the box (it means if there is written something it will be deleted).

rm -rf ——> Removes even non-empty files and directories.

rm -rp ——> Remove non-empty directories including parent and subdirectories.

rm -r ——> Remove empty directories.

[Note:- Generally rmdir is used for the directory where rm is used for the file]

Some of the basic commands on Linux:-

Hostname:- Basically, this command is used to check our machine type like which machine we use, and its version command information about the system.

ifconfig:- This is used to know the IP- addresses of the machine.

yum:- yum is a software which is used to install, uninstall, update the version of the package.

which:- which command is used to check install or not only one package which we prefer like which chef.

whoami:- this command is used to check who am i whether I’m a root user or root user.

echo:- echo command in Linux is used to display lines of text/string that are passed as an argument.

useradd:- for adding new user.

cat /etc/passwd:- location to see added user.

groupadd:- for creating a group.

cat /etc/group:- to see the location of the group.

gpasswd -a:- for adding a single user inside the group.

gpasswd -M:- for adding multiple users inside the group.

ln:- for creating a duplicate of the original file.

ln -s:- for creating a shortcut for the file.

tar:- tar is an archiver used to combine multiple files into one just like a zip in the window.

chmod:- used to change the access mode of a file.

chown:- change the owner of the file or directory.

chgrp:- change the group of files or directories.

grep:- it is used to search for a specific word.

Sort:- it is used for arranging in ascending order.

q:- is used to exit from the program.

Head:- We can see 10 commands from the top.

tail:- We can see 10 commands from the bottom.