Linux File Management Commands Explained (cp, mv, scp) | Hindi

CYBER-TECK.IN

Linux File Management Commands Explained

A Complete Guide for Beginners, System Admins, and Ethical Hackers

Linux me files aur folders ko manage karna ek basic aur bahut important skill hai. Chahe aap system administrator ho, ethical hacker ho, ya TryHackMe jaise platforms par practice kar rahe ho, file management commands ka knowledge zaroori hai. Is article me hum Linux ke sabse useful file management commands ko examples ke saath samjhenge.

01 Copy Files and Folders – cp

cp command ka use kisi file ya folder ki copy banane ke liye kiya jata hai.

Syntax
cp [source] [destination]
Example
cp ssh.conf /home/newfolder

Yeh command ssh.conf file ko /home/newfolder directory me copy kar dega.

File Name me Spaces ho to:

Agar file ya folder ke naam me spaces hain, to usse double quotes me likhna hoga.

cp "My File.txt" /home/newfolder

02 Move Files and Folders – mv

mv command ka use files ya folders ko ek location se dusri location par move karne ke liye hota hai.

Syntax
mv [filename] [destination]
Example
mv ssh.conf /home/newfolder

03 Move Multiple Files

Ek hi command se multiple files ko move kiya ja sakta hai.

Syntax
mv file1 file2 file3 -t destination
Example
mv logs.txt keys.conf script.py -t /home/savedWork

Is command se teeno files /home/savedWork folder me move ho jayengi.

04 Move All Files

Current directory ki sabhi files ko dusri directory me move karne ke liye * wildcard ka use hota hai.

Example
mv * /home/scripts

05 Rename Files or Folders

Linux me rename karne ke liye bhi mv command ka use hota hai.

Syntax
mv oldfilename newfilename
Example
mv ssh.conf NewSSH.conf

06 Create a New File – touch

Nayi empty file create karne ke liye touch command use hoti hai.

Syntax
touch filename
Example
touch newFile.txt

07 Create a New Folder – mkdir

Naya folder banane ke liye mkdir command use hoti hai.

Syntax
mkdir foldername
Example
mkdir newFolder

08 Edit Files – nano

nano ek simple terminal text editor hai jisse file ko create ya edit kiya ja sakta hai.

Syntax
nano filename
Example
nano keys.conf

09 View File Content – cat

File ke andar ka content terminal par dekhne ke liye cat command ka use hota hai.

Syntax
cat filename
Example
cat keys.conf

10 Upload File to a Remote Machine – scp

scp (Secure Copy) command ka use SSH ke through files ko ek remote Linux machine par securely transfer karne ke liye hota hai.

Syntax
scp filename username@IP:/destination
Example
scp example.txt john@192.168.100.123:/home/john/

11 Run a Bash Script

Agar kisi script ko executable permission mili hui hai, to usse directly run kiya ja sakta hai.

Syntax
./scriptname
Example
./timer

Special Characters in File Names

Kabhi-kabhi file ka naam - (dash) se start hota hai. Linux ise command-line option samajh leta hai, jisse error aa sakta hai. Is problem ko solve karne ke liye filename se pehle -- likhen.

Example
cp -- -filename.txt /home/folderExample

Yeh command file ko successfully copy kar dega.

Quick Reference Table

Task Command
Copy Filecp
Move Filemv
Rename Filemv old new
Create Filetouch
Create Foldermkdir
Edit Filenano
View File Contentcat
Upload File (Remote)scp
Run Script./script

Conclusion

Linux me file management commands jaise cp, mv, touch, mkdir, nano, cat aur scp rozana use hone wale commands hain. In commands ko achhi tarah samajhna Linux administration, Ethical Hacking, Cyber Security aur TryHackMe labs ke liye bahut zaroori hai. Agar aap beginner hain, to in commands ki practice terminal me zaroor karein. Jitni zyada practice karenge, utna hi Linux use karna easy hota jayega.

Published on cyber-teck.in | Linux Tutorial & Cyber Security Guide
CYBER-TECK.IN

Linux File Management Quiz & Challenge

Test Your Knowledge with Interactive Practice Questions and Flag Challenge

Ab tak aapne Linux ki important file management commands jaise cp, mv, mkdir, touch, nano, cat aur scp ke baare me seekha. Chaliye ab ek chhota sa quiz aur practical challenge karte hain.

Q1 Move All Files in Directory

Q. Agar aap current directory ki sabhi files ko /home/francis/logs directory me move karna chahte hain, to kaunsi command use karenge?

Answer
mv * /home/francis/logs
Explanation
  • mv command files ko move karti hai.
  • * wildcard current directory ki sabhi files ko select karta hai.
  • Is command ke baad sabhi files /home/francis/logs me move ho jayengi.

Q2 Remote File Transfer via SCP

Q. Aapke system me /home/james/Desktop/ folder ke andar script.py file hai. Is file ko remote machine 192.168.10.5 ke /home/john/scripts folder me username john ke through transfer karna hai.

Answer
scp /home/james/Desktop/script.py john@192.168.10.5:/home/john/scripts
Explanation
  • scp ka matlab Secure Copy hota hai.
  • Yeh SSH protocol ka use karke file ko securely transfer karta hai.
  • Syntax: scp source username@IP:destination

Q3 Rename Folder with Special Characters

Q. -logs naam ke folder ko -newlogs naam se rename kaise karenge?

Answer
mv -- -logs -newlogs
Explanation
  • Kyuki folder ka naam - (dash) se start ho raha hai, Linux ise command option samajh leta hai.
  • -- Linux ko batata hai ki iske baad jo bhi likha hai, woh filename hai, command option nahi.

Q4 Copy File with Spaces

Q. encryption keys naam ki file ko /home/john/logs directory me copy kaise karenge?

Answer
cp "encryption keys" /home/john/logs
Explanation
  • File ke naam me space hai, isliye usse double quotes (" ") ke andar likhna zaroori hai.

🎯 Practical Challenge

Task

topson user ki directory ke andar readME_hint.txt naam ki file ko find karein. Us file ko open karke usme diye gaye instructions follow karein aur second flag hasil karein.

💡 Hint & Commands

Is challenge ko solve karne ke liye aap in commands ka use kar sakte hain:

1. File Ko Find Karne Ke Liye:
find /home/topson -name readME_hint.txt
2. File Content Dekhne Ke Liye:
cat /path/to/readME_hint.txt
ya:
nano /path/to/readME_hint.txt

Note: Final flag har TryHackMe machine ya lab me alag hota hai. Isliye yahan actual flag mention nahi kiya gaya hai. Aapko challenge complete karke apni machine se second flag retrieve karna hoga.

Published on cyber-teck.in | Linux Tutorial & Cyber Security Guide

Find a file named readME_hint.txt inside topson’s directory and read it. Using the instructions it gives you, get the second flag.

More From Author

What is Qubes OS?

Hashing क्या है? Linux में Hashing और Hash Cracking Explained

Leave a Reply

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