What is LINUX


What is Linux:-
Linux is a free and open-source Operating-system and this operating system was designed by Linus Torvalds in 1991.
This is typically packaged as a Linux distribution, which includes the kernel and supporting system software and libraries.
Linux terminal can be used to accomplish all administrative tasks such as package installation, to automate functions, file manipulation and user management.
Linux is a very lightweight OS so it can be used in various IOT devices like servers, systems, cellphones, gateways etc., and it can run 24/7/365.
Inspiration: It was inspired by another system called UNIX.
Open-Source meaning:-
Definition: Being "open-source" means that the source code is freely available and can be modified by anyone.
Community Collaborations: Due to its open nature, thousands of developers from worldwide contribute to its improvements.
- example: Think of open-source as a community garden where everyone can plant, water, and enjoy the fruits and vegetables. Anyone can suggest changes or improvements.
Benefits of Using Linux:-
Open Source Nature
Definition: Open Source means the source code of the software is freely available to the public. Anyone can see, modify, and distribute the software.
- example: Think of open-source as a community garden where everyone can plant, water, and enjoy the fruits and vegetables. Anyone can suggest changes or improvements.
Cost-Effective
Definition: Linux can be downloaded, used, and distributed for free.
example: Instead of buying a pricey Productive, you're getting a nutritious and delicious cereal for free.
Security
Definition: Linux is known for its strong security features. Viruses and malware are less.
example: Living in a house with advanced security systems where unwanted guests (viruses) find it hard to get in.
Customizability
Definition: Users can modify Linux to suit their needs, right from the look and feel to core system operations.
example: It’s like customizing a vehicle. You can change its colour, add accessories, or even modify its engine and Looks.
Stability and Reliability
Definition: Linux systems are known to run for years without a crash they can be run 24/7/365.
example: Imagine a car that rarely breaks down or needs a mechanic.
Community Support
Definition: A vast community of users and developers regularly contribute to its improvement and are always ready to assist new users.
example: Moving to a new town but having a huge welcoming committee and helpful neighbours to guide you whenever you need.
Efficient Use of System Resources
Definition: Linux can run on older hardware efficiently, giving it a new life.
example: It’s like a magic potion that lets your old toy run as if it's a brand new toy.
Variety of Distributions
Definition: Linux offers a wide range of "flavours" or versions, each designed for specific needs.
Flavours: Ubuntu, Fedora, Cent Os, Amazon Linux, Red Hat Linux, Kali Linux, etc.,
example: Ice cream comes in various flavours to suit everyone’s taste, from vanilla to seasonal flavours.
Compatibility
Definition: Linux supports various arrays of file systems and is compatible with most programming languages.
example: Imagine a universal power adapter that can fit outlets from any country.
No Forced Upgrades
Definition: Users have the choice to upgrade their system whenever they feel like it.
example: It's like having a phone where you decide when you want to update to a new model, without any sales.
Architecture of Linux:-
Hardware Layer
- Definition: This is the actual physical layer of computers the various components like the CPU, memory, RAM, ROM, GPU, MotherBoard and hard drives.
Kernel
Definition: The kernel is the core part of the OS. It directly interacts with system hardware and manages resources.
example: If the OS is a restaurant, the kernel is the head chef. It oversees all the kitchen activities, ensuring all orders are cooked and ready on time.
Shell
Definition: The shell is an interface for users to communicate with the kernel.
example: The shell is like the counter at a restaurant where you place your order. You tell it what you want, and it conveys your order to the kitchen (kernel).
File System
Definition: It organizes and stores data in a structured manner on storage devices.
example: Imagine a library. The way books are arranged on shelves, categorized by genre, author, etc., is similar to how the file system organizes data.
Basic Commands of Linux:-
File Operations
ls
Lists files and directories.- Example: Think of it as looking at the table of contents in a book.
options:-
ls
ls -la (it lists all files and hidden files & there file permissions & details)
ls -l (it lists all files without hidden files & file permissions & details)
ls -a (it shows only files )
ls -d */ (to list only directories.)
Output:-
cd
Changes the directory.- Example: Imagine moving from one room in your house to another.
syntex:-
cd filename
options:-
cd - ( Go to the last working directory.)
cd .. (Change directory to the one step back dir.)
cd (Change directory to the home directory.)
Output:-
mkdir
Creates a new directory.- Example: It's like building a new shelf in your cupboard.
syntex:-
mkdir filename
options:-
mkdir .filename (Make a hidden directory (also . before a file to make it hidden)
mkdir a b c d 5 (Make multiple directories at the same time.)
mkdir /home/affu/New-Dir ( make a new folder in a specific location)
mkdir -p A/B/C/D (Make a nested directory.)
output:-
rmdir
Removes an empty directory.- Example: Taking out an empty drawer.
syntex:-
rmdir filename
options:-
rm -f file-name (ignore nonexistent files and arguments, never prompt)
rm -r (remove directories and their contents recursively)
rm -d (remove empty directories)
output:-
cp: Copies files or directories.
- Example: Making a photocopy of a document.
syntex:-
cp source-file destination-file
output:-
mv
Moves or renames files and directories.- Example: Shifting a book from one shelf to another or renaming its title.
syntex:-
mv Source-file Destination-file (to Move-file)
mv Source-file Rename (this will change name and file will be in the same Directory)
output:-
moving file
Rename-file
rm: Deletes a file.
Example: Shredding a paper document.
syntex:-
rm filename
options:-
rm -f file-name (ignore nonexistent files and arguments, never prompt)
rm -r (remove directories and their contents recursively)
rm -d (remove empty directories)
output:-
Displaying File Contents
cat
Displays the content of a file.- Example: Reading a page of a book.
syntex:-
cat File_name
output:-
System Operations
top
Displays real-time system stats and processes.
- Example: A leaderboard showing top performers.
top
output:-
shutdown: Shutdown or restart the system.
- Example: Turning off or restarting a device.
shutdown (this will do after 60 sec)
shutdown now (this shutdown imediatily)
reboot (this will restart system)
Current working directory
pwd
current working directoryExample: to know what is our current directory
pwd (Print the name of the current working directory.)
output:-
File Permissions
chmod
Changes file permissions.- Example: Setting who can read or edit a shared document.
syntex:-
chmod [options] [mode] [File_name]
options:-
-R (Apply the permission change recursively to all the files and directories within the specified directory.)
-v (It will display a message for each file that is processed. while indicating the permission change that was made.)
-c (It works same as `-v` but in this case it only displays messages for files whose permission is changed.)
-f (It helps in avoiding display of error messages.)
-h (Change the permissions of symbolic links instead of the files they point to.)
Mode:-
Symbolic mode
| Operators | Definition | | --- | --- | |
+
| Add permissions | |-
| Remove permissions | |=
| Set the permissions to the specified values || Letters | Definition | | --- | --- | |
r
| Read permission | |w
| Write permission | |x
| Execute permission || Reference | Class | | --- | --- | | u | Owner | | g | Group | | o | Others | | a | All (owner, groups, others) |
Examples of Using the Symbolic Mode:
- Read, write and execute permissions to the file owner:
chmod u+rwx [file_name]
- Remove write permission for the group and others:
chmod go-w [file_name]
- Read and write for the Owner, and read-only for the group and others:
chmod u+rw,go+r [file_name]
Octal mode
It is also a method for specifying permissions. In this method, we specify permission using a three-digit number. Where.
The first digit specifies the permission of the Owner.
The second digit specifies the permission for the Group.
The third digit specifies the permission for Others. The digits
NOTE: The digits are calculated by adding the values of the individual permissions.
Value | Permission |
4 | Read Permission |
2 | Write Permission |
1 | Execute Permission |
Examples of Using the Octal mode:
Suppose we give read and write permission to the file Owner. Read, write and executable permission to the Group. Read-only permission to the Other. They our command would be.
chmod 674 [file_name]
Here.
6 represents permission of the file Owner which is (rw).
7 represents permission of Group which is (rwx).
4 represents permission of Other which is (r).
Happy Learning
Thanks For Reading! :)
Subscribe to my newsletter
Read articles from Afroz Shaik directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
