Linux Basics for Hackers: Linux Filesystem, Commands, Permissions & Process Management

Linux cybersecurity aur ethical hacking seekhne wale beginners ke liye ek important operating system hai. Penetration testing, system administration, networking aur security labs me Linux commands ka regular use hota hai.

Agar aap Linux Basics for Hackers jaise cybersecurity-focused books ko follow kar rahe hain, to sabse pehle Linux ke filesystem, navigation, file management, permissions, networking aur process management ko samajhna useful hai.

Is guide me hum Linux ke kuch important basics ko practical commands ke saath step-by-step samjhenge.

Note: Ye guide learning aur authorized cybersecurity labs ke purpose ke liye hai. Kisi system par commands chalane se pehle ensure karein ki aapke paas permission hai.


1. Linux Filesystem Structure

Linux me filesystem ka starting point / hota hai. Isse Root Directory kaha jata hai.

Windows me hum C:\ jaise drive structure dekhte hain, lekin Linux me directories ek tree structure me / ke andar organized hoti hain.

Important Linux Directories

DirectoryPurpose
/Root directory — poora Linux filesystem yahin se start hota hai.
/rootSuperuser/root account ki home directory.
/homeRegular users ki personal home directories.
/etcSystem configuration files aur configuration settings.
/binImportant user commands aur executable programs.
/sbinSystem administration ke important commands.
/usr/binUser applications aur commands.
/usr/sbinAdditional system administration commands.
/libSystem libraries jo programs ko required functionality provide karti hain.
/mntTemporary mounting ke liye commonly used directory.
/mediaUSB, CD/DVD jaise removable media ko mount karne ke liye commonly used location.
/procRunning processes aur kernel information ka virtual filesystem.
/sysKernel aur hardware-related information provide karta hai.
/bootLinux kernel aur boot-related files.
/devDevices ko represent karne wali special files.

/proc aur /sys ko samajhna

/proc aur /sys normal directories jaise nahi hain. Ye virtual filesystems hain.

Inke through system ke processes, kernel aur hardware ke baare me information dekhi ja sakti hai.

Example:

ls /proc

Aur:

ls /sys

Cybersecurity learning me in directories ko samajhna useful hai kyunki Linux system ke internal behavior ko understand karne me ye help karti hain.


2. Basic Linux Navigation Commands

Linux terminal me kaam karte waqt sabse pehle hume ye pata hona chahiye ki hum currently kis directory me hain.

pwd — Current Location

pwd

pwd ka meaning hai Print Working Directory.

Example output:

/home/sajid

Iska matlab hai ki current working directory /home/sajid hai.


whoami — Current User

whoami

Ye command batati hai ki current terminal me kaunsa user logged in hai.

Example:

sajid

Agar output root aaye, to current session root user ke privileges ke saath chal raha hai.


cd — Directory Change Karna

Kisi directory me jane ke liye cd command use hoti hai.

cd /etc

Isse /etc directory me chale jayenge.

Ek level back jane ke liye:

cd ..

Do levels back jane ke liye:

cd ../..

Home directory me wapas jane ke liye:

cd ~

3. Directory List Karna — ls

Current directory ke andar files aur directories dekhne ke liye:

ls

Detailed information ke liye:

ls -l

Hidden files ke saath complete listing:

ls -la

Linux me hidden files generally . se start hoti hain.

Example:

.config
.bashrc

4. Linux Commands ki Help Kaise Lein?

Linux me har command ko yaad karna zaroori nahi hai. Sabse important skill ye hai ki jab command ya option yaad na ho, to uski documentation kaise dekhein.

--help

Kai commands --help option provide karti hain.

Example:

aircrack-ng --help

Isse command ke available options ka overview mil sakta hai.

General format:

<command> --help

man — Manual Pages

Detailed documentation ke liye man command use hoti hai.

man aircrack-ng

Example:

man ls

Manual page se command ka purpose, options aur usage samajhne me help milti hai.

Cybersecurity learner ke liye documentation padhna ek important skill hai.


5. Files aur Commands Search Karna

Linux me different situations ke liye multiple search commands available hain.

locate

locate filename

locate indexed database ka use karke files ko quickly search kar sakta hai.


which

which aircrack-ng

which normally batata hai ki executable command system ke PATH me kis location par available hai.

Example:

/usr/bin/aircrack-ng

whereis

whereis aircrack-ng

whereis command binary, source aur manual page jaise related locations search kar sakti hai.


find

Detailed filesystem search ke liye:

find / -type f -name "filename"

Example:

find / -type f -name "apache2"

find powerful command hai aur large filesystem me search karne ke liye useful hai.


6. Linux Files Create aur Read Karna

touch

Empty file create karne ke liye:

touch newfile

Example:

touch notes.txt

cat — File Read Karna

cat notes.txt

Ye file ka content terminal me display karta hai.


cat >

Nayi file create karke usme text enter kar sakte hain:

cat > file.txt

Text enter karne ke baad Ctrl + D press karke input end kiya ja sakta hai.


cat >>

Existing file ke end me additional text add karne ke liye:

cat >> file.txt

Ye existing content ko overwrite karne ke bajay new content append karta hai.


7. Directory aur File Management

mkdir

New directory create karne ke liye:

mkdir newdir

cp

File copy karne ke liye:

cp file1 /path/

Example:

cp notes.txt /home/sajid/Documents/

mv

File ko rename ya move karne ke liye:

mv oldname newname

Example:

mv test.txt notes.txt

rm

File delete karne ke liye:

rm file.txt

Important: rm se delete ki gayi file normally recycle bin me nahi jaati.


rmdir

Empty directory delete karne ke liye:

rmdir empty_dir

rm -r

Directory aur uske andar ke contents ko recursively delete kar sakta hai:

rm -r foldername

Is command ko carefully use karein, especially / ya important system directories ke saath.


8. Text Files ko Read Karne ke Commands

Large files ko read karne ke liye poori file ek saath display karna practical nahi hota.

head

File ki beginning ki lines dekhne ke liye:

head -n 10 file.txt

Ye first 10 lines display karega.


tail

File ki last 10 lines:

tail -n 10 file.txt

Logs ko monitor karne me tail particularly useful ho sakta hai.


nl

Line numbers ke saath content:

nl file.txt

more aur less

Large files ko page-by-page read karne ke liye:

more file.txt

ya:

less file.txt

less large text files aur logs inspect karne ke liye commonly useful hai.


9. grep — Specific Text Search Karna

grep Linux ka bahut useful text-searching tool hai.

Example:

ps aux | grep apache2

Yahan:

  • ps aux processes ki information provide karta hai.
  • | output ko next command tak bhejta hai.
  • grep apache2 sirf relevant text ko filter karta hai.

Configuration file me specific word search karne ka example:

grep output /etc/snort/snort.conf

Isse file me output word wali matching lines search ki ja sakti hain.

Pipe | kya karta hai?

Linux me pipe:

|

ek command ke output ko doosri command ke input ke roop me use karne deta hai.

Ye concept Linux command-line workflow ka important part hai.


10. Network Management — ifconfig aur dhclient

Linux me network interfaces ko inspect aur configure karne ke liye different tools available hain.

Traditional command:

ifconfig

Ye network interfaces aur unki information display kar sakti hai.

Note: Modern Linux distributions me ip command ko ifconfig ke alternative ke roop me commonly use kiya jata hai.

Example:

ip addr

Static IP Example

Traditional ifconfig syntax:

ifconfig eth0 192.168.1.115

Subnet mask aur broadcast ke saath:

ifconfig eth0 192.168.1.115 netmask 255.255.0.0 broadcast 192.168.1.255

Actual interface name aapke system par eth0, ens33, enp0s3 etc. ho sakta hai.

Isliye pehle interface check karna useful hai:

ip addr

MAC Address Change Example

Linux lab environment me network interface ki MAC address temporarily change karne ke traditional commands:

ifconfig eth0 down
ifconfig eth0 hw ether 00:11:22:33:44:55
ifconfig eth0 up

Ye command sirf apne authorized lab/system par testing ke liye use karein.


DHCP se IP Request

dhclient eth0

Ye DHCP server se IP configuration request karne ke liye use ho sakta hai.

Modern systems me NetworkManager ya ip/distribution-specific networking tools bhi commonly used hote hain.


/etc/hosts

Local hostname-to-IP mappings ke liye:

/etc/hosts

file important hai.

Example:

192.168.1.10    testserver

Is type ki entry se local system hostname ko specified IP address se associate kar sakta hai.


11. Package Management — APT

Debian-based Linux distributions, jaise Kali Linux aur Debian/Ubuntu, me APT package management ke liye commonly use hota hai.

Package Search

apt-cache search <keyword>

Example:

apt-cache search nmap

Package Install

apt-get install <packagename>

Example:

sudo apt-get install nmap

Package Remove

sudo apt-get remove <packagename>

Package aur Configuration Purge

sudo apt-get purge <packagename>

Repository Information Update

sudo apt-get update

Ye configured repositories se latest package information retrieve karta hai.


Installed Packages Upgrade

sudo apt-get upgrade

System administration ke context me update aur upgrade ka difference samajhna important hai:

update → package information refresh

upgrade → available package updates install


12. Git Repository Clone Karna

Cybersecurity tools aur open-source projects ke source code repositories commonly Git par hosted hote hain.

Repository clone karne ke liye:

git clone <URL>

Example:

git clone https://example.com/project.git

Clone karne ke baad project ki files local machine par aa jati hain.

Important: Unknown repositories se code execute karne se pehle source aur contents ko verify karein.


13. Linux File Permissions

Linux security ka ek fundamental concept hai file permissions.

Linux permissions mainly teen categories ke liye define hoti hain:

  • Owner (u) — file ka owner
  • Group (g) — associated group
  • Others (o) — baaki users

Basic permissions:

  • r = Read
  • w = Write
  • x = Execute

Permission Values

PermissionBinaryOctal
---0000
--x0011
-w-0102
-wx0113
r--1004
r-x1015
rw-1106
rwx1117

Isliye:

r = 4
w = 2
x = 1

Permission Example

Agar permission hai:

rwx

to value hogi:

4 + 2 + 1 = 7

Agar:

rw-

to:

4 + 2 = 6

Agar:

r-x

to:

4 + 1 = 5

14. chmod — Permissions Change Karna

Example:

chmod 777 file

Iska matlab Owner, Group aur Others ko rwx permissions dena.

Lekin 777 ko unnecessarily use karna security risk ho sakta hai, kyunki ye sabhi users ko broad permissions deta hai.

Specific permission remove karne ka example:

chmod u-w file

Yahan:

  • u = Owner
  • -w = Write permission remove

Permissions check karne ke liye:

ls -l

Example:

-rw-r--r-- 1 sajid users 1200 notes.txt

Is output ke beginning me permission information दिखाई देती है.


15. Linux Process Management

Linux me running programs ko processes kaha jata hai.

Har running process ka ek PID (Process ID) hota hai.


ps

Current user’s processes dekhne ke liye:

ps

ps aux

System ke running processes ka detailed view:

ps aux

top

Real-time process aur system resource monitoring ke liye:

top

top me CPU usage, memory usage aur running processes jaise information continuously update hoti rehti hai.


16. Process Priority — nice aur renice

Linux me processes ki scheduling priority ko influence karne ke liye nice aur renice commands use ki ja sakti hain.

New process ke liye:

nice -n 10 <program>

Existing process ke liye:

renice 19 <PID>

Nice value ka concept samajhne ke liye important point:

Higher nice value generally lower scheduling priority ko indicate karti hai.

Negative nice values higher priority ke liye use hoti hain aur inke liye elevated privileges ki zarurat ho sakti hai.


17. Process Terminate Karna — kill

Kisi process ko terminate karne ke liye:

kill <PID>

Forceful termination ke liye:

kill -9 <PID>

-9 SIGKILL signal use karta hai, jo process ko immediately terminate karne ke liye hota hai.

Isliye kill -9 ko default option ke roop me use karne ke bajay pehle normal termination try karna generally better hota hai:

kill <PID>

Linux Basics for Hackers — Ye Commands Cybersecurity Me Kyon Important Hain?

Linux ko sirf commands ka collection samajhna enough nahi hai. Cybersecurity me important skill hai system ko samajhna.

Aapko gradually ye concepts comfortable hone chahiye:

  1. Linux filesystem ka structure
  2. Terminal navigation
  3. Files aur directories manage karna
  4. Search commands use karna
  5. Text filtering with grep
  6. Network interfaces samajhna
  7. Packages install aur manage karna
  8. Git repositories use karna
  9. File permissions samajhna
  10. Running processes monitor karna

In concepts ko samajhne ke baad aap cybersecurity labs aur penetration-testing environments me Linux commands ko zyada confidently use kar sakte hain.


Linux Basics for Hackers Book Review — Beginner ke Liye Kya Seekhne Ko Milta Hai?

Linux Basics for Hackers type cybersecurity-focused Linux books ka main benefit ye hai ki Linux concepts ko general desktop usage ke bajay cybersecurity ke context me samjhaya jata hai.

Beginner ke liye particularly useful topics hain:

  • Linux command line
  • Filesystem navigation
  • File permissions
  • Networking
  • Process management
  • Shell usage
  • Security-related tools
  • Practical command-line workflow

Lekin book padhte waqt sirf commands memorize karna target nahi hona chahiye.

For example:

find / -type f -name "test.txt"

sirf command yaad karne ke bajay ye samajhna zyada important hai ki:

find → search karta hai

/ → search starting point

-type f → regular files

-name → filename ke basis par matching

Isi tarah command ko break karke samajhne se Linux ki understanding strong hoti hai.


Practical Learning Method

Agar aap Linux aur cybersecurity beginner hain, to har command ko ek safe virtual machine ya authorized lab environment me practice karein.

Ek simple practice sequence ho sakta hai:

pwd
whoami
ls
ls -la
cd /tmp
mkdir linux-practice
cd linux-practice
touch notes.txt
cat > notes.txt
cat notes.txt
cp notes.txt backup.txt
mv backup.txt backup-notes.txt
ls -l

Uske baad permissions practice karein:

chmod 600 notes.txt
ls -l

Phir processes dekhein:

ps aux
top

Aur finally text filtering practice karein:

ps aux | grep bash

Is tarah commands ko practically use karne se Linux command line ka confidence gradually improve hota hai.


Conclusion

Linux cybersecurity ki foundation ka ek important part hai. Filesystem structure, navigation, file management, permissions, networking, package management aur processes jaise concepts ko samajhna future me penetration testing aur security tools ko samajhne me helpful hota hai.

Linux Basics for Hackers jaise resources ko follow karte waqt focus commands ratne ke bajay unke purpose aur underlying Linux concepts ko samajhne par hona chahiye.

Agar aap TryHackMe, Kali Linux ya cybersecurity labs start kar rahe hain, to ye Linux fundamentals aapke liye ek strong starting point provide kar sakte hain.


Quick Linux Command Cheat Sheet

TaskCommand
Current directorypwd
Current userwhoami
List filesls
Detailed listls -l
Hidden filesls -la
Change directorycd
Go backcd ..
Create filetouch file.txt
Read filecat file.txt
Create directorymkdir folder
Copycp
Move/Renamemv
Delete filerm
Searchfind
Find executablewhich
Search textgrep
First lineshead
Last linestail
File permissionschmod
Running processesps aux
Process monitortop
Terminate processkill PID
Package updateapt-get update
Package installapt-get install
Git repositorygit clone

Author: Sajid Sheikh
Website: Cyber-Teck
Topic: Linux Basics, Cybersecurity, Ethical Hacking, Linux for Beginners

Leave a Comment

Your email address will not be published. Required fields are marked *