<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rishabh Prakash singh</title>
    <description>The latest articles on DEV Community by Rishabh Prakash singh (@rishabhprakashsingh07).</description>
    <link>https://dev.to/rishabhprakashsingh07</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3764380%2F576ac3b1-9369-409b-9fba-d46c44ddca95.jpg</url>
      <title>DEV Community: Rishabh Prakash singh</title>
      <link>https://dev.to/rishabhprakashsingh07</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rishabhprakashsingh07"/>
    <language>en</language>
    <item>
      <title>Networking basic notes</title>
      <dc:creator>Rishabh Prakash singh</dc:creator>
      <pubDate>Mon, 23 Feb 2026 18:08:37 +0000</pubDate>
      <link>https://dev.to/rishabhprakashsingh07/networking-basic-notes-2568</link>
      <guid>https://dev.to/rishabhprakashsingh07/networking-basic-notes-2568</guid>
      <description>&lt;p&gt;What is a bit ? &lt;/p&gt;

&lt;p&gt;A bit is the smallest unit of data in computing.&lt;br&gt;
In simple terms:&lt;br&gt;
A bit can have only two values:&lt;br&gt;
 0 or 1&lt;/p&gt;

&lt;p&gt;These represent off/on, false/true, no/yes&lt;/p&gt;

&lt;p&gt;Why only 0 and 1?&lt;br&gt;
Computers work using electricity:&lt;br&gt;
No current → 0&lt;/p&gt;

&lt;p&gt;Current present → 1&lt;/p&gt;

&lt;p&gt;This makes bits very reliable for machines.&lt;br&gt;
Example:&lt;br&gt;
1 bit → can store one decision (yes or no)&lt;/p&gt;

&lt;p&gt;8 bits = 1 byte&lt;/p&gt;

&lt;p&gt;Example: 01000001 = letter A&lt;/p&gt;

&lt;p&gt;Real-world analogy:&lt;br&gt;
Think of a light switch:&lt;br&gt;
OFF → 0&lt;/p&gt;

&lt;p&gt;ON → 1&lt;/p&gt;

&lt;p&gt;That switch is like a bit.&lt;br&gt;
Bigger units built from bits:&lt;br&gt;
8 bits = 1 byte&lt;/p&gt;

&lt;p&gt;1024 bytes = 1 KB&lt;/p&gt;

&lt;p&gt;1024 KB = 1 MB&lt;/p&gt;

&lt;p&gt;And what is a byte then ? &lt;/p&gt;

&lt;p&gt;A byte is a group of bits.&lt;br&gt;
Simple definition:&lt;br&gt;
1 byte = 8 bits&lt;/p&gt;

&lt;p&gt;It is the basic unit used to store data&lt;/p&gt;

&lt;p&gt;Why 8 bits?&lt;br&gt;
With 8 bits, a byte can represent:&lt;br&gt;
256 different values (0–255)&lt;/p&gt;

&lt;p&gt;Enough to store:&lt;/p&gt;

&lt;p&gt;A letter (A, b)&lt;/p&gt;

&lt;p&gt;A number&lt;/p&gt;

&lt;p&gt;A symbol (@, #)&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
Letter A → 01000001 (8 bits = 1 byte)&lt;/p&gt;

&lt;p&gt;Digit 5 → stored as a byte&lt;/p&gt;

&lt;p&gt;A small image pixel color value → stored in bytes&lt;/p&gt;

&lt;p&gt;Real-world analogy:&lt;br&gt;
If a bit is a single switch,&lt;br&gt;
 a byte is a row of 8 switches working together.&lt;br&gt;
Common data sizes:&lt;br&gt;
1 byte → one character (a)&lt;/p&gt;

&lt;p&gt;1024 bytes → 1 KB&lt;/p&gt;

&lt;p&gt;1024 KB → 1 MB&lt;/p&gt;

&lt;p&gt;1024 MB → 1 GB&lt;/p&gt;

&lt;p&gt;Why bytes matter:&lt;br&gt;
File sizes are measured in bytes&lt;/p&gt;

&lt;p&gt;Memory (RAM) is organized in bytes&lt;/p&gt;

&lt;p&gt;Storage (SSD, HDD) is counted in bytes&lt;/p&gt;

&lt;p&gt;A byte is made of 8 bits and is used to store a single piece of meaningful data, like a character.&lt;/p&gt;

&lt;p&gt;Addressing -&lt;/p&gt;

&lt;p&gt;It is of 2 types - &lt;/p&gt;

&lt;p&gt;1 - physical addressing &lt;br&gt;
2 - logical addressing &lt;/p&gt;

&lt;p&gt;Imagine a hotel 🏨&lt;br&gt;
Room number → Logical address&lt;/p&gt;

&lt;p&gt;Actual location of the room in the building → Physical address&lt;/p&gt;

&lt;p&gt;You tell the receptionist the room number.&lt;br&gt;
 The hotel system maps it to the actual room location.&lt;br&gt;
You never see the physical location directly.&lt;/p&gt;

&lt;p&gt;Logical Address&lt;br&gt;
Physical Address&lt;br&gt;
Used by program&lt;br&gt;
Used by RAM&lt;br&gt;
Virtual&lt;br&gt;
Real&lt;br&gt;
Safe&lt;br&gt;
Hardware-level&lt;/p&gt;

&lt;p&gt;Program uses logical address, computer uses physical address&lt;br&gt;
*Physical addressing - under physical addressing there comes - “ Mac addressing “&lt;/p&gt;

&lt;p&gt;Mac Addressing - &lt;br&gt;
Permanent address of a network device&lt;/p&gt;

&lt;p&gt;Given by the manufacturer&lt;/p&gt;

&lt;p&gt;Works at hardware level&lt;/p&gt;

&lt;p&gt;Used inside the local network&lt;/p&gt;

&lt;p&gt;Uses— Identifies a specific network device&lt;/p&gt;

&lt;p&gt;Used for communication inside a local network (LAN)&lt;/p&gt;

&lt;p&gt;Helps switches deliver data to the correct device&lt;/p&gt;

&lt;p&gt;MAC address is never used on the internet&lt;br&gt;
It works only inside the local network&lt;/p&gt;

&lt;p&gt;Key Points:&lt;br&gt;
Cannot be changed easily&lt;/p&gt;

&lt;p&gt;Unique for every device&lt;/p&gt;

&lt;p&gt;Works at Layer 2 (Data Link Layer)&lt;/p&gt;

&lt;p&gt;*Logical Addressing - under logical addressing comes - “ IP addressing”&lt;/p&gt;

&lt;p&gt;IP Address &lt;br&gt;
Assigned by network or ISP&lt;/p&gt;

&lt;p&gt;Can change (Wi-Fi, mobile data, DHCP)&lt;/p&gt;

&lt;p&gt;Used to identify device across networks&lt;/p&gt;

&lt;p&gt;Works at software level&lt;/p&gt;

&lt;p&gt;Key Points:&lt;br&gt;
Can change anytime&lt;/p&gt;

&lt;p&gt;Not tied to hardware&lt;/p&gt;

&lt;p&gt;Works at Layer 3 (Network Layer)&lt;/p&gt;

&lt;p&gt;*Uses - &lt;br&gt;
Identifies a device on a network or the internet&lt;/p&gt;

&lt;p&gt;Helps data travel between different networks&lt;/p&gt;

&lt;p&gt;Used by routers to decide where to send data&lt;/p&gt;

&lt;p&gt;Real-life use:&lt;br&gt;
When you open Google.com, your IP helps:&lt;/p&gt;

&lt;p&gt;Find Google’s server&lt;/p&gt;

&lt;p&gt;Route data across the internet&lt;/p&gt;

&lt;p&gt;Without IP addressing, internet communication is impossible&lt;/p&gt;

&lt;p&gt;IP Address is made of two things - &lt;br&gt;
= Network ID + Host ID&lt;/p&gt;

&lt;p&gt;*Important Addressing that comes under physical addressing - &lt;/p&gt;

&lt;p&gt;Mac addressing - it is of “48 bits”&lt;/p&gt;

&lt;p&gt;*In logical addressing comes - &lt;br&gt;
IP V4 &lt;br&gt;
IP V6&lt;/p&gt;

&lt;p&gt;In these IP comes 2 types of IP’s - &lt;/p&gt;

&lt;p&gt;Public IP &lt;br&gt;
Private IP&lt;/p&gt;

&lt;p&gt;*IP V4 - &lt;/p&gt;

&lt;p&gt;Full form - Internet protocol &lt;br&gt;
IP is the thing through which you send send message from place to another.&lt;/p&gt;

&lt;p&gt;It is a 32 bit logical address&lt;br&gt;
It have 4 octet&lt;br&gt;
It have values ranging from and between - ( 0 - 255 ) in every octet&lt;br&gt;
IP address is made of 2 things - ( Network ID + Host ID )&lt;/p&gt;

&lt;p&gt;IP is always written in 4 octets - &lt;/p&gt;

&lt;p&gt;Each octet is made up of 8 Bits&lt;/p&gt;

&lt;p&gt;Maximum value in a IP is 255 , minimum is 0&lt;/p&gt;

&lt;p&gt;*IP Addresses have 5 classes - &lt;/p&gt;

&lt;p&gt;Classes - &lt;/p&gt;

&lt;p&gt;Class A -  1.000 to 126.000&lt;br&gt;
Class B - 128.000 to 191.255.00&lt;br&gt;
Class C - 192.000 to 223.255.255.00&lt;br&gt;
Class D - 224.000 to 239&lt;br&gt;
Class E - 240 - 255&lt;/p&gt;

&lt;p&gt;( “IP 127.000” is reserved for special purpose - “ Loop back address” &lt;/p&gt;

&lt;p&gt;( If you are unable to use internet or there is an issue with internet then using this you can see if the issue is “hardware level or software level”  &lt;/p&gt;

&lt;p&gt;( like when you type ping 127.0.0.1 and if you get response then the issue might be software level ( internet not being received from backend ) ( and if you didn’t receive a response there might be some hardware issue like in network card of PC )&lt;/p&gt;

&lt;p&gt;The loopback address is a special IP address used by a device to communicate with itself.&lt;/p&gt;

&lt;p&gt;127.0.0.0 – 127.255.255.255&lt;br&gt;
This entire block is reserved for loopback.&lt;/p&gt;

&lt;p&gt;What Does It Do?&lt;br&gt;
When you send traffic to 127.0.0.1, the data:&lt;br&gt;
Does NOT go to the network&lt;/p&gt;

&lt;p&gt;Does NOT leave your machine&lt;/p&gt;

&lt;p&gt;Is routed internally by your OS&lt;/p&gt;

&lt;p&gt;It is used to test the TCP/IP stack.&lt;/p&gt;

&lt;p&gt;ping 127.0.0.1&lt;br&gt;
If this works:&lt;/p&gt;

&lt;p&gt;Your network stack is functioning&lt;/p&gt;

&lt;p&gt;TCP/IP is properly installed&lt;/p&gt;

&lt;p&gt;If it fails:&lt;/p&gt;

&lt;p&gt;There is a serious OS-level networking issue&lt;/p&gt;

&lt;p&gt;Where It Is Used&lt;br&gt;
Testing web servers locally&lt;br&gt;
 Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://127.0.0.1" rel="noopener noreferrer"&gt;http://127.0.0.1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Database servers running locally&lt;/p&gt;

&lt;p&gt;Application development&lt;/p&gt;

&lt;p&gt;Troubleshooting networking&lt;/p&gt;

&lt;p&gt;It is a old concept when and people never thought we might run into a IP shortage in future&lt;/p&gt;

&lt;p&gt;*Genrally we don’t use - Class D and Class E as they are reserved -&lt;/p&gt;

&lt;p&gt;Class D - for Multi cast / special work&lt;br&gt;
Class E - For Research &lt;/p&gt;

&lt;p&gt;*We use class A , B , C -&lt;/p&gt;

&lt;p&gt;Class A - is called a “ Large network” ( If you want to make a large network and give out more IP’s ) &lt;/p&gt;

&lt;p&gt;Class B - &lt;/p&gt;

&lt;p&gt;Class  C - is called a “small network” ( If you want to make a small network and allocate / give out fewer IP’s )&lt;/p&gt;

&lt;p&gt;We generally don’t work on public IP , we think we are working on public but in the end it’s a private IP we too have borrowed from a firm or anything anyone.&lt;/p&gt;

&lt;p&gt;*What if someone asks a particular IP address class -&lt;/p&gt;

&lt;p&gt;Example - 137.20.20.10 ( tell the class of this IP address ) &lt;br&gt;
Nothing to do when telling a IP address class just look at the “first octet”&lt;br&gt;
Here it is - “137” and it lies in “class B” so this is the class if this IP address.&lt;/p&gt;

&lt;p&gt;*What if someone asks what is the “network ID” of a IP address?&lt;/p&gt;

&lt;p&gt;Simple way to learn - &lt;/p&gt;

&lt;p&gt;Just remember this - &lt;/p&gt;

&lt;p&gt;Class A - have 1 Network octet reserved and rest 3 are reserved for host ID &lt;/p&gt;

&lt;p&gt;N&lt;br&gt;
H&lt;br&gt;
H&lt;br&gt;
H&lt;/p&gt;

&lt;p&gt;Class B - Have 2 network octet reserved for network ID and 2 reserved for host ID &lt;/p&gt;

&lt;p&gt;N&lt;br&gt;
N&lt;br&gt;
H&lt;br&gt;
H&lt;/p&gt;

&lt;p&gt;Class C - Have 3 network octet reserved for network ID and 1 reserved for host ID &lt;/p&gt;

&lt;p&gt;N&lt;br&gt;
N&lt;br&gt;
N&lt;br&gt;
H&lt;/p&gt;

&lt;p&gt;N = Network , H = Host&lt;/p&gt;

&lt;p&gt;Network ID is denoted by - “ 1”  and Host ID is denoted by - “ 0 “&lt;/p&gt;

&lt;p&gt;N = 1&lt;br&gt;
H = 0&lt;/p&gt;

&lt;p&gt;Example - Tell network ID of this IP Address - &lt;br&gt;
115.20.15.240&lt;/p&gt;

&lt;p&gt;Answer -  first look in which class does is fall - &lt;/p&gt;

&lt;p&gt;It falls in Class A - class A have 1 Network octet reserved and 3 Host octet&lt;/p&gt;

&lt;p&gt;Final Answer = 115.0.0.0 - network ID&lt;/p&gt;

&lt;p&gt;( The value on which 1 comes write that and write the rest as 0 )&lt;/p&gt;

&lt;p&gt;Example 2 - find network of this - 140.20.15.10&lt;/p&gt;

&lt;p&gt;( this falls under class B ) &lt;/p&gt;

&lt;p&gt;Answer - 140 20.0.0 - network ID&lt;/p&gt;

&lt;p&gt;*What if someone asks tell the subnet mask of a particular IP given?&lt;/p&gt;

&lt;p&gt;Example - 115.20.30.20&lt;/p&gt;

&lt;p&gt;As mentioned above Network ID and Host ID is represented by 1 and 0 ( N - 1 , H = 0 )&lt;/p&gt;

&lt;p&gt;115.20.30.20 - This falls in Class A &lt;/p&gt;

&lt;p&gt;N&lt;br&gt;
H&lt;br&gt;
H&lt;br&gt;
H&lt;/p&gt;

&lt;p&gt;( N = 1 , H = 0 )&lt;/p&gt;

&lt;p&gt;11111111.00000000.00000000.00000000 ( binary value )&lt;/p&gt;

&lt;p&gt;Subnet mask will be ( decimal value ) - 255.0.0.0&lt;/p&gt;

&lt;p&gt;( 8 TIMES 1 because 1 octet have 8 bits , and the value on which 1 comes  we have to write that and here that value is 115 )&lt;/p&gt;

&lt;p&gt;Example 2 - 193.50.15.20&lt;/p&gt;

&lt;p&gt;Tell the subnet mask of this IP address - &lt;/p&gt;

&lt;p&gt;Answer  = this falls under Class C &lt;/p&gt;

&lt;p&gt;N &lt;br&gt;
N&lt;br&gt;
N&lt;br&gt;
H&lt;/p&gt;

&lt;p&gt;Binary value - 11111111.11111111.11111111.00000000 &lt;br&gt;
Subnet mask  - 255.255.255.0&lt;/p&gt;

&lt;p&gt;*Convert a IP address into binary?&lt;/p&gt;

&lt;p&gt;Example - 192.168.37.200&lt;/p&gt;

&lt;p&gt;We know that each have 8 bits - maximum value of a bit is 255&lt;/p&gt;

&lt;p&gt;2 power 0 = 1&lt;br&gt;
2 power 1 = 2&lt;br&gt;
2 power 3 = 8&lt;br&gt;
2 power 4 = 16&lt;br&gt;
2 power 5 = 32 &lt;br&gt;
2 power 6 = 64&lt;br&gt;
2 power 7 = 128&lt;/p&gt;

&lt;p&gt;Just write this value this question is aksed or even vice a versa&lt;/p&gt;

&lt;p&gt;Don’t write more than 128 &lt;/p&gt;

&lt;p&gt;Now we want to make 192 - just add the values which will make 192 ( all combined values from 1 - 128 will make 255 , and whatever you add using these the answer will come to 255 or less so for converting to binary you just need these values ( 1 to 128 )&lt;/p&gt;

&lt;p&gt;Now 192 = &lt;/p&gt;

&lt;p&gt;(128 64 32 16 8 4 2 1)&lt;/p&gt;

&lt;p&gt;192 = 128 + 64 &lt;/p&gt;

&lt;p&gt;So , as said the numbers which are used in addition or we say used to make that particular number we will mark them as 1 and others rest as 0 &lt;/p&gt;

&lt;p&gt;In here number 128 and 64 were used to make 192 , &lt;/p&gt;

&lt;p&gt;The binary og 192 will be - 11000000 - 192&lt;/p&gt;

&lt;p&gt;128&lt;br&gt;
64&lt;br&gt;
32&lt;br&gt;
16&lt;br&gt;
8&lt;br&gt;
4&lt;br&gt;
2&lt;br&gt;
1&lt;br&gt;
1&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
0&lt;/p&gt;

&lt;p&gt;Now the next number is 168 - &lt;/p&gt;

&lt;p&gt;128&lt;br&gt;
64&lt;br&gt;
32&lt;br&gt;
16&lt;br&gt;
8&lt;br&gt;
4&lt;br&gt;
2&lt;br&gt;
1&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
0&lt;/p&gt;

&lt;p&gt;The next - 37 &lt;/p&gt;

&lt;p&gt;128&lt;br&gt;
64&lt;br&gt;
32&lt;br&gt;
16&lt;br&gt;
8&lt;br&gt;
4&lt;br&gt;
2&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
1&lt;/p&gt;

&lt;p&gt;The next is - 200&lt;/p&gt;

&lt;p&gt;128&lt;br&gt;
64&lt;br&gt;
32&lt;br&gt;
16&lt;br&gt;
8&lt;br&gt;
4&lt;br&gt;
2&lt;br&gt;
1&lt;br&gt;
1&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
1&lt;br&gt;
0&lt;br&gt;
0&lt;br&gt;
0&lt;/p&gt;

&lt;p&gt;So the binary value of 192.168.37.200 is = &lt;/p&gt;

&lt;p&gt;11000000.10101000.00100101.11001000 - Binary&lt;/p&gt;

&lt;p&gt;And vice a versa is also possible with this - &lt;/p&gt;

&lt;p&gt;If the ask is to convert a binary into decimal then same method is used &lt;/p&gt;

&lt;p&gt;*Private IP&lt;/p&gt;

&lt;p&gt;A private IP address is an IP address used inside a local network and not routable on the public internet.( schools , colleges etc )&lt;br&gt;
These addresses are reserved and cannot be used directly on the internet.&lt;/p&gt;

&lt;p&gt;In Class A the Private IP reserved is - 10.0.0.0&lt;/p&gt;

&lt;p&gt;Very large private network&lt;/p&gt;

&lt;p&gt;Often used in enterprises and cloud networks&lt;/p&gt;

&lt;p&gt;In Class B the private IP reserved is - 172.16.0.0 – 172.31.255.255&lt;/p&gt;

&lt;p&gt;Used in medium sized private network&lt;/p&gt;

&lt;p&gt;In Class C the private IP reserved is - 192.168.0.0 &lt;/p&gt;

&lt;p&gt;Used in homes and small offices &lt;/p&gt;

&lt;p&gt;*public IP and Private IP difference - &lt;/p&gt;

&lt;p&gt;You have to purchase the Public IP whereas you don’t have to purchase a private IP.&lt;/p&gt;

&lt;p&gt;*How to know how many computers you can connect in 1 IP and what is a broadcast IP and Usable host -&lt;/p&gt;

&lt;p&gt;Example - ques - 150.10.20.30 &lt;br&gt;
Tell network ID &lt;br&gt;
Tell Broadcast ID&lt;br&gt;
No of Usable Host &lt;/p&gt;

&lt;p&gt;Network ID = ( As this is from class B ) - 150.10.0.0&lt;/p&gt;

&lt;p&gt;Broadcast  - A broadcast address is a special IP address used to send data to all devices inside a network at once.&lt;/p&gt;

&lt;p&gt;Broadcast ID - as we saw above the network ID of the IP is 150.10.0.0&lt;/p&gt;

&lt;p&gt;Just remember the host part which you marked as 0 above or in any class IP , just assign that 0 the maximum value of a bit that is - 255&lt;/p&gt;

&lt;p&gt;So the broadcast ID = 150.10.255.255&lt;/p&gt;

&lt;p&gt;Now the question remains how many usable hosts ( computers ) i can put make allocate  in this network &lt;/p&gt;

&lt;p&gt;See in the above broadcast ID we had 2 network ID and 2 host ID ( because it’s class B ) &lt;/p&gt;

&lt;p&gt;While finding out usable hosts we see host ID like how many host ID’s are there according to class here it is class B &lt;/p&gt;

&lt;p&gt;So we have 2 host ID’s which means = ( as 1 octet have 8 bites ) here we have (2 octets)  8+8 = 16 bits total , so , the the way to find the usable hosts will be &lt;/p&gt;

&lt;p&gt;2^16 - 2 = 65,534 IP &lt;/p&gt;

&lt;p&gt;( -2 because 1st IP is network IP and the last IP ( 255 ) is broadcast IP these are used for special person  , ALWAYS PUT - 2 WHEN USABLE IP IS ASKED ) &lt;/p&gt;

&lt;p&gt;When total IP is asked we don’t have to put - 2 there.&lt;/p&gt;

&lt;p&gt;Ques 2 - 11.200.200.200&lt;/p&gt;

&lt;p&gt;Find network ID &lt;br&gt;
Broadcast ID &lt;br&gt;
Usable Host ID&lt;/p&gt;

&lt;p&gt;Network ID - ( As this is from Class A )  - 11.0.0.0&lt;/p&gt;

&lt;p&gt;Broadcast ID - 11.255.255.255&lt;/p&gt;

&lt;p&gt;Usable Host ID - 2^24 - 2 = 16,777,214&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Transmission Modes&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Simplex Mode&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Definition: One-way communication only. Data flows in a single direction from sender to receiver.&lt;/p&gt;

&lt;p&gt;Key Points:&lt;br&gt;
Only one device can send, the other can only receive&lt;br&gt;
Receiver cannot send data back to the sender&lt;br&gt;
Most basic and simple form of communication&lt;/p&gt;

&lt;p&gt;Real-World Examples:&lt;br&gt;
Keyboard to Computer: You type on keyboard, it sends data to computer (keyboard never receives data back)&lt;br&gt;
Television Broadcasting: TV station sends signal to your TV (your TV cannot send data back to the station)&lt;br&gt;
Radio Stations: Radio tower transmits, your radio receives (you can't transmit back)&lt;br&gt;
Computer Mouse: Mouse sends movement data to computer only&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Half-Duplex Mode&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Definition: Two-way communication, but only one direction at a time. Devices take turns sending and receiving.&lt;/p&gt;

&lt;p&gt;Key Points:&lt;br&gt;
Both devices can send and receive data&lt;br&gt;
But NOT at the same time&lt;br&gt;
One must wait for the other to finish&lt;br&gt;
Like a one-lane bridge where traffic alternates&lt;/p&gt;

&lt;p&gt;Real-World Examples:&lt;br&gt;
Walkie-Talkie: You press button to talk, release to listen. Both people can't talk simultaneously&lt;br&gt;
CB Radio: One person speaks while others listen, then someone else takes turn&lt;br&gt;
Old Intercom Systems: Press button to speak, release to hear response&lt;br&gt;
Some WiFi Networks: Can send or receive at any moment, but not both simultaneously&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Full-Duplex Mode&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Definition: Two-way communication where both devices can send and receive data simultaneously.&lt;/p&gt;

&lt;p&gt;Key Points:&lt;br&gt;
Both devices can transmit and receive at the same time&lt;br&gt;
No waiting required&lt;br&gt;
Most efficient but requires more resources&lt;br&gt;
Like a two-lane road with traffic flowing both ways&lt;/p&gt;

&lt;p&gt;Real-World Examples:&lt;br&gt;
Telephone Conversation: Both people can talk and hear at the same time (though it's rude!)&lt;br&gt;
Video Calls (Zoom, Skype): You can see and hear the other person while they see and hear you simultaneously&lt;br&gt;
Modern Ethernet Networks: Data can flow both directions on the cable at once&lt;br&gt;
Chat Applications: You can send messages while receiving them&lt;/p&gt;

</description>
      <category>networking</category>
    </item>
    <item>
      <title>Linux Notes</title>
      <dc:creator>Rishabh Prakash singh</dc:creator>
      <pubDate>Mon, 23 Feb 2026 17:51:29 +0000</pubDate>
      <link>https://dev.to/rishabhprakashsingh07/linux-notes-298j</link>
      <guid>https://dev.to/rishabhprakashsingh07/linux-notes-298j</guid>
      <description>&lt;p&gt;*sudo su - cammand for root access, to become root user. ( Sudo -l )&lt;/p&gt;

&lt;p&gt;Folders = directory in linux &lt;br&gt;
Administrator = root user &lt;br&gt;
Software = package &lt;/p&gt;

&lt;p&gt;File system hierarchy &lt;/p&gt;

&lt;p&gt;Forward slash ( / ) = top level root directory &lt;/p&gt;

&lt;p&gt;( Top level root directory - It is the foundation or starting point of the entire storage structure on a device. )&lt;/p&gt;

&lt;p&gt;/Root = home directory for root user &lt;/p&gt;

&lt;p&gt;/Home = home directory for other user&lt;/p&gt;

&lt;p&gt;/Boot = contains bootable files for linux &lt;/p&gt;

&lt;p&gt;( POST - Power on self test ) &lt;/p&gt;

&lt;p&gt;/Etc - contains all configuration files &lt;/p&gt;

&lt;p&gt;/Usr - by default software are installed in this directory &lt;/p&gt;

&lt;p&gt;/Bin ( full form - binary) = contains commands used by all users including root user.&lt;/p&gt;

&lt;p&gt;/Sbin ( full form - System binary ) = contains commands used only by root user &lt;/p&gt;

&lt;p&gt;/Opt = optional application software package ( eg - installing chrome in linux ) &lt;/p&gt;

&lt;p&gt;/Dev = essential device files , includes terminal devices , usb or any device attached to the system ( eg - printer , pen drive ) &lt;/p&gt;

&lt;p&gt;*Linux commands and it's use cases&lt;/p&gt;

&lt;p&gt;*Cat Command - &lt;/p&gt;

&lt;p&gt;Uses - 1 - create file - create single file &lt;/p&gt;

&lt;p&gt;2 - concatenate file - to add more than 1 file into a single file&lt;/p&gt;

&lt;p&gt;3 - Copy files - To copy the content of X file into Y file &lt;/p&gt;

&lt;p&gt;4 - Tac - To see content in bottom to top ( neeche se uppar ) &lt;/p&gt;

&lt;p&gt;( Linux is case sensitive ( use small letters) &lt;/p&gt;

&lt;p&gt;To make single file - &lt;/p&gt;

&lt;p&gt;cat &amp;gt; file1 ( enter ) &lt;br&gt;
Write content ( for exit press cntrl D ) &lt;/p&gt;

&lt;p&gt;ls ( to view folder ) &lt;/p&gt;

&lt;p&gt;Cat file1 ( to view file content ) &lt;/p&gt;

&lt;p&gt;To add content in file - &lt;/p&gt;

&lt;p&gt;cat &amp;gt;&amp;gt; file1 ( enter ) &lt;br&gt;
Write content &lt;/p&gt;

&lt;p&gt;ls ( to view file ) &lt;/p&gt;

&lt;p&gt;cat file1 &lt;/p&gt;

&lt;p&gt;To copy data from 1 file to another - cammand - &lt;br&gt;
Cat file1 &amp;gt;file2 ( it will copy file data from file1 to file 2 and delete file 2 data. &lt;/p&gt;

&lt;p&gt;For data to be inverted or from bottom to top - cammand - &lt;br&gt;
tac file1 &lt;/p&gt;

&lt;p&gt;Now to add both file1 and file2 - &lt;/p&gt;

&lt;p&gt;cat file1 file2 &amp;gt; all&lt;br&gt;
 ls ( enter ) &lt;br&gt;
cat all ( enter ) &lt;br&gt;
Content of both file1 and file2 visible &lt;/p&gt;

&lt;p&gt;Next command for creating file &lt;/p&gt;

&lt;p&gt;*Touch command ( main purpose is Timestamp of file ) &lt;/p&gt;

&lt;p&gt;Uses - &lt;/p&gt;

&lt;p&gt;1 - create empty file &lt;br&gt;
2 - create multiple empty file &lt;br&gt;
3 - change all Timestamp of a file ( total 3 ) &lt;br&gt;
4 - update only 1 Timestamp out of 3 &lt;/p&gt;

&lt;p&gt;What is Timestamp - time when files was created modified. 3 types - &lt;/p&gt;

&lt;p&gt;1 - access time - last time when a file was access. ( touch -a ) &lt;/p&gt;

&lt;p&gt;2 - modify time - last time when a file was modified.( Edited , added anything in file ) ( touch -m ) &lt;/p&gt;

&lt;p&gt;3 - change time - last time when file metadata was changed. ( Like size , properties if it's pdf file , word file any changes in that , location etc ) &lt;/p&gt;

&lt;p&gt;Cammand - ( stat ) eg - stat file1 ( this cammand is for checking timestamp ) &lt;/p&gt;

&lt;p&gt;Cammand for creating file using touch cammand - &lt;/p&gt;

&lt;p&gt;touch file1 ( for creating single file ) &lt;/p&gt;

&lt;p&gt;touch file1 file2 file3 ( for creating multiple files ) &lt;/p&gt;

&lt;p&gt;touch -a ( file name ) for editing access stat&lt;br&gt;
touch -m ( file name ) for editing modify stat&lt;/p&gt;

&lt;p&gt;*Vi editor&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a programmer text editor &lt;/li&gt;
&lt;li&gt;can be used to edit all kinds of plain text, usefull for editing programs mainly used for Unix programs &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;:w - to save &lt;br&gt;
:wq or X - to save and quit &lt;br&gt;
:q - quit&lt;br&gt;
:q! - force quit , no save&lt;/p&gt;

&lt;p&gt;Vi is available in all linux distro , nano is not &lt;/p&gt;

&lt;p&gt;Cammand - vi ( file name you want then press enter ) &lt;br&gt;
Type anything for closing the file - ( :wq ) to save and quit &lt;/p&gt;

&lt;p&gt;*Nano cammand - &lt;/p&gt;

&lt;p&gt;Cammand - nano ( file name then press enter ) &lt;br&gt;
Write the content then press - ( cntrl  + x ) for quitng editor and then press - shift + Y or capital Y for saving the file. Then press enter for coming to terminal. &lt;/p&gt;

&lt;p&gt;Now if we want to edit something in this file using nano or vi ,enter file with cammand - vi or nano  file name enter &lt;/p&gt;

&lt;p&gt;Cammands - &lt;/p&gt;

&lt;p&gt;ls -l  ( long list , details of all the files we have created. &lt;br&gt;
ll  ( also works ) two times L&lt;/p&gt;

&lt;p&gt;ls -a ( for hidden files ) &lt;/p&gt;

&lt;p&gt;history ( for history of all commands used ) &lt;/p&gt;

&lt;p&gt;*How to create a directory&lt;/p&gt;

&lt;p&gt;mkdir ( name of directory) eg - rishabh folder ( mkdir rishabhfolder)&lt;/p&gt;

&lt;p&gt;To make directories inside directories ( folders inside folders ) at once - cammand - &lt;/p&gt;

&lt;p&gt;Mkdir  - p rishabhfolder 1/rishabh folder2/rishabhfolder3 &lt;/p&gt;

&lt;p&gt;rishabhfolder1 is the main folder that we will see after typing ls to view , and rishabhfolder2 and rishabhfolder3 are inside rishabhfolder1 &lt;/p&gt;

&lt;p&gt;(- here the forward slashes are used for separation not indicating root. For root slashes are written at the start. )&lt;/p&gt;

&lt;p&gt;Now a new cammand is there to see the folders inside of rishabhfolder1  - cammand Is - &lt;/p&gt;

&lt;p&gt;Cd   ( meaning change directory) &lt;/p&gt;

&lt;p&gt;Eg - cd rishabhfolder1 &lt;/p&gt;

&lt;p&gt;Now type - ls to see the items inside directory rishabhfolder1&lt;br&gt;
We will see rishabhfolder2 and rishabhfolder3 &lt;/p&gt;

&lt;p&gt;Again to enter - type cd&lt;/p&gt;

&lt;p&gt;Eg - cd rishabhfolder2&lt;/p&gt;

&lt;p&gt;Now we will enter rishabhfolder2 &lt;/p&gt;

&lt;p&gt;To go directly into a folder type all folders name and putting slashe in between - &lt;/p&gt;

&lt;p&gt;Eg - folder names are - rishabhfolder1 ,rishabhfolder2 , rishabhfolder3 &lt;/p&gt;

&lt;p&gt;Cammand - cd  rishabhfolder1/rishabhfolder2/rishabhfolder3&lt;/p&gt;

&lt;p&gt;Type - ls to see content of this folder. &lt;/p&gt;

&lt;p&gt;To get out of this directory ( folder ) - cammand - &lt;/p&gt;

&lt;p&gt;cd.. ( to go back to parent directory) &lt;/p&gt;

&lt;p&gt;( Dotes batayegi ki kitne or konse folder pe return ayenge ) &lt;br&gt;
Eg - cd.. me double dot hai to agar hum rishabhfolder3 me hai to is cammand ke baad rishabhfolder2 me ayenge ) &lt;/p&gt;

&lt;p&gt;Agar direct bahar aana root user pe then we can also run cammantin one go by knowing the internet which directory we are in to utne dot lagane hai &lt;/p&gt;

&lt;p&gt;To know in which directory we are in this cammand is used - &lt;/p&gt;

&lt;p&gt;pwd - ( print working directory) used to know the patch ( path kya hai hamara current) &lt;/p&gt;

&lt;p&gt;By using this we will know in which directory we are in and help us get of that. &lt;/p&gt;

&lt;p&gt;Eg - if we are in rishabhfolder3 then cammand will be - &lt;/p&gt;

&lt;p&gt;Cd/../../.. ( enter ) &lt;/p&gt;

&lt;p&gt;After this we will be on root user. &lt;/p&gt;

&lt;p&gt;*How to hide a file - &lt;/p&gt;

&lt;p&gt;Just add a DOT before a file or a directory ( folder ). &lt;/p&gt;

&lt;p&gt;Eg - touch .rishabhfolder1&lt;/p&gt;

&lt;p&gt;To see hidden file or directory - ls -a ( A stands for All ) &lt;/p&gt;

&lt;p&gt;*How to copy a file - &lt;/p&gt;

&lt;p&gt;Cammand - cp &lt;/p&gt;

&lt;p&gt;Eg - if want to copy data from 1 file to another - &lt;/p&gt;

&lt;p&gt;( Eg two folders names - sherry123 and sherry1234 , copy 1st folder data into another ) ( Note - this will override 2nd folder data with 1st folder) &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cp sherry123 sherry1234 &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*How to move ( cut and paste ) a file - ( this happens in case of directory ( folder ) not file ) &lt;/p&gt;

&lt;p&gt;Cammand - mv &lt;/p&gt;

&lt;p&gt;If want to move folder/directory sherry1234 into directory ( folder ) named for example sherry1 then type - &lt;/p&gt;

&lt;p&gt;mv sherry1234 sherry1&lt;/p&gt;

&lt;p&gt;For moving a file into a directory - &lt;/p&gt;

&lt;p&gt;Cammand - ( file123 ( is a file with content written) and folder123 ( is folder / directory where the file is to be moved ) &lt;/p&gt;

&lt;p&gt;Eg - mv file123 folder123/ newfolder123 ( this is new file renamed file of file123 where the content will be copied and moved into the directory ( folder123 ) &lt;/p&gt;

&lt;p&gt;*For remaining also same cammand is used - &lt;/p&gt;

&lt;p&gt;mv&lt;/p&gt;

&lt;p&gt;*How to remove ( delete ) a file or directory - &lt;/p&gt;

&lt;p&gt;Cammands - &lt;/p&gt;

&lt;p&gt;rmdir - this cammand is used to remove the specified directory ( this cammand only works in empty directory) &lt;/p&gt;

&lt;p&gt;rmdir -p - this cammand removes both the parent and child directory ( p - parent ) &lt;/p&gt;

&lt;p&gt;rmdir -pv - removes all the parent and subdirectories along with verbrose. ( Anything that Is written will also be deleted)&lt;/p&gt;

&lt;p&gt;( Add directory or file name in front of the cammands) &lt;/p&gt;

&lt;p&gt;Cammands for removing ( delete) files - &lt;/p&gt;

&lt;p&gt;Cammands - &lt;/p&gt;

&lt;p&gt;rm -rf - removes even non - empty file and directory ( f -  stands for "forcefully" ) it will delete all content forcefully &lt;/p&gt;

&lt;p&gt;Eg - rm -rf file1&lt;/p&gt;

&lt;p&gt;rm - rp - removes non empty directories including parent and subdirectories &lt;/p&gt;

&lt;p&gt;rm -r - removes empty directories. &lt;/p&gt;

&lt;p&gt;( Here "r" is representing file ) ( Dir - directory) &lt;/p&gt;

&lt;p&gt;*To know the difference in directory or file - &lt;/p&gt;

&lt;p&gt;Type cammand - ls -l  to get long list and you will see the name starting letters ( starting ke letters agr "d" hai to directory hai or "-" hai to file hai ) &lt;br&gt;
Refer the 1st image for example&lt;/p&gt;

&lt;p&gt;*To see all hidden files details as well type - &lt;/p&gt;

&lt;p&gt;ls -al or la ( l = list , a = all ) &lt;/p&gt;

&lt;p&gt;*Cammands to see content - &lt;/p&gt;

&lt;p&gt;less (file name ) -  will show all content of 1st page &lt;/p&gt;

&lt;p&gt;head ( file name ) -  will show first 10 lines of a page &lt;/p&gt;

&lt;p&gt;( head -n1 “file name" will print the starting line of that file ) &lt;/p&gt;

&lt;p&gt;tail ( file name ) - will show last 10 lines of a page &lt;/p&gt;

&lt;p&gt;( tail  -n 1 - “file name" will print the last line of that file , similarly -  tail  -n 2 “file name". Will print last 2 lines of that file.&lt;/p&gt;

&lt;p&gt;These used mostly in logs to identify problems &lt;/p&gt;

&lt;p&gt;more ( file name ) - will show all pages &lt;/p&gt;

&lt;p&gt;*How to install packages - &lt;/p&gt;

&lt;p&gt;yum cammand doesn't work in modern ubuntu ( after 18 version ) it works in redhat or centos ) &lt;/p&gt;

&lt;p&gt;yum - ( yellowdog update modify )&lt;/p&gt;

&lt;p&gt;New cammand - apt  &lt;/p&gt;

&lt;p&gt;Like sudo apt &lt;/p&gt;

&lt;p&gt;Sudo apt update ( It only updates the package list not the packages ) &lt;/p&gt;

&lt;p&gt;*To see what can be upgraded - &lt;/p&gt;

&lt;p&gt;Cammand - apt list --upgradable&lt;/p&gt;

&lt;p&gt;*For upgrading the packages - &lt;/p&gt;

&lt;p&gt;Cammand - &lt;/p&gt;

&lt;p&gt;sudo apt upgrade ( all the packages will be updated) &lt;/p&gt;

&lt;p&gt;For searching in terminal - sudo apt search browser ( eg ) &lt;/p&gt;

&lt;p&gt;Youtube and chrome type apps are downloaded from official sites as - (.deb ) packages &lt;/p&gt;

&lt;p&gt;Through sudo apt install  cammand apps present in repositories are only installed &lt;/p&gt;

&lt;p&gt;For removing the package first check the 📦 name - &lt;/p&gt;

&lt;p&gt;sudo dpkg -l | grep chrome &lt;/p&gt;

&lt;p&gt;Below you will see package name , get the name and run this cammand to remove - &lt;/p&gt;

&lt;p&gt;Cammand - sudo apt remove ( package name ) &lt;/p&gt;

&lt;p&gt;After this run this also - sudo apt autoremove ( always)&lt;/p&gt;

&lt;p&gt;hostname - tells you your device hostname &lt;/p&gt;

&lt;p&gt;hostname -i ( tells you IP address of your device ) &lt;/p&gt;

&lt;p&gt;ifconfig - / ip a  ( tells you information of your system like IP address, ethernet ports , ports etc ) &lt;/p&gt;

&lt;p&gt;cat /etc/os-release - ( tells you os version and name ) ( This is an absolute path ( path jo confirmed pakka hota hai )&lt;/p&gt;

&lt;p&gt;sudo apt search - ( and any reletive package name we want ) it will show results form repository &lt;/p&gt;

&lt;p&gt;sudo apt update -  ( to see how many packages need update ) ( kind of refresh function like in windows) &lt;/p&gt;

&lt;p&gt;sudo apt upgrade - ( updates all the packages in once ) &lt;/p&gt;

&lt;p&gt;*Running a service - ( eg apache server) &lt;/p&gt;

&lt;p&gt;Cammand -&lt;/p&gt;

&lt;p&gt;sudo systemctl start apache2  ( or any other service name) ( for start the service) &lt;/p&gt;

&lt;p&gt;sudo systemctl status apache2 ( or any other service name ) ( for checking if the service is running or not ) &lt;/p&gt;

&lt;p&gt;sudo systemctl stop apache2 ( or any other service name ) ( for stopping the service) &lt;/p&gt;

&lt;p&gt;sudo systemctl restart apache2 ( or any other service name) ( for restarting the service) &lt;/p&gt;

&lt;p&gt;*To configure that the service starts running after booting up the machine everytime - &lt;/p&gt;

&lt;p&gt;systemctl enable ( service name ) ( eg apache2 ) &lt;/p&gt;

&lt;p&gt;systemctl disable ( service name ) &lt;/p&gt;

&lt;p&gt;*To see the list of all installed apps - &lt;/p&gt;

&lt;p&gt;Cammand - apt list  --installed&lt;/p&gt;

&lt;p&gt;*To see a particular app is installed or not - &lt;/p&gt;

&lt;p&gt;Cammand - which &lt;/p&gt;

&lt;p&gt;( Eg - which firefox ( enter ) ) &lt;/p&gt;

&lt;p&gt;*To see tree format patch of all directories and files - &lt;/p&gt;

&lt;p&gt;Cammand - tree &lt;/p&gt;

&lt;p&gt;( It prints the directory structure in a tree format , starting from the current or specified directory) &lt;/p&gt;

&lt;p&gt;( Eg - tree ( enter ) &lt;br&gt;
Shows path from parent directory to subdirectories, refer image 2 &lt;/p&gt;

&lt;p&gt;More cammands for tree - &lt;/p&gt;

&lt;p&gt;tree -a ( show files including hidden files ) &lt;/p&gt;

&lt;p&gt;tree -d ( show only directories) &lt;/p&gt;

&lt;p&gt;tree -L  2 ( show show only 2 level deep ) &lt;/p&gt;

&lt;p&gt;tree -h ( show file sizes ) &lt;/p&gt;

&lt;p&gt;whoami  ( tells you if you are a root user or whatever you are inside the system ) &lt;/p&gt;

&lt;p&gt;*Cammand to display massage in a file of directory sometimes disclaimer or something else - &lt;/p&gt;

&lt;p&gt;Cammand - echo &lt;/p&gt;

&lt;p&gt;It can be used to add content also in file &lt;/p&gt;

&lt;p&gt;Use " "  and write the text in between inverted commas &lt;/p&gt;

&lt;p&gt;Eg - echo "rishabhsherry"  &amp;gt;file1 &lt;/p&gt;

&lt;p&gt;When single &amp;gt; is put than the previous content of that file ( here file 1 ) will be overwritten and new content will be added &lt;/p&gt;

&lt;p&gt;2 - Eg - echo "rishabhsherry"  &amp;gt;&amp;gt;file1 &lt;/p&gt;

&lt;p&gt;When double &amp;gt;&amp;gt; is used than the content written in between the commas is added with the previous file content ( here file 1 ) &lt;/p&gt;

&lt;p&gt;3 - eg - echo &amp;gt;file1 &lt;/p&gt;

&lt;p&gt;This will remove the content of file , when empty cammand is run with echo and &amp;gt; this symbol the content of that file is erased &lt;/p&gt;

&lt;p&gt;*Cammand to search a word or pattern inside text or files - grep  ( just like ctrl + F in windows) &lt;/p&gt;

&lt;p&gt;Cammand - grep &lt;/p&gt;

&lt;p&gt;Eg - grep ( word name that you want to find ) ( file name in which you want to find , you have to give a particular path to it to find it ) &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;grep sherry file1 &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*Uses - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to find errors in log files &lt;/li&gt;
&lt;li&gt;search configuration values&lt;/li&gt;
&lt;li&gt;debug services &lt;/li&gt;
&lt;li&gt;filter cammand output &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*Cammand to sort content in a file alphabetical order - sort&lt;/p&gt;

&lt;p&gt;( It is a cammand line utility used to arrange lines of text or numbers in a specified order such alphabetical kr numeric ) &lt;/p&gt;

&lt;p&gt;Cammand - sort &lt;/p&gt;

&lt;p&gt;Eg - sort file1 &lt;/p&gt;

&lt;p&gt;Cammands - &lt;/p&gt;

&lt;p&gt;Sort -n ( numeric) &lt;br&gt;
Sort - r ( reverse) &lt;br&gt;
Sort -u ( unique) &lt;/p&gt;

&lt;p&gt;*Cammand to check if a software/ package is installed and where it is located - &lt;/p&gt;

&lt;p&gt;Cammand - which &lt;/p&gt;

&lt;p&gt;Eg - which tree &lt;br&gt;
( Shows if tree package is installed or not and if Installed it will show path also ) &lt;/p&gt;

&lt;p&gt;*More cammands - &lt;/p&gt;

&lt;p&gt;*How to add a "user in linux" - &lt;/p&gt;

&lt;p&gt;Cammand - useradd &lt;/p&gt;

&lt;p&gt;Eg - useradd sherry &lt;/p&gt;

&lt;p&gt;*To see if the user is created or not - &lt;/p&gt;

&lt;p&gt;Cammand - cat /etc/passwd &lt;/p&gt;

&lt;p&gt;( At the bottom of code you will see the username) &lt;/p&gt;

&lt;p&gt;*How to make a group - &lt;/p&gt;

&lt;p&gt;Cammand - groupadd&lt;/p&gt;

&lt;p&gt;Eg - groupadd sherry&lt;/p&gt;

&lt;p&gt;*To see if the group is created or not - &lt;/p&gt;

&lt;p&gt;Cammand - cat /etc/group&lt;/p&gt;

&lt;p&gt;( Now point to be noted - when a new user is created it's group is automatically created ( jab kisi user ko create kia jaata hai to uska group bhi automatically ban jaata hai bhale hi uska ya usko kisi group me add nai kia hua hai tab bhi ) &lt;/p&gt;

&lt;p&gt;( But the same doesn't happen in the case of group creation, when a group is created the user is not automatically created ( jab group banate hai to user automatically create nai hota hai ) &lt;/p&gt;

&lt;p&gt;*Cammand to add a "single user" or "multiple users" into a group ( users ban hone chahiye pehle se ) &lt;/p&gt;

&lt;p&gt;Cammand - gpasswd -a ( to add a single user ) &lt;/p&gt;

&lt;p&gt;Eg - gpasswd -a fraand  sherry1  (sherry1 is the group name) &lt;/p&gt;

&lt;p&gt;Cammand - gpasswd -M ( with capital M , to add multiple users into a group) &lt;/p&gt;

&lt;p&gt;Eg - gpasswd -M fraand, shonty, chote, oreo  sherry1 ( sherry1 is the group name) &lt;/p&gt;

&lt;p&gt;( Usage: gpasswd [option] GROUP&lt;/p&gt;

&lt;p&gt;Options:&lt;/p&gt;

&lt;p&gt;-a, -add USER&lt;/p&gt;

&lt;p&gt;-d, -delete USER&lt;/p&gt;

&lt;p&gt;-h, --help&lt;/p&gt;

&lt;p&gt;-Q,--root CHROOT_DIR&lt;/p&gt;

&lt;p&gt;-r--remove-password&lt;/p&gt;

&lt;p&gt;-R, --restrict&lt;/p&gt;

&lt;p&gt;-M,-members USER,...&lt;/p&gt;

&lt;p&gt;--extrausers&lt;/p&gt;

&lt;p&gt;-A, --administrators ADMIN,.&lt;/p&gt;

&lt;p&gt;add USER to GROUP&lt;/p&gt;

&lt;p&gt;remove USER from GROUP&lt;/p&gt;

&lt;p&gt;display this help message and exit&lt;/p&gt;

&lt;p&gt;directory to chroot into&lt;/p&gt;

&lt;p&gt;remove the GROUP's password&lt;/p&gt;

&lt;p&gt;restrict access to GROUP to its members&lt;/p&gt;

&lt;p&gt;set the list of members of GROUP&lt;/p&gt;

&lt;p&gt;use the extra users database ) &lt;/p&gt;

&lt;p&gt;*Cammand to create link or shortlink - &lt;/p&gt;

&lt;p&gt;Denoted by "l" when we see files and directories using ls -l or ll &lt;/p&gt;

&lt;p&gt;Cammand - ln ( meaning link ) &lt;/p&gt;

&lt;p&gt;ln - ( hardlink ) &lt;/p&gt;

&lt;p&gt;ln -s - ( softlink ) ( just like shortcut in windows) &lt;/p&gt;

&lt;p&gt;Is also works like a file&lt;/p&gt;

&lt;p&gt;Eg - ln -s file1 softfile1 &lt;/p&gt;

&lt;p&gt;( Here file1 is the main file whose softlink ( shortcut) is to be created and "softfile1" is the name given to the  softfile ( shortcut). &lt;/p&gt;

&lt;p&gt;*Now hardlink - in hardlink a "Backup" is created of the original file and it is automatically synced with the original file and is updated automatically when we write or add anything in the original file , It helps protects the data if the original file is deleted. &lt;/p&gt;

&lt;p&gt;Eg - ln file2 backupfile2 &lt;/p&gt;

&lt;p&gt;( Here file2 is the original file whose backup we want to take and backupfile2 is the "Backup" we are creating and it will be automatically updated) ( This will not happen if we just copy pasted the file as everytime the data was to be copy pasted but here it will be updated automatically. &lt;/p&gt;

&lt;p&gt;The same happens when we add something in backup file also it will be updated in the original file also. &lt;/p&gt;

&lt;p&gt;*Cammand to combine multiple files into one ( zip ) - tar ( tape archive) &lt;/p&gt;

&lt;p&gt;It is always a "file" not directory &lt;/p&gt;

&lt;p&gt;Cammand - tar  -cvf &lt;/p&gt;

&lt;p&gt;( C = create , v = verbrose , f = forcefully) &lt;/p&gt;

&lt;p&gt;( Tar is an archiver used to combine multiple files into one file. ) ( Just Zip files in windows) &lt;/p&gt;

&lt;p&gt;Eg - there is directory named - "oreodir" , in that directory there 2 more sub directory named oreodir1 and oreodir2 , now I want to combine all of them and make a tar file to send. &lt;/p&gt;

&lt;p&gt;Cammand - tar -cvf oreo.tar oreodir &lt;/p&gt;

&lt;p&gt;= Oreo.tar&lt;/p&gt;

&lt;p&gt;( tar.cvf ke baad us file ka naam likhna hoga jis naam ki tar ( zip ) file banani hai and " .tar " lagana hai uske saath and then uske baad us directory wagera ka naam likhna hai jiski file ko tar file banana hai ) ( oreo.tar us file ka naam hai jo me dena chahta tha tar file ko ) &lt;/p&gt;

&lt;p&gt;*Cammand used to reduce size of a file - &lt;/p&gt;

&lt;p&gt;Cammand - gzip (  file name ) &lt;/p&gt;

&lt;p&gt;( Gzip is a compression tool that is used to reduce the size of a file ) ( Just like compressing a file in windows to reduce its size ) &lt;/p&gt;

&lt;p&gt;Eg - there is a tar file named - "oreodir.tar" and we want to compress it and reduce the size so the cammands will be - &lt;/p&gt;

&lt;p&gt;gzip oreodir.tar&lt;/p&gt;

&lt;p&gt;Output in ls - oreo.tar.gz&lt;/p&gt;

&lt;p&gt;*Now we want to uncompress the file afterwards or the receiver wants to do it - &lt;/p&gt;

&lt;p&gt;Cammand - gunzip oreo.tar.gz &lt;/p&gt;

&lt;p&gt;Output - oreo.tar &lt;/p&gt;

&lt;p&gt;*Now we or the receiver wants to unzip ( extract) the data from " oreo.tar" for accessing the files - &lt;/p&gt;

&lt;p&gt;Cammand - tar  -xvf oreo.tar   ( x = extract) &lt;/p&gt;

&lt;p&gt;*Cammand to download a file , software etc on our linux machine - &lt;/p&gt;

&lt;p&gt;Cammand - wget  &amp;lt; url &amp;gt; &lt;/p&gt;

&lt;p&gt;( Url is a must , get the url from browser or anywhere and paste it , then after downloading install using sudo apt install) &lt;/p&gt;

&lt;p&gt;( Wget is the non-interactive network downloader ) &lt;/p&gt;

&lt;p&gt;( It will download the file vo file download karta rahega even if the user is not active and login , or agar internet slow and ya network me issue , network khraab hota hai rehta toot ta rehta hai tab bhi ye try karta rehta hai download karne ka ) &lt;/p&gt;

&lt;p&gt;*To delete all files at once - &lt;/p&gt;

&lt;p&gt;Cammand - rm -rf * &lt;/p&gt;

&lt;p&gt;( * Means delete everything ( files and directories but not the installed apps and packages ) &lt;/p&gt;

&lt;p&gt;*Cammand for permission - &lt;/p&gt;

&lt;p&gt;Cammand - chmod &lt;/p&gt;

&lt;p&gt;( r = 4 w = 2  x = 1 ) &lt;/p&gt;

&lt;p&gt;( r = read , w = write , x = execute ) &lt;/p&gt;

&lt;p&gt;*Linux Permissions and File Details - &lt;/p&gt;

&lt;p&gt;In Linux, every file and directory is assigned access modes or permissions that determine who can read, write, or execute them. When using the command ls -l, a detailed list is displayed where the first character indicates the type of item:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Represents a file
·d: Represents a directory.
·I: Represents a link.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Following this character are nine others divided into three&lt;br&gt;
sets of three, representinig the Owner (User), the Group, and Others&lt;/p&gt;

&lt;p&gt;Core Commands and Definitions&lt;/p&gt;

&lt;p&gt;chmod (Change Mode): Used to change the access&lt;br&gt;
permissions of a file or directory.&lt;/p&gt;

&lt;p&gt;chown (Change Owner): Used to change the ownership&lt;br&gt;
of a file or directory.&lt;/p&gt;

&lt;p&gt;chgrp (Change Group): Used to change the group&lt;br&gt;
ownership.&lt;/p&gt;

&lt;p&gt;·Permission Types:&lt;/p&gt;

&lt;p&gt;·r (Read): Permission to view the contents (Value: 4).&lt;br&gt;
。w (Write): Permission to modify or delete (Value: 2).&lt;br&gt;
·x (Execute): Permission to run a file or enteer a directory&lt;br&gt;
(Value:1).&lt;/p&gt;

&lt;p&gt;first 3 letters represent - root user ,&lt;br&gt;
 The next 3 letters represent - group&lt;br&gt;
  The last 3 letters represent - other users&lt;/p&gt;

&lt;p&gt;Permission | Calculation | Total Value &lt;br&gt;
rwx.             4 + 2 + 1.      =       7&lt;br&gt;
rw.                4 + 2 + 0.     =       6&lt;br&gt;
r-x                4 + 0 + 1.      =      5&lt;br&gt;
r--                4 + 0 + 0.     =       4&lt;br&gt;
---               0 + 0 + 0.     =       0&lt;/p&gt;

&lt;p&gt;*Examples - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;chmod 777 file_name: Grants full read, write, and execute permissions to everyone.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;chmod 754 file_name: chmod 754 file_name: Owner has full rights (7), Group can read and execute (5), and Others can only read (4).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;chmod 700 directory_name : Only the owner has full access; everyone else has no permissions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*Another method to give and remove permissions ( using letters ) &lt;/p&gt;

&lt;p&gt;u - user / owner&lt;br&gt;
g - group &lt;br&gt;
O - others&lt;/p&gt;

&lt;p&gt;Mainly 3 sub methods are used - ( + , - , = ) &lt;/p&gt;

&lt;p&gt;For updating permissions in a existing file or directory - " = " &lt;br&gt;
Equals sign is used &lt;/p&gt;

&lt;p&gt;Eg - u = rwx ( the user will get all permissions &lt;/p&gt;

&lt;p&gt;g = w ( the group will get only write permissions) &lt;/p&gt;

&lt;p&gt;o = wx ( others will get only write and execute permissions) &lt;/p&gt;

&lt;p&gt;Eg - chmod u-wx,g+w,o=wx file1&lt;/p&gt;

&lt;p&gt;*Ownership and Group Management - &lt;/p&gt;

&lt;p&gt;To change who owns a file or which group it belongs to, use the following commands:&lt;/p&gt;

&lt;p&gt;chown rishabh file1: Changes the owner of "file1" to the user "rishabh".&lt;/p&gt;

&lt;p&gt;( The owner have all the rights by default) &lt;/p&gt;

&lt;p&gt;To change the group &lt;/p&gt;

&lt;p&gt;( Group name for example - techops ) &lt;/p&gt;

&lt;p&gt;chgrp techops file1: Changes the group of "file1" to "techops". &lt;/p&gt;

&lt;p&gt;chmod 000 file1: Removes all permissions from every user for "file1".&lt;/p&gt;

&lt;p&gt;*new command for “getting things like url and api “ - &lt;/p&gt;

&lt;p&gt;curl = Client URL&lt;br&gt;
It is used to:&lt;br&gt;
Fetch data from URLs&lt;/p&gt;

&lt;p&gt;Call APIs&lt;/p&gt;

&lt;p&gt;Download files&lt;/p&gt;

&lt;p&gt;Test web servers&lt;/p&gt;

&lt;p&gt;Command - curl&lt;/p&gt;

&lt;p&gt;Eg - curl google.com &lt;/p&gt;

&lt;p&gt;Most Used curl Options (Cheat Sheet)&lt;br&gt;
Option&lt;br&gt;
Meaning&lt;br&gt;
-O&lt;br&gt;
Save file (original name)&lt;br&gt;
-o&lt;br&gt;
Save file (custom name)&lt;br&gt;
-I&lt;br&gt;
Headers only&lt;br&gt;
-X&lt;br&gt;
Request type (GET/POST/etc.)&lt;br&gt;
-d&lt;br&gt;
Send data&lt;br&gt;
-H&lt;br&gt;
Add header&lt;br&gt;
-L&lt;br&gt;
Follow redirects&lt;br&gt;
-s&lt;br&gt;
Silent mode&lt;/p&gt;

&lt;p&gt;Golden Rule to Remember&lt;br&gt;
curl shows output → wget saves files&lt;/p&gt;

&lt;p&gt;Linux stores the logs in this directory and path&lt;/p&gt;

&lt;p&gt;/var/log&lt;/p&gt;

&lt;p&gt;Eg - we want to see the logs of a particular file or directory - &lt;/p&gt;

&lt;p&gt;Type - cd /var/log “enter" &lt;/p&gt;

&lt;p&gt;Directory will be changed, now to check the files - &lt;br&gt;
ls , pick the log file ( for eg - " syslog” ) &lt;/p&gt;

&lt;p&gt;See the content inside this file or it's log using nano or vi cammand. To see hidden file type - ls -al &lt;/p&gt;

&lt;p&gt;less (file name ) -  will show all content of 1st page &lt;/p&gt;

&lt;p&gt;head ( file name ) -  will show first 10 lines of a page &lt;/p&gt;

&lt;p&gt;( head -n1 “file name" will print the starting line of that file ) &lt;/p&gt;

&lt;p&gt;tail ( file name ) - will show last 10 lines of a page &lt;/p&gt;

&lt;p&gt;( tail  -n 1 - “file name" will print the last line of that file , similarly -  tail  -n 2 “file name". Will print last 2 lines of that file.&lt;/p&gt;

&lt;p&gt;*Cammand to see the word count of a file - &lt;/p&gt;

&lt;p&gt;wc ( eg - wc file1 ) &lt;/p&gt;

&lt;p&gt;This will show the word count of that file - &lt;/p&gt;

&lt;p&gt;1st numbers are - “ how many lines are there" &lt;br&gt;
2nd numbers are - “ how many words are there" &lt;br&gt;
3rd numbers are - “ how many characters are there" &lt;/p&gt;

&lt;p&gt;*Important -   “. | " - this is called a pipe operator. &lt;/p&gt;

&lt;p&gt;Meaning of the Pipe Operator (|) — in Simple Terms&lt;br&gt;
The pipe operator (|) connects two commands so that:&lt;br&gt;
Output of the first command becomes input of the second command&lt;br&gt;
Think of it like a water pipe 🚰:&lt;br&gt;
Water comes out of one pipe&lt;/p&gt;

&lt;p&gt;Flows into the next pipe&lt;br&gt;
This is called “piping” as well in linux&lt;/p&gt;

&lt;p&gt;Eg - suppose a file named - sherryfile1 , commands are as follows -&lt;/p&gt;

&lt;p&gt;Eg - less sherryfile1 | wc&lt;br&gt;
Output - “number of lines” “number of words” “number of characters”&lt;/p&gt;

&lt;p&gt;Eg 2 - head -n5 sherryfile1 | wc &lt;br&gt;
Output - 5 “lines” “number of words” “number of characters”&lt;/p&gt;

&lt;p&gt;*List command variations - &lt;/p&gt;

&lt;p&gt;l - list long listing&lt;br&gt;
a - list all&lt;br&gt;
r - reverse sorting&lt;br&gt;
t - arrange by time&lt;/p&gt;

&lt;p&gt;ls -a&lt;br&gt;
ls -r&lt;br&gt;
ls -t&lt;/p&gt;

&lt;p&gt;ls  -R -    ( lists files and directories recursively. )&lt;/p&gt;

&lt;p&gt;means:&lt;br&gt;
It shows everything inside a directory, including all subdirectories and their contents.&lt;br&gt;
List the current directory, then go inside each folder, and list everything there too.&lt;/p&gt;

&lt;p&gt;Combine with Other Options&lt;br&gt;
Long listing&lt;br&gt;
ls -lR&lt;/p&gt;

&lt;p&gt;Show hidden files&lt;br&gt;
ls -aR&lt;/p&gt;

&lt;p&gt;Human-readable sizes&lt;br&gt;
ls -lhR&lt;/p&gt;

&lt;p&gt;*echo cammand alternative - ( mostly preferred )&lt;/p&gt;

&lt;p&gt;printf “\n”&lt;/p&gt;

&lt;p&gt;( anything that you want to print write it inside and between “ \n” )&lt;/p&gt;

&lt;p&gt;Eg - printf “sherry\n”&lt;/p&gt;

&lt;p&gt;Output - sherry&lt;/p&gt;

&lt;p&gt;*Cammand used to monitor system performance -&lt;/p&gt;

&lt;p&gt;Command -  top&lt;/p&gt;

&lt;p&gt;top Command in Linux&lt;br&gt;
top is used to monitor system performance in real time.&lt;br&gt;
 It shows:&lt;br&gt;
Running processes&lt;/p&gt;

&lt;p&gt;CPU usage&lt;/p&gt;

&lt;p&gt;Memory usage&lt;/p&gt;

&lt;p&gt;System load&lt;/p&gt;

&lt;p&gt;Process ID (PID)&lt;/p&gt;

&lt;p&gt;It updates automatically every few seconds.&lt;/p&gt;

&lt;p&gt;What You See in top&lt;br&gt;
  Upper Section (System Summary)&lt;br&gt;
Load average → System workload&lt;/p&gt;

&lt;p&gt;Tasks → Running / sleeping processes&lt;/p&gt;

&lt;p&gt;%Cpu(s) → CPU usage&lt;/p&gt;

&lt;p&gt;KiB Mem / Swap → RAM and swap usage&lt;/p&gt;

&lt;p&gt;Lower Section (Process List)&lt;br&gt;
Columns include:&lt;br&gt;
PID → Process ID&lt;/p&gt;

&lt;p&gt;USER → Owner&lt;/p&gt;

&lt;p&gt;%CPU → CPU usage&lt;/p&gt;

&lt;p&gt;%MEM → Memory usage&lt;/p&gt;

&lt;p&gt;COMMAND → Program name&lt;/p&gt;

&lt;p&gt;Important Interactive Keys (While top is Running)&lt;br&gt;
Press these keys inside top:&lt;br&gt;
Key&lt;br&gt;
Function&lt;br&gt;
q&lt;br&gt;
Quit&lt;br&gt;
k&lt;br&gt;
Kill a process&lt;br&gt;
M&lt;br&gt;
Sort by memory usage&lt;br&gt;
P&lt;br&gt;
Sort by CPU usage&lt;br&gt;
u&lt;br&gt;
Show specific user processes&lt;/p&gt;

&lt;p&gt;*Cammand to terminate a running process&lt;/p&gt;

&lt;p&gt;Command - kill&lt;/p&gt;

&lt;p&gt;kill Command in Linux&lt;br&gt;
The kill command is used to send a signal to a process.&lt;br&gt;
Most commonly, it is used to stop (terminate) a running process.&lt;/p&gt;

&lt;p&gt;Variations and uses -&lt;/p&gt;

&lt;p&gt;Command&lt;br&gt;
Purpose&lt;/p&gt;

&lt;p&gt;kill&lt;br&gt;
     Send signal to specific PID&lt;/p&gt;

&lt;p&gt;pkill&lt;br&gt;
 Kill by process name&lt;/p&gt;

&lt;p&gt;killall&lt;br&gt;
Kill all processes by name&lt;/p&gt;

&lt;p&gt;Force kill cammand -   kill -9 “file name”&lt;/p&gt;

&lt;p&gt;*cammand to view all processes on a machine -&lt;/p&gt;

&lt;p&gt;Command -  ps&lt;/p&gt;

&lt;p&gt;ps stands for Process Status.&lt;br&gt;
 It is used to view running processes on the system.&lt;br&gt;
Unlike top, it shows a snapshot (not real-time updates).&lt;/p&gt;

&lt;p&gt;ps &lt;/p&gt;

&lt;p&gt;Ps -a ( displays all processes running in the background as well.&lt;/p&gt;

&lt;p&gt;Difference Between ps and top&lt;br&gt;
ps&lt;br&gt;
top&lt;br&gt;
Snapshot&lt;br&gt;
Real-time&lt;br&gt;
Static output&lt;br&gt;
Dynamic updating&lt;br&gt;
Used in scripts&lt;br&gt;
Used for monitoring&lt;/p&gt;

&lt;p&gt;*To see any file or process using PID ( process identifier ) number - &lt;/p&gt;

&lt;p&gt;Command - ps -p &lt;/p&gt;

&lt;p&gt;Example - ps -p 1&lt;br&gt;
Output - shows the 1st PID process , that which process is of PID 1 and it is - systemD&lt;/p&gt;

&lt;p&gt;PID 1 is very important in Linux.&lt;br&gt;
It is the first process started by the kernel during boot.&lt;br&gt;
This process is usually:&lt;br&gt;
systemd (in modern Linux systems like Ubuntu)&lt;/p&gt;

&lt;p&gt;Or init (in older systems)&lt;/p&gt;

&lt;p&gt;PID TTY          TIME CMD&lt;br&gt;
    1 ?        00:00:02 systemd&lt;/p&gt;

&lt;p&gt;Why Is PID 1 Important?&lt;br&gt;
PID 1:&lt;br&gt;
Starts all other services&lt;/p&gt;

&lt;p&gt;Manages system processes&lt;/p&gt;

&lt;p&gt;Controls service lifecycle&lt;/p&gt;

&lt;p&gt;Is responsible for system shutdown and reboot&lt;/p&gt;

&lt;p&gt;If PID 1 crashes → system becomes unstable.&lt;/p&gt;

&lt;p&gt;*Disk space monitoring cammand&lt;/p&gt;

&lt;p&gt;df → Disk free space&lt;/p&gt;

&lt;p&gt;-h → Human readable (auto chooses KB, MB, GB)&lt;/p&gt;

&lt;p&gt;-B → Force a specific block size&lt;/p&gt;

&lt;p&gt;K → Kilobytes&lt;/p&gt;

&lt;p&gt;G → Gigabytes&lt;/p&gt;

&lt;p&gt;Cammand -  df -h&lt;/p&gt;

&lt;p&gt;What -h means:&lt;br&gt;
-h = human-readable&lt;/p&gt;

&lt;p&gt;Shows sizes in KB, MB, GB instead of bytes&lt;/p&gt;

&lt;p&gt;Example - df -h&lt;br&gt;
Output - &lt;/p&gt;

&lt;p&gt;Filesystem      Size  Used  Avail  Use%  Mounted on&lt;br&gt;
/dev/sda1        50G   20G   28G   42%   /&lt;br&gt;
tmpfs             2.0G     0       2.0G    0%   /dev/shm&lt;/p&gt;

&lt;p&gt;Meaning of the above - &lt;/p&gt;

&lt;p&gt;1- Filesystem - disk or partition name&lt;/p&gt;

&lt;p&gt;2- Size - total size&lt;/p&gt;

&lt;p&gt;3 - Used - used space&lt;/p&gt;

&lt;p&gt;4 - Avail - free space&lt;/p&gt;

&lt;p&gt;5 - Use% - Percentage used &lt;/p&gt;

&lt;p&gt;6 - Mounted on - Mount location&lt;/p&gt;

&lt;p&gt;What It Is Used For&lt;br&gt;
Check if disk is full&lt;/p&gt;

&lt;p&gt;Monitor server storage&lt;/p&gt;

&lt;p&gt;Troubleshoot “No space left on device” errors&lt;/p&gt;

&lt;p&gt;*cammand - df -h -BK&lt;/p&gt;

&lt;p&gt;What it does:&lt;br&gt;
Shows disk size only in Kilobytes (KB)&lt;br&gt;
Filesystem     1K-blocks     Used          Available  Use% Mounted on&lt;br&gt;
/dev/sda1      52428800  20971520   29360128   42%    /&lt;/p&gt;

&lt;p&gt;Everything is converted into KB&lt;/p&gt;

&lt;p&gt;*cammand - df -h -BG&lt;/p&gt;

&lt;p&gt;What it does:&lt;br&gt;
Shows disk size only in Gigabytes (GB)&lt;/p&gt;

&lt;p&gt;Example output:&lt;/p&gt;

&lt;p&gt;Filesystem     1G-blocks  Used  Available  Use% Mounted on&lt;br&gt;
/dev/sda1          50G        20G              28G      42%  /&lt;/p&gt;

&lt;p&gt;Command -  du ( disk utilisation/usage )&lt;br&gt;
( shows size of all files and folders )&lt;/p&gt;

&lt;p&gt;It is used to check how much space files and directories are using.&lt;br&gt;
Unlike df, which shows whole disk usage,&lt;br&gt;
 du shows file/folder size.&lt;/p&gt;

&lt;p&gt;*cammand - du -h&lt;/p&gt;

&lt;p&gt;du → Disk Usage&lt;/p&gt;

&lt;p&gt;-h → Human-readable format (KB, MB, GB)&lt;/p&gt;

&lt;p&gt;It shows the size of files and directories in the current directory.&lt;/p&gt;

&lt;p&gt;Usage and what it does - &lt;br&gt;
Go through the current directory&lt;/p&gt;

&lt;p&gt;Show size of each subdirectory&lt;/p&gt;

&lt;p&gt;Show total size at the end&lt;/p&gt;

&lt;p&gt;*To know all file sizes inside folders as well individual files - &lt;/p&gt;

&lt;p&gt;Command - du -ah&lt;/p&gt;

&lt;p&gt;du → Disk usage&lt;/p&gt;

&lt;p&gt;-a → Show all files and directories&lt;/p&gt;

&lt;p&gt;-h → Human readable (KB, MB, GB)&lt;/p&gt;

&lt;p&gt;What It Does&lt;br&gt;
It shows the size of:&lt;br&gt;
Every file&lt;/p&gt;

&lt;p&gt;Every folder&lt;/p&gt;

&lt;p&gt;In the current directory &lt;/p&gt;

&lt;p&gt;Also - du -ahc &lt;/p&gt;

&lt;p&gt;Shows same results as above just adds a total volume at the end&lt;/p&gt;

&lt;p&gt;*free command &lt;/p&gt;

&lt;p&gt;Command - free &lt;/p&gt;

&lt;p&gt;is used to check RAM and swap memory usage.&lt;/p&gt;

&lt;p&gt;It shows:&lt;br&gt;
Total memory&lt;/p&gt;

&lt;p&gt;Used memory&lt;/p&gt;

&lt;p&gt;Free memory&lt;/p&gt;

&lt;p&gt;Available memory&lt;/p&gt;

&lt;p&gt;Swap usage&lt;/p&gt;

&lt;p&gt;*cammand - free -h&lt;/p&gt;

&lt;p&gt;Shows memory in human-readable form ( shows in MB, GB )&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          total        used        free      shared  buff/cache   available
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Mem:     7.6G        3.2G        1.1G        200M        3.3G        4.0G&lt;br&gt;
Swap:      2.0G        0B          2.0G&lt;/p&gt;

&lt;p&gt;*cammand - free -m&lt;/p&gt;

&lt;p&gt;Shows memory in MB&lt;/p&gt;

&lt;p&gt;*cammand - free -g &lt;/p&gt;

&lt;p&gt;Shows memory in GB&lt;/p&gt;

&lt;p&gt;*cammand - free -h -t &lt;/p&gt;

&lt;p&gt;Adds total line (RAM + Swap combined)&lt;/p&gt;

&lt;p&gt;*cammand - free -h -s N -( N is number of seconds you want to put )&lt;/p&gt;

&lt;p&gt;*cammand - watch free -h&lt;/p&gt;

&lt;p&gt;Updates every 2 seconds.&lt;br&gt;
( for continuous Monitoring )&lt;/p&gt;

&lt;p&gt;Swap Meaning&lt;br&gt;
Swap is:&lt;br&gt;
Disk space used as extra RAM&lt;/p&gt;

&lt;p&gt;Slower than RAM&lt;/p&gt;

&lt;p&gt;If swap usage is high → system may be under memory pressure.&lt;/p&gt;

&lt;p&gt;*Linux Shell scripting&lt;/p&gt;

&lt;p&gt;First how to check your shell - &lt;/p&gt;

&lt;p&gt;Command - echo $0&lt;/p&gt;

&lt;p&gt;To  make a file run like script ,first the below mentioned command is written at the top when editing file with vi or nano -&lt;/p&gt;

&lt;h1&gt;
  
  
  !/bin/bash
&lt;/h1&gt;

&lt;p&gt;Then after this write what you want to display after “echo” command.&lt;/p&gt;

&lt;p&gt;Example - file is made named - test-scripts &lt;/p&gt;

&lt;p&gt;Enter the file using nano or vi&lt;/p&gt;

&lt;p&gt;Then write - &lt;/p&gt;

&lt;p&gt;#!/bin/bash      ( called shebang )&lt;/p&gt;

&lt;p&gt;echo hello world&lt;/p&gt;

&lt;p&gt;Get out of the file ( :wq )&lt;/p&gt;

&lt;p&gt;*the file don’t have execute rights always check using ll &lt;/p&gt;

&lt;p&gt;Then - chmod u+x test-scripts&lt;/p&gt;

&lt;p&gt;*cammand to run the script -&lt;/p&gt;

&lt;p&gt;Rxeg 9 &lt;/p&gt;

&lt;p&gt;Example - ./test-scripts&lt;/p&gt;

&lt;p&gt;Output - hello world&lt;/p&gt;

&lt;p&gt;*To identify the files to ot get confused - .sh extension is used&lt;/p&gt;

&lt;p&gt;What is a Variable in Shell Scripting?&lt;br&gt;
A variable is:&lt;br&gt;
A name used to store some value.&lt;br&gt;
Think of it like a box with a label.&lt;br&gt;
The label = variable name&lt;/p&gt;

&lt;p&gt;What’s inside the box = value&lt;/p&gt;

&lt;p&gt;Example - name=Sherry&lt;/p&gt;

&lt;p&gt;( no space after = )&lt;br&gt;
You created:&lt;br&gt;
A box called name&lt;/p&gt;

&lt;p&gt;It contains the word Sherry&lt;/p&gt;

&lt;p&gt;Now if we type - echo $name&lt;/p&gt;

&lt;p&gt;( Use $ to print the value )&lt;/p&gt;

&lt;p&gt;Output - sherry&lt;/p&gt;

&lt;p&gt;The $ means:&lt;br&gt;
“Give me the value inside the box.”&lt;/p&gt;

&lt;p&gt;Use $ to print the value&lt;/p&gt;

&lt;p&gt;Example 2 - &lt;/p&gt;

&lt;p&gt;*now if you want to use any linux cammand as variable so . &lt;/p&gt;

&lt;p&gt;Just write it like before but inside brackets &lt;/p&gt;

&lt;p&gt;Eg - if we want to use hostname command as a variable &lt;/p&gt;

&lt;p&gt;host=$(hostname)&lt;/p&gt;

&lt;p&gt;*cammand for taking input from user&lt;/p&gt;

&lt;p&gt;Now let’s build a small script which will require user input. &lt;/p&gt;

&lt;p&gt;Example -  &lt;/p&gt;

&lt;h1&gt;
  
  
  !bin/bash
&lt;/h1&gt;

&lt;p&gt;echo what is your name?&lt;br&gt;
read name                 ( when read is written like this that means that’s where the user will put the input and after that only it will move forward )&lt;/p&gt;

&lt;p&gt;( and name will store the values )&lt;/p&gt;

&lt;p&gt;echo Hi $name how old are you. &lt;br&gt;
read old&lt;/p&gt;

&lt;p&gt;*if-else command&lt;/p&gt;

&lt;p&gt;What is if-else?&lt;br&gt;
if-else is used to make decisions in a script.&lt;br&gt;
It means:&lt;br&gt;
If something is true → do this&lt;br&gt;
 Otherwise → do something else&lt;br&gt;
2️⃣ Basic Structure&lt;br&gt;
if [ condition ]&lt;br&gt;
then&lt;br&gt;
    commands&lt;br&gt;
else&lt;br&gt;
    commands&lt;br&gt;
fi&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Script build using if-else&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  !/bin/bash
&lt;/h1&gt;

&lt;p&gt;echo entry for flight according to weight of passenger please share your weight&amp;gt;&lt;/p&gt;

&lt;p&gt;echo what is your name?&lt;br&gt;
read name&lt;/p&gt;

&lt;p&gt;echo Hi $name what is your weight?&lt;br&gt;
read weight&lt;/p&gt;

&lt;p&gt;if [ $weight -gt 70 ]&lt;/p&gt;

&lt;p&gt;then&lt;br&gt;
echo sorry but we cannot allow you on the flight&lt;/p&gt;

&lt;p&gt;else&lt;br&gt;
echo welcome to our plane&lt;/p&gt;

&lt;p&gt;fi&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;case Command in Bash *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What is case?&lt;/p&gt;

&lt;p&gt;case is used to match a value against multiple options and run different commands based on the match.&lt;br&gt;
Think of it like a menu system — "if user picks option 1, do this... if option 2, do that..."&lt;br&gt;
esac = "case" spelled backwards → it closes the case block (like done closes while)&lt;/p&gt;

&lt;p&gt;Important Symbols&lt;br&gt;
Symbol  Meaning&lt;br&gt;
)      ends the pattern&lt;br&gt;
;;     ends that option (like break)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;     default case (matches anything)
esac   ends the whole case block&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example -&lt;/p&gt;

&lt;p&gt;!/bin/bash&lt;/p&gt;

&lt;p&gt;echo press option of your choice&lt;br&gt;
echo 1=date&lt;br&gt;
echo 2=all files list&lt;br&gt;
echo 3=hostname&lt;br&gt;
echo 4=ip address&lt;/p&gt;

&lt;p&gt;read choice&lt;/p&gt;

&lt;p&gt;case $choice in&lt;br&gt;
1) date ;;&lt;br&gt;
2)ls -a ;;&lt;br&gt;
3)hostname ;;&lt;br&gt;
4)ifconfig ;;&lt;br&gt;
*)echo invalid input&lt;br&gt;
esac&lt;/p&gt;

&lt;p&gt;Example 2 -&lt;/p&gt;

&lt;h1&gt;
  
  
  !/bin/bash
&lt;/h1&gt;

&lt;p&gt;echo please find the options below&lt;/p&gt;

&lt;p&gt;echo 1=time&lt;br&gt;
echo 2=apache status&lt;/p&gt;

&lt;p&gt;read choice&lt;/p&gt;

&lt;p&gt;case $choice in&lt;/p&gt;

&lt;p&gt;1) date ;;&lt;br&gt;
2) systemctl status apache2 ;;&lt;br&gt;
*) echo invalid input&lt;br&gt;
esac&lt;/p&gt;

&lt;p&gt;Output - &lt;/p&gt;

&lt;p&gt;root@rishabh-VirtualBox:/home/rishabh/scripts# ./case21feb.sh&lt;br&gt;
please find the options below&lt;br&gt;
1=time&lt;br&gt;
2=apache status&lt;br&gt;
1&lt;br&gt;
Wednesday 25 February 2026 06:29:29 AM IST&lt;/p&gt;

&lt;p&gt;Loops in Bash&lt;/p&gt;

&lt;p&gt;What is a Loop?&lt;br&gt;
A loop means repeating a task multiple times without writing the same code again and again.&lt;br&gt;
Think of it like — "Keep doing this task until I say stop"&lt;/p&gt;

&lt;p&gt;Types of Loops in Bash&lt;/p&gt;

&lt;p&gt;Loops in Bash&lt;br&gt;
├── for loop&lt;br&gt;
├── while loop&lt;br&gt;
└── until loop&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;FOR Loop
What it does?
Runs a task for a fixed set of values or a fixed number of times&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Syntax&lt;br&gt;
bash&lt;br&gt;
for variable in values&lt;br&gt;
do&lt;br&gt;
    # commands&lt;br&gt;
done&lt;/p&gt;

&lt;p&gt;Example 1 = &lt;/p&gt;

&lt;h1&gt;
  
  
  !/bin/bash
&lt;/h1&gt;

&lt;p&gt;for count in 1 2 3 &lt;br&gt;
do echo count is $count&lt;br&gt;
done&lt;/p&gt;

&lt;p&gt;Out put -&lt;br&gt;
root@rishabh-VirtualBox:/home/rishabh/scripts# ./loops. sh&lt;br&gt;
count is 1&lt;br&gt;
count is 2&lt;br&gt;
count is 3&lt;br&gt;
count is 4&lt;br&gt;
count is 5&lt;br&gt;
count is 6&lt;br&gt;
count is 7&lt;/p&gt;

&lt;p&gt;Comparison Operators&lt;br&gt;
🔹 For Numbers&lt;br&gt;
Operator&lt;br&gt;
Meaning&lt;br&gt;
-eq&lt;br&gt;
equal&lt;br&gt;
-ne&lt;br&gt;
not equal&lt;br&gt;
-gt&lt;br&gt;
greater than&lt;br&gt;
-lt&lt;br&gt;
less than&lt;br&gt;
-ge&lt;br&gt;
greater or equal&lt;br&gt;
-le&lt;br&gt;
less or equal&lt;/p&gt;

&lt;h1&gt;
  
  
  !/bin/bash
&lt;/h1&gt;

&lt;p&gt;for num in (1..3)&lt;br&gt;
do&lt;br&gt;
echo Number is $num&lt;br&gt;
done&lt;br&gt;
for task in Read Write Blog Video Sleep Eat&lt;br&gt;
do&lt;br&gt;
echo My task is $task&lt;br&gt;
done&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>techops</category>
      <category>bash</category>
    </item>
  </channel>
</rss>
