टर्मिनल देखने में डरावना लगता है, लेकिन असल में यह आपके कंप्यूटर को काम बताने के लिए बस एक text box है। ये ~20 commands रोज़मर्रा के ज़्यादातर काम कवर कर देते हैं। एक बार सीख लें तो आप इन्हें हमेशा इस्तेमाल करेंगे।
1. रास्ता ढूँढना
pwd # print working directory – where am I? ls # list files in the current folder ls -la # list everything, including hidden files (a = all, l = details) cd folder # change directory – go into a folder cd .. # go up one folder cd ~ # go to your home folder cd - # go back to the previous folder you were in
cd वह command है जिसे आप सबसे ज़्यादा टाइप करेंगे। याद रखें: .. का मतलब है “parent folder” और ~ का मतलब है “home”।
2. फ़ाइलों के साथ काम करना
cp source dest # copy a file mv source dest # move (or rename) a file rm file # delete a file rm -r folder # delete a folder and everything inside it (careful!) mkdir folder # make a new folder touch file # create an empty file cat file # print a file's contents less file # view a file page by page (q to quit) nano file # edit a file in a simple editor (Ctrl+O save, Ctrl+X exit)
rm के लिए कोई undo नहीं होता। यह टर्मिनल में किसी चीज़ को शून्य में खींचने जैसा है। Enter दबाने से पहले हमेशा path को दोबारा जाँच लें।
3. परमिशन्स (Linux आपसे क्यों पूछता है कि आप कौन हैं)
Linux users और permissions के इर्द-गिर्द बना है। हर फ़ाइल का एक owner होता है और access settings होती हैं – read, write, execute – owner, उसके group और बाकी सभी के लिए।
ls -l # shows permissions (like -rw-r--r-- and the owner) chmod +x file # make a file executable chown user file # change a file's owner sudo command # run a command as administrator
sudo (“superuser do”) वह तरीका है जिससे आप सॉफ़्टवेयर इंस्टॉल करते हैं या system settings बदलते हैं। इसका इस्तेमाल तभी करें जब कोई command permission error के साथ fail हो – और हमेशा पहले जानें कि command क्या करता है।
4. सॉफ़्टवेयर इंस्टॉल करना (package managers)
Linux सॉफ़्टवेयर को package manager के ज़रिए इंस्टॉल करता है। command आपके distro family पर निर्भर करता है:
# Debian / Ubuntu / Mint sudo apt update && sudo apt upgrade # update everything sudo apt install package-name # install sudo apt remove package-name # remove # Fedora / RHEL family sudo dnf upgrade # update everything sudo dnf install package-name # install sudo dnf remove package-name # remove
&& का मतलब है “पहला चलाएँ, और अगर वह सफल हो तो दूसरा चलाएँ”। पहले update करने से package lists current रहती हैं।
5. Pipes: टर्मिनल की सुपरपावर
| character (pipe) एक command के output को अगले command में भेजता है। यहीं पर टर्मिनल जादुई बन जाता है:
ls | wc -l # count how many files are here history | tail # show your recent commands grep error log.txt # search a file for "error" ps aux | grep firefox # find running Firefox processes
grep अपने लिए एक अलग medal का हकदार है – यह text में pattern खोजता है। आप इसे लगातार इस्तेमाल करेंगे।
6. सिस्टम पर नज़र रखना
top # live view of running processes (q to quit) htop # friendlier version of top (if installed) df -h # how full are my disks? (h = human-readable) free -h # how much RAM is in use? uname -a # what kernel am I running? ip a # my network addresses ping google.com # is the internet reachable? (Ctrl+C to stop)
7. समय बचाने वाले त्वरित टिप्स
- Tab से autocomplete – फ़ाइल और command नाम पूरे करने के लिए Tab दबाएँ। हर टर्मिनल यूज़र ऐसा ही करता है।
- Up arrow – पिछली command को वापस लाएँ।
- Ctrl+C – जो भी चल रहा है उसे cancel करें।
- Ctrl+L – स्क्रीन clear करें।
- Ctrl+R – अपनी command history में search करें।
- man command – किसी भी command के लिए manual पढ़ें (बाहर निकलने के लिए q)।
एक छोटा वास्तविक सेशन
ऊपर बताई गई हर चीज़ एक साथ कैसे काम करती है, इसका उदाहरण यहाँ है:
$ cd ~/projects $ mkdir mysite $ cd mysite $ touch index.html $ ls -la $ nano index.html # type some HTML, Ctrl+O, Ctrl+X $ grep -i "title" index.html # did I write a title? $ cd .. $ rm -r mysite # oops – no undo from here
आपको यह सब याद रखने की ज़रूरत नहीं है – man और tab key आपको संभाल लेंगे। बस इन्हें पास रखें और टर्मिनल डरावना लगना बंद करके आपका पसंदीदा tool बन जाएगा।
permission number table को फिर कभी याद न करें – read/write/execute को toggle करें और तुरंत chmod command पाएँ।
Calculator खोलें →मुफ़्त VelsTech Linux command cheat sheet लें – वे commands जिन्हें आप असल में इस्तेमाल करेंगे, सब एक पेज पर।
Cheat Sheet पाएँ →