फ़ाइलों, अनुमतियों, प्रोसेस, नेटवर्किंग और अधिक के लिए आवश्यक Linux और Bash कमांड्स।
सही कमांड जानने के बाद Linux कमांड लाइन तेज़ और शक्तिशाली है। यह चीट शीट आवश्यक Linux और Bash कमांड्स को कार्य के अनुसार समूहित करती है ताकि आप टर्मिनल छोड़े बिना जो चाहिए वह ढूंढ सकें।
फ़ाइलों में नेविगेट करने से लेकर प्रोसेस और नेटवर्किंग प्रबंधित करने तक, इस पेज को त्वरित संदर्भ के रूप में तैयार रखें। प्रत्येक कमांड उसके कार्य के संक्षिप्त विवरण के साथ आता है।
Navigation & Files
| Command | What it does |
|---|
pwd | Print the current working directory. |
ls -la | List all files, including hidden, with details. |
cd <dir> | Change to a directory. |
cd .. | Move up one directory. |
mkdir -p <path> | Create a directory, including parents. |
touch <file> | Create an empty file or update its timestamp. |
cp -r <src> <dest> | Copy files or directories recursively. |
mv <src> <dest> | Move or rename a file or directory. |
rm -rf <path> | Delete files/directories recursively (careful!). |
Viewing & Editing
| Command | What it does |
|---|
cat <file> | Print the entire contents of a file. |
less <file> | View a file one page at a time. |
head -n 20 <file> | Show the first 20 lines of a file. |
tail -f <file> | Follow a file as new lines are appended. |
nano <file> | Open a simple terminal text editor. |
Permissions & Ownership
| Command | What it does |
|---|
chmod +x <file> | Make a file executable. |
chmod 644 <file> | Set read/write for owner, read for others. |
chown user:group <file> | Change a file's owner and group. |
sudo <command> | Run a command with superuser privileges. |
Search & Text
| Command | What it does |
|---|
grep -r "text" . | Search recursively for text in files. |
find . -name "*.js" | Find files matching a pattern. |
wc -l <file> | Count the number of lines in a file. |
sort <file> | Sort the lines of a file. |
sed 's/a/b/g' <file> | Replace all occurrences of a with b. |
Process Management
| Command | What it does |
|---|
ps aux | List all running processes. |
top | Show live process and resource usage. |
kill <pid> | Send a termination signal to a process. |
kill -9 <pid> | Force-kill a process immediately. |
<command> & | Run a command in the background. |
Networking
| Command | What it does |
|---|
curl <url> | Transfer data from or to a URL. |
ping <host> | Test connectivity to a host. |
wget <url> | Download a file from the web. |
ssh user@host | Connect to a remote machine over SSH. |
netstat -tulpn | List listening ports and services. |
Archives & System
| Command | What it does |
|---|
tar -czf out.tar.gz <dir> | Create a gzip-compressed archive. |
tar -xzf file.tar.gz | Extract a gzip-compressed archive. |
df -h | Show disk space usage, human-readable. |
du -sh <dir> | Show the total size of a directory. |
free -h | Show memory usage, human-readable. |
Linux कमांड्स चीट शीट से जुड़े सामान्य प्रश्न
मैं Linux में किसी फ़ाइल को executable कैसे बनाऊं?
executable अनुमति जोड़ने के लिए chmod +x filename चलाएं, फिर इसे ./filename से चलाएं।
kill और kill -9 में क्या अंतर है?
kill PID एक सौम्य termination सिग्नल भेजता है, जिससे प्रोसेस साफ़-सफ़ाई कर सके। kill -9 PID इसे बिना cleanup के तुरंत बलपूर्वक समाप्त कर देता है — इसका उपयोग केवल तब करें जब प्रोसेस अनुत्तरदायी हो।
मैं फ़ाइलों के अंदर टेक्स्ट कैसे खोजूं?
मौजूदा डायरेक्टरी और उसकी उप-डायरेक्टरी की सभी फ़ाइलों में पुनरावर्ती खोज के लिए grep -r "text" . का उपयोग करें।
मैं डिस्क स्थान उपयोग कैसे जांचूं?
प्रति फ़ाइल-सिस्टम कुल डिस्क उपयोग के लिए df -h चलाएं, या किसी विशिष्ट डायरेक्टरी का कुल आकार देखने के लिए du -sh directory।
मैं .tar.gz फ़ाइल कैसे एक्सट्रैक्ट करूं?
tar -xzf file.tar.gz चलाएं। फ्लैग का अर्थ है extract (x), gzip (z), और file (f)।