Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> प्रोग्रामिंग

मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

परिचय

<पी> आवश्यक लिनक्स कमांड के लिए इस व्यापक गाइड के साथ अपने लिनक्स सिस्टम की पूरी क्षमता को अनलॉक करें। चाहे आप एक अनुभवी प्रशासक हों या अभी शुरुआत कर रहे हों, कुशल सर्वर प्रबंधन, स्क्रिप्ट लेखन और समस्या निवारण के लिए इन आदेशों में महारत हासिल करना महत्वपूर्ण है। इस ट्यूटोरियल में, आप फ़ाइल प्रबंधन, प्रक्रिया नियंत्रण, उपयोगकर्ता पहुंच, नेटवर्क कॉन्फ़िगरेशन और सिस्टम डिबगिंग के लिए सबसे अधिक उपयोग किए जाने वाले और शक्तिशाली कमांड सीखेंगे।

<पी> आप 50 से अधिक अवश्य जानने योग्य Linux कमांड सीखेंगे जो आपको लिनक्स पावर उपयोगकर्ता में बदल देगा। बुनियादी से लेकर उन्नत तक, ये कमांड आपके रास्ते में आने वाले किसी भी कार्य से निपटने के लिए आपके लिए उपयोगी उपकरण बन जाएंगे।

मुख्य बातें

  • लिनक्स कमांड उद्देश्य द्वारा व्यवस्थित किए जाते हैं:फ़ाइल प्रबंधन (ls , cp , mv , rm ), प्रक्रिया नियंत्रण (ps , kill , top ), उपयोगकर्ता अनुमतियाँ (chmod , chown , sudo ), और नेटवर्किंग (ssh , ping , wget ).
  • man कमांड किसी भी लिनक्स कमांड के लिए अंतर्निहित दस्तावेज़ीकरण प्रदान करता है और जब आपको सिंटैक्स या विकल्प विवरण की आवश्यकता होती है तो यह प्राथमिक संदर्भ होता है।
  • grep का उपयोग करें टेक्स्ट आउटपुट या फ़ाइलें खोजने के लिए, head /tail फ़ाइल सामग्री का पूर्वावलोकन करने के लिए, और diff /cmp फ़ाइलों की तुलना करने के लिए.
  • फ़ाइल अनुमतियाँ chmod के साथ प्रबंधित की जाती हैं (मोड बिट्स बदलें) और chown (स्वामी बदलें), जो सर्वर सुरक्षा और पहुंच नियंत्रण के लिए महत्वपूर्ण हैं।
  • जैसे कमांड tar , zip , और unzip संग्रहण और संपीड़न संभालें; ssh और scp सुरक्षित रिमोट एक्सेस और फ़ाइल स्थानांतरण को संभालें।
  • प्रक्रिया प्रबंधन आदेश (ps , kill , killall , top ) सिस्टम स्वास्थ्य की निगरानी और अनुत्तरदायी प्रक्रियाओं को समाप्त करने के लिए आवश्यक हैं।

आवश्यकताएँ

<पी> हम इन आदेशों को उबंटू सर्वर पर चलाएंगे, लेकिन आप किसी भी आधुनिक लिनक्स वितरण पर इसका पालन कर सकते हैं। आप उबंटू पर प्रारंभिक सर्वर सेटअप के लिए हमारे गाइड का पालन करके इस ट्यूटोरियल के लिए एक उबंटू सर्वर स्थापित कर सकते हैं। <पी> DigitalOcean ऐप प्लेटफ़ॉर्म का उपयोग करके GitHub से अपने फ्रंटएंड एप्लिकेशन को तैनात करें। DigitalOcean को अपने ऐप को बढ़ाने पर ध्यान केंद्रित करने दें।

<पी> आइए सीधे इसमें शामिल हों!

शीर्ष 50 Linux कमांड जो आपको एक नियमित उपयोगकर्ता के रूप में जानना चाहिए

  1. ls - लिनक्स में निर्देशिकाओं को सूचीबद्ध करने के लिए सबसे अधिक उपयोग किया जाने वाला कमांड
  2. pwd - लिनक्स में वर्किंग डायरेक्टरी कमांड प्रिंट करें
  3. सीडी - निर्देशिकाओं के माध्यम से नेविगेट करने के लिए लिनक्स कमांड
  4. mkdir - लिनक्स में निर्देशिका बनाने के लिए कमांड का उपयोग किया जाता है
  5. mv - लिनक्स में फ़ाइलों को स्थानांतरित करें या उनका नाम बदलें
  6. cp - एमवी के समान उपयोग लेकिन लिनक्स में फ़ाइलों की प्रतिलिपि बनाने के लिए
  7. rm - फ़ाइलें या निर्देशिका हटाएं
  8. स्पर्श करें - खाली/खाली फ़ाइलें बनाएं
  9. ln - अन्य फ़ाइलों के लिए प्रतीकात्मक लिंक (शॉर्टकट) बनाएं
  10. स्पष्ट - टर्मिनल डिस्प्ले साफ़ करें
  11. बिल्ली - टर्मिनल पर फ़ाइल सामग्री प्रदर्शित करें
  12. प्रतिध्वनि - कमांड का पालन करने वाले किसी भी टेक्स्ट को प्रिंट करें
  13. कम - टर्मिनल में पृष्ठांकित आउटपुट प्रदर्शित करने के लिए लिनक्स कमांड
  14. आदमी - सभी लिनक्स कमांड के लिए मैनुअल पेजों तक पहुंच
  15. अनाम - ओएस के बारे में बुनियादी जानकारी प्राप्त करने के लिए लिनक्स कमांड
  16. व्हाओमी - सक्रिय उपयोक्तानाम प्राप्त करें
  17. tar - लिनक्स में फ़ाइलों को निकालने और संपीड़ित करने का आदेश
  18. ग्रेप - आउटपुट के भीतर एक स्ट्रिंग खोजें
  19. सिर - ऊपर से पंक्तियों की निर्दिष्ट संख्या लौटाएँ
  20. पूंछ - नीचे से पंक्तियों की निर्दिष्ट संख्या लौटाएँ
  21. अंतर - दो फ़ाइलों के बीच अंतर ढूंढें
  22. सीएमपी - आपको यह जांचने की अनुमति देता है कि क्या दो फ़ाइलें समान हैं
  23. कॉम - अंतर और सीएमपी
  24. की कार्यक्षमता को जोड़ती है
  25. सॉर्ट - आउटपुट करते समय फ़ाइल की सामग्री को सॉर्ट करने के लिए लिनक्स कमांड
  26. निर्यात - लिनक्स में पर्यावरण चर निर्यात करें
  27. ज़िप - लिनक्स में ज़िप फ़ाइलें
  28. अनज़िप - Linux में फ़ाइलें अनज़िप करें
  29. ssh - Linux में सुरक्षित शेल कमांड
  30. सेवा - सेवाओं को शुरू करने और बंद करने के लिए लिनक्स कमांड
  31. पीएस - सक्रिय प्रक्रियाएं प्रदर्शित करें
  32. मार डालो और मार डालो - सक्रिय प्रक्रियाओं को प्रक्रिया आईडी या नाम से समाप्त करें
  33. df - डिस्क फ़ाइल सिस्टम जानकारी प्रदर्शित करें
  34. माउंट - Linux में फ़ाइल सिस्टम माउंट करें
  35. chmod - फ़ाइल अनुमतियाँ बदलने का आदेश
  36. चाउन - फ़ाइलों या फ़ोल्डरों का स्वामित्व प्रदान करने का आदेश
  37. ifconfig - नेटवर्क इंटरफेस और आईपी पते प्रदर्शित करें
  38. ट्रेसरआउट - गंतव्य तक पहुंचने के लिए सभी नेटवर्क हॉप्स का पता लगाएं
  39. wget - इंटरनेट से सीधे फ़ाइलें डाउनलोड करें
  40. ufw -फ़ायरवॉल कमांड
  41. iptables - अन्य सभी फ़ायरवॉल उपयोगिताओं के साथ इंटरफ़ेस करने के लिए बेस फ़ायरवॉल
  42. apt, pacman, yum, rpm - वितरण के आधार पर पैकेज प्रबंधक
  43. सुडो - Linux में विशेषाधिकार बढ़ाने का आदेश
  44. cal - एक कमांड-लाइन कैलेंडर देखें
  45. उपनाम - अपने नियमित रूप से उपयोग किए जाने वाले कमांड के लिए कस्टम शॉर्टकट बनाएं
  46. dd - मुख्य रूप से बूट करने योग्य USB स्टिक
  47. बनाने के लिए उपयोग किया जाता है
  48. कहाँ है - कमांड के लिए बाइनरी, सोर्स और मैनुअल पेज का पता लगाएं
  49. क्या है - खोजें कि किसी कमांड का उपयोग किस लिए किया जाता है
  50. शीर्ष - सक्रिय प्रक्रियाओं को उनके सिस्टम उपयोग के साथ लाइव देखें
  51. useradd और usermod - एक नया उपयोगकर्ता जोड़ें या मौजूदा उपयोगकर्ता डेटा बदलें
  52. पासवर्ड - मौजूदा उपयोगकर्ताओं के लिए पासवर्ड बनाएं या अपडेट करें

फ़ाइल और निर्देशिका कमांड

कमांड विवरण उदाहरण lsसूची निर्देशिका सामग्री।ls सीडीचेंज निर्देशिका।cd /path/to/directory pwd वर्तमान निर्देशिका दिखाएं।pwd mkdir एक नई निर्देशिका बनाएं।mkdir new_directory rmdirएक खाली निर्देशिका हटाएं।rmdir empty_directory rmफ़ाइलें या निर्देशिकाएँ हटाएँ।rm file.txt एक खाली फ़ाइल स्पर्श करें।touch new_file.txt cpफ़ाइलों या निर्देशिकाओं की प्रतिलिपि बनाएँ।cp file.txt /path/to/destination mvफ़ाइलों को स्थानांतरित करें या उनका नाम बदलें।mv file.txt /path/to/new_location catफ़ाइल सामग्री प्रदर्शित करें।cat file.txt टर्मिनल में nano / vimEdit फ़ाइलें।nano file.txt निर्देशिका पदानुक्रम में फ़ाइलों की खोज करें।find . -name "file.txt" पैटर्न का उपयोग करके grepसर्च टेक्स्ट।grep "pattern" file.txt tarArchive और फ़ाइलों को संपीड़ित करें।tar -cvf archive.tar file1.txt file2.txt dfफ़ाइल सिस्टम का डिस्क उपयोग दिखाएं।df डुशो निर्देशिका/फ़ाइल आकार।du -sh /path/to/directory chmodफ़ाइल अनुमतियाँ बदलें।chmod 755 file.txt chownChange फ़ाइल स्वामी।chown user:group file.txt एक फ़ाइल सिस्टम माउंट करें।mount /dev/sdb1 /mnt umountएक फ़ाइल सिस्टम को अनमाउंट करें।umount /mnt

नेटवर्किंग कमांड

कमांड विवरण नमूना उपयोग होस्ट से पिंगटेस्ट कनेक्टिविटी।ping google.com ifconfig / ip aडिस्प्ले नेटवर्क इंटरफेस।ifconfig या ip a नेटस्टैट / एसएसशो नेटवर्क कनेक्शन।netstat -tuln या ss -tuln wgetHTTP/FTP के माध्यम से फ़ाइलें डाउनलोड करें।wget http://example.com/file.zip URL सिंटैक्स का उपयोग करके कर्लट्रांसफ़र डेटा।curl -O http://example.com/file.zip एनसी (नेटकैट) नेटवर्क डिबगिंग और डेटा ट्रांसफर।nc -zv 192.168.1.1 80 tcpdump नेटवर्क पैकेट कैप्चर करें और उसका विश्लेषण करें।tcpdump -i eth0 iptablesफ़ायरवॉल नियमों को कॉन्फ़िगर करें।iptables -A INPUT -p tcp --dport 22 -j ACCEPT ट्रैसरआउटट्रेस पथ पैकेट एक नेटवर्क होस्ट पर ले जाता है।traceroute example.com डोमेन नाम या आईपी एड्रेस मैपिंग प्राप्त करने के लिए nslookupQuery DNS।nslookup example.com ssh किसी दूरस्थ होस्ट से सुरक्षित रूप से कनेक्ट करें।ssh user@example.com

प्रक्रिया और सिस्टम मॉनिटरिंग कमांड

कमांड विवरण उदाहरण कमांड ps चल रही प्रक्रियाएँ दिखाएँ।ps aux टॉपडायनामिक प्रोसेस व्यूअर।top शीर्ष का htopउन्नत संस्करण।htop किल एक प्रक्रिया को सिग्नल भेजें।kill <PID> किलऑलकिल प्रक्रियाओं को नाम से।killall <process_name> अपटाइम सिस्टम अपटाइम और लोड।uptime whoamiCurrent लॉग-इन उपयोगकर्ता।whoami envपर्यावरण चर प्रदर्शित करें।env स्ट्रेसट्रेस सिस्टम एक प्रक्रिया को कॉल करता है।strace -p <PID> systemctlसिस्टमडी सेवाओं का प्रबंधन करें।systemctl status <service_name> जर्नलक्टलव्यू सिस्टम लॉग।journalctl -xe मेमोरी उपयोग निःशुल्क प्रदर्शित करें।free -h vmstatरिपोर्ट वर्चुअल मेमोरी आँकड़े।vmstat 1 iostatReport CPU और I/O आँकड़े।iostat lsofप्रक्रियाओं के अनुसार खुली हुई फ़ाइलों को सूचीबद्ध करें।lsof dmesgPrint कर्नेल रिंग बफ़र संदेश।dmesg

उपयोगकर्ता और अनुमति प्रबंधन आदेश

कमांड विवरण उदाहरण कमांड passwd उपयोगकर्ता पासवर्ड बदलें।passwd <username> adduser / useradd एक नया उपयोगकर्ता जोड़ें।adduser <username> या useradd <username> भ्रम फैलाने वाला / उपयोगकर्ताडेल एक उपयोगकर्ता को हटाएं।deluser <username> या userdel <username> usermod उपयोगकर्ता खाते को संशोधित करें।usermod -aG <group> <username> समूहसमूह सदस्यताएँदिखाएँ।groups <username> sudoExecute कमांड को रूट के रूप में।sudo <command> उपयोगकर्ता पासवर्ड समाप्ति जानकारी बदलें।chage -l <username> आईडी उपयोगकर्ता पहचान जानकारी प्रदर्शित करें।id <username> newgrp एक नए समूह में लॉग इन करें।newgrp <group>

फ़ाइल स्थानांतरण और सिंक्रोनाइज़ेशन कमांड

कमांड विवरण उदाहरण कमांड एससीपी SSH पर फ़ाइलों को सुरक्षित रूप से कॉपी करें।scp user@remote:/path/to/file /local/destination rsync कुशलतापूर्वक फ़ाइलों और निर्देशिकाओं को सिंक करें।rsync -avz /local/directory/ user@remote:/path/to/destination फ़ाइल ट्रांसफ़र प्रोटोकॉल का उपयोग करके ftpट्रांसफर फ़ाइलें।ftp ftp.example.com sftp SSH फ़ाइल ट्रांसफ़र प्रोटोकॉल का उपयोग करके फ़ाइलों को सुरक्षित रूप से स्थानांतरित करें।sftp user@remote:/path/to/file wgetवेब से फ़ाइलें डाउनलोड करें।wget http://example.com/file.zip कर्ल डेटा को किसी सर्वर से या सर्वर पर स्थानांतरित करें।curl -O http://example.com/file.zip

टेक्स्ट प्रोसेसिंग कमांड

कमांड विवरण उदाहरण कमांड awkPattern स्कैनिंग और प्रसंस्करण।awk '{print $1}' file.txt टेक्स्ट को फ़िल्टर करने/संशोधित करने के लिए sedStream संपादक।sed 's/old/new/g' file.txt कट करेंपाठ की पंक्तियों से अनुभाग हटाएं।cut -d':' -f1 /etc/passwd पाठ की पंक्तियों को क्रमबद्ध करें।sort file.txt grepपाठ में पैटर्न खोजें।grep 'pattern' file.txt wcशब्दों, पंक्तियों और वर्णों की गिनती करें।wc -l file.txt फ़ाइलों की पंक्तियों को पेस्ट करें।paste file1.txt file2.txt एक सामान्य फ़ील्ड पर दो फ़ाइलों की पंक्तियों में शामिल हों।join file1.txt file2.txt हेडआउटपुट फ़ाइलों का पहला भाग।head -n 10 file.txt फ़ाइलों के अंतिम भाग को टेलआउटपुट करें।tail -n 10 file.txt

शेल यूटिलिटीज और शॉर्टकट कमांड

कमांड विवरण उदाहरण कमांड उपनाम कमांड के लिए शॉर्टकट बनाएं।alias ll='ls -la' unaliasएक उपनाम हटाएँ।unalias ll इतिहास पहले दर्ज किए गए आदेश दिखाएं।history टर्मिनल स्क्रीन साफ़ करें।clear रिबूटसिस्टम को रीबूट करें।reboot शटडाउनपावर सिस्टम बंद करें।shutdown now दिनांक प्रदर्शित करें या सिस्टम दिनांक और समय सेट करें।date इकोपाठ की एक पंक्ति प्रदर्शित करें।echo "Hello, World!" एक निर्दिष्ट समय के लिए नींद में देरी।sleep 5 समयआदेश निष्पादन की अवधि मापें।time ls आउटपुट फ़ुलस्क्रीन दिखाते हुए समय-समय पर किसी प्रोग्राम को निष्पादित करें।watch -n 5 df -h <पी> आइए अब इनमें से प्रत्येक कमांड के बारे में थोड़ा गहराई से जानें और उन्हें अधिक विस्तार से समझें। हमारे पास उनमें से प्रत्येक व्यक्तिगत कमांड के लिए पहले से ही बहुत सारे मौजूदा लेख हैं। आपकी सुविधा के लिए, हम सभी मौजूदा लेखों में लिंक जोड़ देंगे, और जैसे-जैसे नए विषय शामिल होंगे, लेख को अपडेट करना जारी रखेंगे।

ls लिनक्स में कमांड

<पी> ls कमांड का उपयोग वर्तमान कार्यशील निर्देशिका में फ़ाइलों और निर्देशिकाओं को सूचीबद्ध करने के लिए किया जाता है। यह सबसे अधिक उपयोग किए जाने वाले Linux कमांड में से एक होने जा रहा है जिसके बारे में आपको जरूर जानना चाहिए।

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> जैसा कि आप उपरोक्त छवि में देख सकते हैं, बिना किसी तर्क के स्वयं कमांड का उपयोग करने से हमें निर्देशिका में सभी फ़ाइलों और निर्देशिकाओं के साथ एक आउटपुट मिलेगा। कमांड आउटपुट में डेटा प्रदर्शित करने के मामले में बहुत अधिक लचीलापन प्रदान करता है।

<पी> ls का उपयोग करने के बारे में और जानें आदेश

<पी> आदेश सूची पर वापस जाएं ↑

pwd लिनक्स में कमांड

<पी> pwd कमांड आपको अपने टर्मिनल पर वर्तमान कार्यशील निर्देशिका को प्रिंट करने की अनुमति देता है। यह एक बहुत ही बुनियादी आदेश है और अपने उद्देश्य को बहुत अच्छी तरह से हल करता है।

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> अब, आपके टर्मिनल प्रॉम्प्ट में आमतौर पर पूरी निर्देशिका होनी चाहिए। लेकिन यदि ऐसा नहीं होता है, तो यह उस निर्देशिका को देखने के लिए एक त्वरित कमांड हो सकता है जिसमें आप हैं। इस कमांड का एक अन्य अनुप्रयोग स्क्रिप्ट बनाते समय होता है जहां यह कमांड हमें उस निर्देशिका को ढूंढने की अनुमति दे सकता है जहां स्क्रिप्ट सहेजी गई है।

<पी> आदेश सूची पर वापस जाएं ↑

cd लिनक्स में कमांड

<पी> टर्मिनल के भीतर काम करते समय, निर्देशिकाओं के भीतर घूमना काफी आवश्यक है। सीडी कमांड महत्वपूर्ण लिनक्स कमांड में से एक है जिसे आपको अवश्य जानना चाहिए, और यह आपको निर्देशिकाओं के माध्यम से नेविगेट करने में मदद करेगा। बस cd टाइप करें उसके बाद निर्देशिका, जैसा कि नीचे दिखाया गया है।

root@ubuntu:~# cd <directory path>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> जैसा कि आप उपरोक्त कमांड में देख सकते हैं, मैंने बस cd /etc/ टाइप किया है /etc निर्देशिका में जाने के लिए। हमने pwd का उपयोग किया वर्तमान कार्यशील निर्देशिका को मुद्रित करने का आदेश।

<पी> आदेश सूची पर वापस जाएं ↑

mkdir लिनक्स में कमांड

<पी> mkdir कमांड आपको टर्मिनल के भीतर से निर्देशिका बनाने की अनुमति देता है।

root@ubuntu:~# mkdir <folder name>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> जैसा कि आप उपरोक्त स्क्रीनशॉट में देख सकते हैं, हमने केवल इस सरल कमांड के साथ एक नई निर्देशिका बनाई है।

<पी> आदेश सूची पर वापस जाएं ↑

cp और mv आदेश

<पी> cp और mv कमांड विंडोज़ में कॉपी-पेस्ट और कट-पेस्ट कमांड के बराबर हैं। लेकिन चूँकि Linux के पास फ़ाइलों का नाम बदलने के लिए वास्तव में कोई कमांड नहीं है, इसलिए हम mv का भी उपयोग करते हैं फ़ाइलों और फ़ोल्डरों का नाम बदलने का आदेश।

root@ubuntu:~# cp <source> <destination>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> उपरोक्त कमांड में, हमने सैंपल नामक फ़ाइल की एक प्रति बनाई। आइए देखें कि यदि हम mv का उपयोग करते हैं तो क्या होता है उसी तरीके से कमांड करें।

root@ubuntu:~# mv <source> <destination>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> उपरोक्त मामले में, चूँकि हम फ़ाइल को उसी निर्देशिका में ले जा रहे थे, इसने नाम बदलने के रूप में कार्य किया। फ़ाइल का नाम अब बदल गया है।

<पी> आदेश सूची पर वापस जाएं ↑

rm लिनक्स में कमांड

<पी> पिछले अनुभाग में, हमने सैंपल-कॉपी फ़ाइल हटा दी थी। आरएम कमांड का उपयोग फ़ाइलों और फ़ोल्डरों को हटाने के लिए किया जाता है और यह महत्वपूर्ण लिनक्स कमांड में से एक है जिसे आपको अवश्य जानना चाहिए।

root@ubuntu:~# rm <file name>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> किसी निर्देशिका को हटाने के लिए, आपको -r जोड़ना होगा इसके लिए तर्क. -r के बिना तर्क, rm आदेश निर्देशिकाओं को नहीं हटाएगा।

root@ubuntu:~# rm -r <folder/directory name>
<पी> -r rm में ध्वजांकित करें लिनक्स में कमांड का मतलब "रिकर्सिव" है ”। जब rm के साथ प्रयोग किया जाता है कमांड, यह न केवल निर्दिष्ट फ़ाइल को बल्कि उसकी सभी उपनिर्देशिकाओं और उन उपनिर्देशिकाओं के भीतर की फ़ाइलों को भी पुनरावर्ती रूप से हटा देगा।

<पी> ध्यान दें: rm का उपयोग करते समय सावधान रहना महत्वपूर्ण है -r के साथ कमांड ध्वज, क्योंकि यह बड़ी संख्या में फ़ाइलों और निर्देशिकाओं को जल्दी और स्थायी रूप से हटा सकता है। -i का उपयोग करना एक अच्छा विचार है -r के संयोजन में ध्वजांकित करें ध्वज, जो प्रत्येक फ़ाइल और निर्देशिका को हटाने से पहले आपको पुष्टि के लिए संकेत देगा।

<पी> उदाहरण के लिए, mydir को हटाने के लिए निर्देशिका और इसकी सामग्री की पुष्टि के लिए, आप इस कमांड का उपयोग कर सकते हैं:

root@ubuntu:~# rm -ri mydir
<पी> यह आपको mydir के भीतर प्रत्येक फ़ाइल और निर्देशिका को हटाने से पहले पुष्टि के लिए संकेत देगा निर्देशिका.

<पी> आदेश सूची पर वापस जाएं ↑

touch लिनक्स में कमांड

<पी> touch लिनक्स में कमांड एक खाली फ़ाइल बनाता है या किसी मौजूदा फ़ाइल के टाइमस्टैम्प को अपडेट करता है।

root@ubuntu:~# touch <file name>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> आदेश सूची पर वापस जाएं ↑

ln लिनक्स में कमांड

<पी> किसी अन्य फ़ाइल का लिंक बनाने के लिए, हम ln का उपयोग करते हैं आदेश. यदि आप लिनक्स प्रशासक के रूप में काम करने की योजना बना रहे हैं तो यह सबसे महत्वपूर्ण लिनक्स कमांडों में से एक है जिसे आपको जानना चाहिए।

root@ubuntu:~# ln -s <source path> <link name>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> -s ध्वज एक प्रतीकात्मक लिंक बनाता है (जिसे सिम्लिंक या सॉफ्ट लिंक के रूप में भी जाना जाता है) किसी फ़ाइल या निर्देशिका के लिए। प्रतीकात्मक लिंक एक विशेष प्रकार की फ़ाइल है जो किसी अन्य फ़ाइल या निर्देशिका के लिए शॉर्टकट या पॉइंटर के रूप में कार्य करती है।

<पी> डिफ़ॉल्ट रूप से, ln कमांड हार्ड लिंक बनाएगा प्रतीकात्मक या सॉफ्ट लिंक के बजाय।

<पी> ध्यान दें: मान लीजिए कि आपके पास एक टेक्स्ट फ़ाइल है। यदि आप कोईप्रतीकात्मक लिंकबनाते हैं उस फ़ाइल के लिए, लिंक केवल मूल फ़ाइल का एक सूचक है। यदि आप मूल फ़ाइल को हटा देते हैं, तो लिंक टूट जाएगा, क्योंकि इसमें अब इंगित करने के लिए कुछ भी नहीं है।

<पी> एक कड़ी कड़ी बिल्कुल समान सामग्री वाली मूल फ़ाइल की दर्पण प्रतिलिपि है। प्रतीकात्मक लिंक की तरह, यदि आप मूल फ़ाइल की सामग्री को संपादित करते हैं, तो वे परिवर्तन हार्ड लिंक में दिखाई देंगे। हालाँकि, यदि आप मूल फ़ाइल को हटा देते हैं, तो हार्ड लिंक अभी भी काम करेगा, और आप इसे मूल फ़ाइल की सामान्य प्रतिलिपि की तरह देख और संपादित कर सकते हैं।

<पी> सॉफ्ट और हार्ड लिंक के बारे में और जानें।

<पी> आदेश सूची पर वापस जाएं ↑

clear लिनक्स में कमांड

<पी> clear लिनक्स में कमांड टर्मिनल स्क्रीन को साफ़ करता है। यह टर्मिनल पर वर्तमान में प्रदर्शित सभी टेक्स्ट और आउटपुट को हटा देता है और आपको काम करने के लिए एक साफ स्लेट देता है।

<पी> clear का उपयोग कैसे करें इसका एक उदाहरण यहां दिया गया है आदेश:

root@ubuntu:~# clear
<पी> इससे टर्मिनल स्क्रीन साफ़ हो जाएगी और कर्सर स्क्रीन के ऊपरी-बाएँ कोने पर चला जाएगा।

<पी> आप clear का भी उपयोग कर सकते हैं अन्य कमांड के साथ संयोजन में कमांड, जैसे:

root@ubuntu:~# ls -l; clear
<पी> यह वर्तमान निर्देशिका में फ़ाइलों और निर्देशिकाओं को सूचीबद्ध करेगा, और फिर टर्मिनल स्क्रीन को साफ़ कर देगा।

<पी> ध्यान दें: clear कमांड आपके सिस्टम से किसी भी फाइल या डेटा को नहीं हटाता है। यह केवल टर्मिनल के डिस्प्ले को प्रभावित करता है।

cat , echo , और less आदेश

<पी> जब आप किसी फ़ाइल की सामग्री को आउटपुट करना चाहते हैं या टर्मिनल आउटपुट पर कुछ भी प्रिंट करना चाहते हैं, तो हम cat का उपयोग करते हैं या echo आदेश. आइए देखें उनका मूल उपयोग।

root@ubuntu:~# cat <file name>
root@ubuntu:~# echo <Text to print on terminal>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> जैसा कि आप उपरोक्त उदाहरण में देख सकते हैं, cat कमांड, जब हमारे New-File पर उपयोग किया जाता है , फ़ाइल की सामग्री प्रिंट करता है। उसी समय, जब हम echo का उपयोग करते हैं कमांड, यह बस कमांड के बाद जो कुछ भी आता है उसे प्रिंट करता है।

<पी> less कमांड का उपयोग तब किया जाता है जब किसी कमांड द्वारा मुद्रित आउटपुट स्क्रीन स्पेस से बड़ा होता है और स्क्रॉलिंग की आवश्यकता होती है। less कमांड उपयोगकर्ता को आउटपुट को तोड़ने और एंटर या स्पेस कुंजी के उपयोग से स्क्रॉल करने की अनुमति देता है।

<पी> ऐसा करने का सरल तरीका पाइप ऑपरेटर (|) का उपयोग करना है ).

root@ubuntu:~# cat /boot/grub/grub.cfg | less
<पी> ध्यान दें: -S का प्रयोग करें less के साथ ध्वजांकित करें लाइन रैपिंग सक्षम करने के लिए। यह आपको क्षैतिज रूप से स्क्रॉल किए बिना टेक्स्ट की लंबी पंक्तियों को देखने की अनुमति देगा।

<पी> -N का प्रयोग करें less के साथ ध्वजांकित करें लाइन नंबर प्रदर्शित करने के लिए. यह तब उपयोगी हो सकता है जब आपको पाठ के किसी विशिष्ट भाग की पंक्ति संख्या जानने की आवश्यकता हो।

<पी> आप इन उपयोगी झंडों का उपयोग निम्न प्रकार से कर सकते हैं:

root@ubuntu:~# cat /boot/grub/grub.cfg | less -SN
<पी> less का उपयोग करना पाइप ऑपरेटर के साथ कई अलग-अलग स्थितियों में उपयोगी हो सकता है। यहां कुछ उदाहरण दिए गए हैं:

  • लंबे समय तक चलने वाले कमांड का आउटपुट देखना, जैसे top या htop .
  • कमांड के आउटपुट में विशिष्ट टेक्स्ट की खोज करना, जैसे grep या cat .
<पी> आदेश सूची पर वापस जाएं ↑

man लिनक्स में कमांड

<पी> man कमांड एक बहुत ही उपयोगी लिनक्स कमांड है जिसे हर किसी को जानना चाहिए। लिनक्स के साथ काम करते समय, जो पैकेज हम डाउनलोड करते हैं उनमें बहुत अधिक कार्यक्षमता हो सकती है। यह सब जानना असंभव है।

<पी> man लिनक्स में कमांड का उपयोग किसी विशिष्ट कमांड के लिए मैनुअल पेज प्रदर्शित करने के लिए किया जाता है। यह कमांड के बारे में विस्तृत जानकारी प्रदान करता है, जिसमें इसके सिंटैक्स, विकल्प और उदाहरण शामिल हैं।

<पी> man का उपयोग कैसे करें इसका एक उदाहरण यहां दिया गया है आदेश:

  1. एक टर्मिनल खोलें और man ls टाइप करें ls के लिए मैनुअल पेज प्रदर्शित करने के लिए आदेश.
root@ubuntu:~# man ls
<पी> यह एक पेज प्रदर्शित करेगा जो कुछ इस तरह दिखेगा:

LS(1) User Commands LS(1)
NAME
 ls - list directory contents
SYNOPSIS
 ls [OPTION]... [FILE]...
DESCRIPTION
 List information about the FILEs (the current directory by default).
 Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
 Mandatory arguments to long options are mandatory for short options too.
 -a, --all
 do not ignore entries starting with .
 -A, --almost-all
 do not list implied . and ..
 -c with -lt: sort by, and show, ctime (time of last modification
 of file status information) with -l: show ctime and sort
 by name; 
...
<पी> आदेश सूची पर वापस जाएं ↑

uname और whoami आदेश

<पी> uname और whoami कमांड आपको कुछ बुनियादी जानकारी तक पहुंचने की अनुमति देते हैं जो कई सिस्टम पर काम करते समय काम आती है।

<पी> uname लिनक्स में कमांड सिस्टम के कर्नेल के बारे में जानकारी प्रदर्शित करता है, जिसमें कर्नेल नाम, होस्टनाम, कर्नेल रिलीज़, कर्नेल संस्करण और मशीन हार्डवेयर नाम शामिल है।

<पी> whoami लिनक्स में कमांड वर्तमान उपयोगकर्ता का उपयोगकर्ता नाम लौटाता है। इसका अर्थ है "मैं कौन हूँ?" और इसका उपयोग अक्सर शेल स्क्रिप्ट या टर्मिनल में वर्तमान उपयोगकर्ता की पहचान निर्धारित करने के लिए किया जाता है।

<पी> आइए दोनों कमांड के आउटपुट को देखें और देखें कि हम इनका उपयोग कैसे कर सकते हैं।

root@ubuntu:~# uname -a
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> पैरामीटर -a uname के साथ कमांड का मतलब "सभी" है। इससे पूरी जानकारी प्रिंट हो जाती है. यदि पैरामीटर नहीं जोड़ा गया है, तो आपको आउटपुट के रूप में केवल "लिनक्स" मिलेगा।

<पी> ध्यान दें: कुछ महत्वपूर्ण झंडे जिनका उपयोग आप uname के साथ कर सकते हैं आदेश.

  1. uname -s का उपयोग करें कर्नेल नाम प्रदर्शित करने के लिए.
  2. uname -n का उपयोग करें होस्टनाम प्रदर्शित करने के लिए.
  3. uname -r का उपयोग करें कर्नेल रिलीज़ प्रदर्शित करने के लिए।
  4. uname -v का उपयोग करें कर्नेल संस्करण प्रदर्शित करने के लिए.
  5. uname -m का उपयोग करें मशीन हार्डवेयर नाम प्रदर्शित करने के लिए।
<पी> आदेश सूची पर वापस जाएं ↑

tar , zip , और unzip आदेश

<पी> tar लिनक्स में कमांड का उपयोग संग्रहीत फ़ाइलों को बनाने और निकालने के लिए किया जाता है। हम tar का उपयोग करके कई अलग-अलग संग्रह फ़ाइलें निकाल सकते हैं आदेश.

<पी> एक संग्रह बनाने के लिए, हम -c का उपयोग करते हैं पैरामीटर, और एक संग्रह निकालने के लिए, हम -x का उपयोग करते हैं पैरामीटर. आइए देखें कि यह कैसे काम करता है।

#Compress
root@ubuntu:~# tar -cvf <archive name> <files separated by space>
#Extract
root@ubuntu:~# tar -xvf <archive name>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> पहली पंक्ति में, हमने Compress.tar नामक एक संग्रह बनाया न्यू-फ़ाइल और न्यू-फ़ाइल-लिंक के साथ। अगले कमांड में, हमने उन फ़ाइलों को आर्काइव से निकाल लिया है।

<पी> आइए zip पर चर्चा करें और unzip आदेश. दोनों बहुत सीधे हैं. आप उन्हें बिना किसी पैरामीटर के उपयोग कर सकते हैं, और वे इच्छानुसार काम करेंगे। आइए नीचे एक उदाहरण देखें।

root@ubuntu:~# zip <archive name> <file names separated by space>
root@ubuntu:~# unzip <archive name>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> चूँकि हमारे पास पहले से ही वे फ़ाइलें उसी निर्देशिका, unzip में हैं कमांड उन फ़ाइलों को ओवरराइट करने से पहले हमें संकेत देता है।

<पी> आदेश सूची पर वापस जाएं ↑

grep लिनक्स में कमांड

<पी> grep कमांड लिनक्स और यूनिक्स-आधारित ऑपरेटिंग सिस्टम में एक शक्तिशाली और बहुमुखी टेक्स्ट खोज उपकरण है। यह एक या अधिक फ़ाइलों में विशिष्ट पैटर्न या स्ट्रिंग की खोज कर सकता है और अन्य कमांड के आउटपुट को फ़िल्टर कर सकता है।

<पी> grep कमांड का मतलब "ग्लोबल रेगुलर एक्सप्रेशन प्रिंट" है, जो कई लाइनों और फ़ाइलों में रेगुलर एक्सप्रेशन खोजने की इसकी क्षमता को दर्शाता है।

root@ubuntu:~# <Any command with output> | grep "<string to find>"
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> यह आदेश का एक सरल प्रदर्शन था. ग्रेप कमांड के बारे में और जानें।

<पी> आदेश सूची पर वापस जाएं ↑

head और tail आदेश

<पी> बड़ी फ़ाइलों को आउटपुट करते समय, head और tail आदेश काम आते हैं. ये कमांड क्रमशः फ़ाइल की शुरुआत या अंत प्रदर्शित करते हैं। इनका उपयोग आमतौर पर किसी फ़ाइल को टेक्स्ट एडिटर में खोले बिना उसकी सामग्री को तुरंत देखने के लिए किया जाता है।

<पी> head और tail कमांड डिफ़ॉल्ट रूप से फ़ाइल की पहली 10 पंक्तियाँ प्रदर्शित करते हैं। भिन्न संख्या में पंक्तियाँ प्रदर्शित करने के लिए, आप -n का उपयोग कर सकते हैं विकल्प, उसके बाद उन पंक्तियों की संख्या, जिन्हें आप प्रदर्शित करना चाहते हैं।

<पी> यहां head का उपयोग करने का एक उदाहरण दिया गया है और tail आदेश:

root@ubuntu:~# head <file name>
root@ubuntu:~# tail <file name>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> जैसा कि आप देख सकते हैं, हेड कमांड ने फ़ाइल के शीर्ष से 10 पंक्तियाँ दिखाईं।

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> टेल कमांड ने फ़ाइल से नीचे की 10 पंक्तियों को आउटपुट किया।

<पी> इन कमांड का उपयोग किसी फ़ाइल की सामग्री को तुरंत देखने, समस्या निवारण के लिए वास्तविक समय के अपडेट की निगरानी करने, अन्य कमांड से आउटपुट फ़िल्टर करने और लॉग विश्लेषण करने के लिए किया जा सकता है।

<पी> आदेश सूची पर वापस जाएं ↑

diff , comm , और cmp आदेश

<पी> diff , comm , और cmp सभी कमांड का उपयोग लिनक्स और यूनिक्स-आधारित ऑपरेटिंग सिस्टम में फ़ाइलों की तुलना करने के लिए किया जाता है। इन आदेशों का उपयोग दो फ़ाइलों के बीच अंतर की पहचान करने, परिवर्तनों को मर्ज करने और अन्य फ़ाइल तुलना कार्य करने के लिए किया जा सकता है।

root@ubuntu:~# diff <file 1> <file 2>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> जैसा कि आप ऊपर देख सकते हैं, हमने नई-फ़ाइल-संपादित फ़ाइल में पाठ का एक छोटा सा टुकड़ा जोड़ा है, जिसमें कहा गया है, "यह पंक्ति संपादित है"।

<पी> cmp कमांड का उपयोग दो फ़ाइलों की तुलना करने और उनके बीच भिन्न पहली बाइट प्रदर्शित करने के लिए किया जाता है। इसका उपयोग बाइनरी फ़ाइलों के बीच अंतर की पहचान करने या फ़ाइलों में भ्रष्टाचार की जांच करने के लिए किया जा सकता है।

root@ubuntu:~# cmp <file 1> <file 2>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> cmp कमांड हमें केवल लाइन नंबर बताता है, जो अलग है। वास्तविक पाठ नहीं.

<पी> comm कमांड का उपयोग दो क्रमबद्ध फ़ाइलों की तुलना करने और उन पंक्तियों को प्रदर्शित करने के लिए किया जाता है जो प्रत्येक फ़ाइल के लिए अद्वितीय हैं, साथ ही वे पंक्तियाँ जो दोनों फ़ाइलों के लिए सामान्य हैं।

root@ubuntu:~# comm <file 1> <file2>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> बाईं ओर संरेखित पाठ केवल file 1 में मौजूद है . केंद्र-संरेखित पाठ केवल file 2 में मौजूद है . और दाएँ-संरेखित पाठ दोनों फ़ाइलों में मौजूद है।

<पी> ऐसा प्रतीत होता है, comm जब हम बड़ी फ़ाइलों की तुलना करने का प्रयास कर रहे होते हैं और सब कुछ एक साथ व्यवस्थित देखना चाहते हैं तो कमांड सबसे अधिक समझ में आता है।

<पी> ये तीनों कमांड लिनक्स और यूनिक्स-आधारित ऑपरेटिंग सिस्टम में फाइलों के साथ काम करने के लिए आवश्यक उपकरण हैं। diff का उपयोग कैसे करें यह समझकर , comm , और cmp कमांड प्रभावी ढंग से, आप फ़ाइलों के बीच अंतर की पहचान कर सकते हैं, परिवर्तनों को मर्ज कर सकते हैं, और अन्य फ़ाइल तुलना कार्य कर सकते हैं।

<पी> ये आदेश आपको फ़ाइलों के साथ समस्याओं को पहचानने और हल करने में मदद कर सकते हैं, साथ ही परिवर्तनों को ट्रैक करने और संस्करण नियंत्रण बनाए रखने में भी मदद कर सकते हैं। चाहे आप डेवलपर हों या सिस्टम प्रशासक, ये कमांड आपके टूलकिट का एक अनिवार्य हिस्सा हैं।

<पी> आदेश सूची पर वापस जाएं ↑

sort लिनक्स में कमांड

<पी> sort कमांड का उपयोग टेक्स्ट फ़ाइल या लिनक्स और यूनिक्स-आधारित ऑपरेटिंग सिस्टम में मानक इनपुट में लाइनों को सॉर्ट करने के लिए किया जाता है। इसका उपयोग पंक्तियों को आरोही या अवरोही क्रम में क्रमबद्ध करने और अन्य सॉर्टिंग ऑपरेशन करने के लिए किया जा सकता है, जैसे कि फ़ील्ड द्वारा सॉर्ट करना या कस्टम सॉर्टिंग ऑर्डर का उपयोग करना।

<पी> sort का मूल सिंटैक्स आदेश है:

root@ubuntu:~# sort <filename>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> डिफ़ॉल्ट रूप से, sort कमांड ASCII मिलान अनुक्रम में पंक्तियों को क्रमबद्ध करता है , जो संख्याओं या विशेष वर्णों को क्रमबद्ध करते समय अप्रत्याशित परिणाम दे सकता है। संख्याओं को संख्यात्मक क्रम में क्रमबद्ध करने के लिए, आप -n का उपयोग कर सकते हैं विकल्प.

<पी> यहां -n का उपयोग करने का एक उदाहरण दिया गया है विकल्पः

root@ubuntu:~# sort -n file.txt
<पी> उपरोक्त आदेश file.txt में पंक्तियों को क्रमबद्ध करेगा संख्यात्मक क्रम में.

<पी> sort कमांड का उपयोग -k का उपयोग करके विशिष्ट फ़ील्ड के आधार पर लाइनों को क्रमबद्ध करने के लिए भी किया जा सकता है विकल्प.

<पी> यहां -k का उपयोग करने का एक उदाहरण दिया गया है विकल्पः

root@ubuntu:~# sort -k 2 file.txt
<पी> यह कमांड file.txt में पंक्तियों को सॉर्ट करेगा दूसरे फ़ील्ड पर आधारित.

<पी> sort लिनक्स और यूनिक्स-आधारित ऑपरेटिंग सिस्टम में टेक्स्ट फ़ाइलों के साथ काम करने के लिए कमांड एक शक्तिशाली और लचीला उपकरण है। sort का उपयोग कैसे करें यह समझकर कमांड प्रभावी ढंग से, आप टेक्स्ट फ़ाइलों में पंक्तियों को सॉर्ट कर सकते हैं, विशिष्ट फ़ील्ड के आधार पर लाइनों को सॉर्ट कर सकते हैं, और अन्य सॉर्टिंग ऑपरेशन कर सकते हैं।

<पी> ये कमांड आपको डेटा को व्यवस्थित और विश्लेषण करने और अन्य फ़ाइल हेरफेर कार्य करने में मदद कर सकते हैं। चाहे आप डेवलपर हों या सिस्टम प्रशासक, sort कमांड आपके टूलकिट का एक अनिवार्य हिस्सा है।

<पी> आदेश सूची पर वापस जाएं ↑

export लिनक्स में कमांड

<पी> export लिनक्स और यूनिक्स-आधारित ऑपरेटिंग सिस्टम में कमांड का उपयोग पर्यावरण चर सेट करने के लिए किया जाता है। पर्यावरण चर का उपयोग उन सूचनाओं को संग्रहीत करने के लिए किया जाता है जिनका उपयोग प्रक्रियाओं या आदेशों द्वारा किया जा सकता है।

<पी> एक बार पर्यावरण चर सेट हो जाने पर, इसे उसी शेल में चल रही किसी भी प्रक्रिया या कमांड द्वारा एक्सेस किया जा सकता है।

<पी> पर्यावरण चर का उपयोग सूचनाओं की एक विस्तृत श्रृंखला को संग्रहीत करने के लिए किया जा सकता है, जैसे कॉन्फ़िगरेशन सेटिंग्स, उपयोगकर्ता प्राथमिकताएँ, या सिस्टम जानकारी।

<पी> यहां export का उपयोग करने का एक उदाहरण दिया गया है आदेश:

root@ubuntu:~# export <variable name>=<value>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> export के बारे में और जानें आदेश

<पी> आदेश सूची पर वापस जाएं ↑

ssh लिनक्स में कमांड

<पी> ssh लिनक्स और यूनिक्स-आधारित ऑपरेटिंग सिस्टम में कमांड रिमोट सर्वर से एक सुरक्षित शेल कनेक्शन स्थापित करता है। कमांड स्थानीय और दूरस्थ सर्वर के बीच एक सुरक्षित एन्क्रिप्टेड कनेक्शन प्रदान करता है, जिससे उपयोगकर्ताओं को कमांड चलाने और फ़ाइलों को सुरक्षित रूप से स्थानांतरित करने की अनुमति मिलती है।

<पी> ssh का मूल सिंटैक्स आदेश है:

root@ubuntu:~ ssh username@remote-server
<पी> यह कमांड एक ssh स्थापित करता है remote-server से कनेक्शन username का उपयोग करना खाता.

<पी> ssh command supports a wide range of options and configurations, including:

  • Configuring authentication methods (password, public key, etc.)
  • Configuring encryption algorithms
  • Configuring compression
  • Configuring port forwarding
  • Configuring X11 forwarding
  • Configuring SSH keys

The service command in Linux

<पी> The service command in Linux is used to manage system services, which are long-running processes that are started at boot time and run in the background. These services are responsible for providing various system functionalities, such as networking, database management, and user authentication.

<पी> The service command is used to start, stop, restart, and check the status of these services. It is a front-end to the systemctl command, which is used to manage the systemd service manager.

<पी> The basic syntax of the command is as below.

root@ubuntu:~ service ssh status
root@ubuntu:~ service ssh stop
root@ubuntu:~ service ssh start 
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> As you can see in the image, the ssh server is running on our system.

<पी> Jump back to commands list ↑

The ps , kill , and killall commands

<पी> The ps , kill , and killall commands are all used to manage processes in Linux.

<पी> The ps command is used to display information about the current running processes on the system. Here are some examples of using the ps command:

<पी> Display a list of all running processes:

root@ubuntu:~ ps -ef
<पी> Display a list of all processes for a specific process ID (PID):

root@ubuntu:~ ps -p PID
<पी> Let’s see all of this in action:

root@ubuntu:~ ps 
root@ubuntu:~ kill <process ID>
root@ubuntu:~ killall <process name>
<पी> For demonstration purposes, we will create a shell script with an infinite loop and will run it in the background.

<पी> With the use of the & symbol, we can pass a process into the background. As you can see, a new bash process with PID 14490 is created.

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> Now, to kill a process with the kill command, you can type kill followed by the PID(Process Id) of the process.

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> But if you do not know the process ID and just want to kill the process with the name, you can make use of the killall command.

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> You will notice that PID 14490 stayed active. That is because, both times, we killed the sleep process.

<पी> Learn more about the ps command and the kill command.

<पी> Jump back to commands list ↑

The df and mount commands

<पी> When working with Linux, the df and mount commands are very efficient utilities to mount filesystems and get details of the file system.

<पी> The df command is used to display the amount of disk space used and available on the file systems, and the mount command is used to mount a file system or device to a specific directory.

<पी> When we say mount , it means that we’ll connect the device to a folder so we can access the files from our filesystem. The default syntax to mount a filesystem is below:

root@ubuntu:~ mount /dev/cdrom /mnt
root@ubuntu:~ df -h
<पी> In the above case, /dev/cdrom is the device that needs to be mounted. Usually, a mountable device is found inside the /dev फ़ोल्डर. mnt is the destination folder to which to mount the device. You can change it to any folder you want, but we have used /mnt as it’s the system’s default folder for mounting devices.

<पी> To see the mounted devices and get more information about them, we use the df command. Just typing df will give us the data in bytes, which is not readable. So, we’ll use the -h parameter to make the data human-readable.

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> Jump back to commands list ↑

The chmod and chown commands

<पी> The chmod and chown commands are used to modify file permissions and ownership in Linux.

<पी> The chmod command is used to change the permissions of a file or directory, and the chown command is used to change the ownership of a file or directory

<पी> The default syntax for both the commands is chmod <parameter> filename and chown <user:group> filename
root@ubuntu:~ chmod +x loop.sh
root@ubuntu:~ chmod root:root loop.sh
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> In the above example, we’re adding executable permissions to the loop.sh file with the chmod command. In addition, with the chown command, we’ve made it accessible only to the root user and users within the root group.

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> As you will notice, the root root part is now changed to www-data which is the new user who has full file ownership.

<पी> Learn more about the Linux file Permissions and using the chmod command.

<पी> Jump back to commands list ↑

The ifconfig and traceroute commands

<पी> The ifconfig and traceroute commands manage network interfaces and trace the route of network packets in Linux.

<पी> The ifconfig command will give you the list of all the network interfaces along with the IP addresses, MAC addresses and other information about the interface.

root@ubuntu:~ ifconfig
<पी> There are multiple parameters that can be used, but we’ll work with the basic command here.

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> The traceroute command is used to trace the route of network packets and determine the path they take to reach a specific destination.

<पी> When working with traceroute , you can simply specify the IP address, hostname, or domain name of the endpoint.

root@ubuntu:~ traceroute <destination address>
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> Now, obviously, localhost is just one hop (the network interface itself). You can try this same command with any other domain name or IP address to see all the routers your data packets pass through to reach the destination.

<पी> Jump back to commands list ↑

The wget command in Linux

<पी> If you want to download a file from within the terminal, the wget command is one of the handiest command-line utilities available. It is one of the important Linux commands you should know when working with source files.

<पी> When you specify the link for download, it has to directly be a link to the file. If the file cannot be accessed by the wget command, it will simply download the webpage in HTML format instead of the actual file that you wanted.

<पी> Let’s try an example. The basic syntax of the wget command is :

root@ubuntu:~ wget <link to file>
<पी> Or,

root@ubuntu:~ wget -c <link to file>
<पी> The -c argument allows us to resume an interrupted download.

<पी> Jump back to commands list ↑

The ufw and iptables commands

<पी> The ufw and iptables commands are used to manage firewalls in Linux.

<पी> UFW and IPTables are firewall interfaces for the Linux Kernel’s netfilter firewall. IPTables directly passes firewall rules to Netfilter while UFW configures the rules in IPTables, which then sends those rules to Netfilter.

<पी> Why do we need UFW when we have IPTables? Because IPTables is pretty difficult for a newbie. UFW makes things extremely easy. See the below example where we are trying to allow port 80 for our webserver.

root@ubuntu:~# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
root@ubuntu:~# ufw allow 80
<पी> I’m sure you now know why UFW was created! Look at how easy the syntax becomes. Both these firewalls are very comprehensive and can allow you to create any kind of configuration required for your network. Learn at least the basics of UFW or IPTables firewall, as these are the Linux commands you must know.

<पी> Learn more about managing firewall with ufw and managing firewall with iptables .

<पी> Jump back to commands list ↑

Package Managers in Linux

<पी> Different Linux distributions use different package managers. Since we’re working on a Ubuntu server, we have the apt package manager. But for someone working on a Fedora, Red Hat, Arch, or Centos machine, the package manager will be different.

<पी> Below are the commands on how to use these package managers on different Linux distributions.

  • Debian and Debian-based distros - apt install <package name>
  • Arch and Arch-based distros - pacman -S <package name>
  • Red Hat and Red Hat-based distros - yum install <package name>
  • Fedora and CentOS - yum install <package>
<पी> Getting yourself well versed with the package manager of your distribution will make things much easier for you in the long run. So even if you have a GUI based package management tool installed, try an make use of the CLI based tool before you move on to the GUI utility. Add these to your list of Linux commands you must know.

<पी> Jump back to commands list ↑

The sudo command in Linux

<पी> “With great power, comes great responsibility” _

<पी> This is the quote displayed when a sudo-enabled user(sudoer) first uses the sudo command to escalate privileges. This command is equivalent to logging in as root (based on what permissions you have as a sudoer).

non-root-user@ubuntu:~# sudo <command you want to run>
Password: 
<पी> Just add the command sudo before any command that you need to run with escalated privileges, and that’s it. It’s very simple to use, but can also be an added security risk if a malicious user gains access to a sudoer.

<पी> Learn more about how to create a new sudo user and how to edit sudoers file.

<पी> Jump back to commands list ↑

The cal command in Linux

<पी> Have you ever wanted to view the calendar in the terminal? There apparently are people who want it to happen, and well, here it is.

<पी> The cal command displays a well-presented calendar on the terminal. Just enter the command cal on your terminal prompt.

root@ubuntu:~# cal
root@ubuntu:~# cal March 2024
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> Although we don’t need it often, it’s a great addition! It’s an amazing option for terminal fans.

<पी> Jump back to commands list ↑

The alias command

<पी> Do you have some commands that you run very frequently while using the terminal? It could be rm -r or ls -l , or it could be something longer like tar -xvzf .

<पी> This is one of the productivity-boosting Linux commands you must know.

<पी> If you know a command that you run very often, it’s time to create an alias .

<पी> What’s an alias? In simple terms, it’s another name for a command that you’ve defined.

root@ubuntu:~# alias lsl="ls -l"
OR
root@ubuntu:~# alias rmd="rm -r"
<पी> Now, every time you enter lsl or rmd in the terminal, you’ll receive the output that you’d have received if you had used the full commands.

<पी> The examples here are for really small commands that you can still type by hand every time. But in some situations where a command has too many arguments that you need to type, it’s best to create a shorthand version of the same.

<पी> Jump back to commands list ↑

The dd command in Linux

<पी> This command was created to convert and copy files from multiple file system formats. In the current day, the command is simply used to create bootable USB for Linux but there still are some things important you can do with the command.

<पी> The dd command in Linux is a versatile command used for low-level copying and conversion of data. It stands for “data-description” or “data definition,” and it can be used to copy and convert data between different file formats and storage devices.

<पी> For example, if we wanted to back up the entire hard drive as is to another drive, we would use the dd command.

root@ubuntu:~# dd if=/dev/sdb of=/dev/sda
<पी> The if and of arguments stand for input file and output file .

<पी> It’s a powerful and flexible tool, but it can also be dangerous if not used carefully. Always double-check your syntax and make sure you know what the command will do before executing it.

<पी> Jump back to commands list ↑

The whereis and whatis commands

<पी> The whereis and whatis commands are used in Linux to search for information about programs and files.

<पी> The whereis command locates the binary, source, and manual pages for a specific command or program, and the whatis command displays a short description of a command or program.

root@ubuntu:~# whereis sudo
sudo: /usr/bin/sudo /usr/lib/sudo /usr/share/man/man8/sudo.8.gz
<पी> The whatis command gives us an explanation of what a command actually is.

root@ubuntu:~# whatis sudo
sudo (8) - execute a command as another user
<पी> Jump back to commands list ↑

The top command in Linux

<पी> A few sections earlier, we talked about the ps command. You observed that the ps command will output the active processes and end itself.

<पी> The top command is like a CLI version of the task manager in Windows.

<पी> The top command in Linux is a system monitoring tool that displays real-time information about system processes and resource usage. It provides a dynamic, real-time view of system activity, including CPU usage, memory usage, and process information.

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> ध्यान दें: Here are some examples of using the top command:

  • Sort processes by memory usage:
root@ubuntu:~# top -o MEM
<पी> This will sort the process list by memory usage, with the most memory-intensive processes at the top.

  • Display detailed information about a specific process:
root@ubuntu:~# top -p PID
<पी> Replace PID with the ID of the process you want to inspect.

  • Display a summary of system resource usage:
root@ubuntu:~# top -n 1
<पी> This will display a single summary screen of system resource usage.

<पी> It’s a powerful and flexible tool for monitoring system activity and troubleshooting performance issues.

<पी> Jump back to commands list ↑

The useradd and usermod commands

<पी> The useradd and usermod commands are used in Linux to manage user accounts.

<पी> The useradd or adduser commands are the exact same commands where adduser is just a symbolic link to the useradd command. This command allows us to create a new user in Linux.

root@ubuntu:~# useradd JournalDev -d /home/JD
<पी> The above command will create a new user named JournalDev with the home directory as /home/JD .

<पी> The usermod command, on the other hand, is used to modify existing users. You can modify any value of the user including the groups, the permissions, etc.

<पी> For example, if you want to add more groups to the user, you can type in:

root@ubuntu:~# usermod JournalDev -a -G sudo, audio, mysql
<पी> Jump back to commands list ↑

The passwd command in Linux

<पी> Now that you know how to create new users, let’s also set the password for them. The passwd command lets you set the password for your own account, or if you have the permissions, set the password for other accounts.

<पी> Here are some examples of using the passwd command:

  • <पी> Change the password for the current user:

    root@ubuntu:~# passwd
    
<पी> This will prompt you to enter a new password for the current user.

  • <पी> Change the password for a specific user:

    root@ubuntu:~# passwd username
    
<पी> Replace username with the name of the user whose password you want to change.

  • <पी> Force a user to change their password at the next login:

    root@ubuntu:~# passwd -f username
    
  • <पी> Set an expiration date for a user’s password:

    root@ubuntu:~# passwd -e -n days -w warndays username
    
<पी> Replace days with the number of days before the password expires and warm days with the number of days before the password expires that the user will be warned.

<पी> These are just a few examples of using the passwd command in Linux. By understanding how to use this command effectively, you can manage user accounts and ensure that your system is secure.

<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड

<पी> Jump back to commands list ↑

Common Errors and Debugging

<पी> When working with Linux commands, you may encounter various errors and issues. Here are some common problems and how to resolve them:

1. Fixing “command not found” errors

<पी> If you receive a command not found error, it means that the command you are trying to run is not recognized by the system. This can happen for several reasons:

  1. <पी> The command is not installed on your system. You can install it using your package manager (e.g., apt , yum , dnf ).

    <पी> If you see:

    bash: xyz: command not found
    
    <पी> Use:

    which xyz
    
    <पी> If the command isn’t installed, try installing:

    apt-get install <package-name>
    
  2. <पी> The command is not in your system’s PATH. You can add the directory containing the command to your PATH.

    export PATH=$PATH:/path/to/command
    
  3. <पी> You made a typo. Double-check the command for any spelling errors.

2. Resolving permission issues with sudo

<पी> If you encounter permission issues, you can use sudo to run the command with superuser privileges. उदाहरण के लिए:

sudo command_name

3. Handling File Conflicts

<पी> File conflicts can occur when multiple users or processes attempt to modify the same file simultaneously. Here are some ways to handle file conflicts:

  1. <पी> Use Version Control Systems (VCS): Tools like Git can help manage file conflicts by allowing users to merge changes and resolve conflicts manually.

    git merge <branch_name>
    
    <पी> If there are conflicts, Git will prompt you to resolve them. Open the conflicting files, make the necessary changes, and then commit the resolved files.

    git add <resolved_file>
    git commit -m "Resolved merge conflict"
    
  2. <पी> Locking Mechanisms: Implement file locking to prevent multiple processes from writing to the same file simultaneously. Use flock in Linux to create a lock on a file.

    flock -x <file> -c "<command>"
    
  3. <पी> Atomic Operations: Use atomic operations to ensure that file writes are completed in a single step, reducing the risk of conflicts.

    mv temp_file target_file
    
    <पी> Or, Use mv with -f (force) or cp with -i (interactive):

    mv -f file1 file2
    cp -i file1 file2
    

4. Debugging Performance Bottlenecks

<पी> Performance bottlenecks can significantly impact the efficiency of your system. Here are some steps to debug and resolve them:

  1. <पी> Identify the Bottleneck: Use tools like top , htop , vmstat , and iostat to monitor system performance and identify the resource causing the bottleneck (CPU, memory, disk I/O, etc.).

    top
    
  2. <पी> Analyze Logs: Check system and application logs for any errors or warnings that might indicate performance issues.

    tail -f /var/log/syslog
    
  3. <पी> Optimize Code: Review and optimize your code to improve performance. Look for inefficient algorithms, unnecessary computations, and memory leaks.

  4. <पी> Profile Your Application: Use profiling tools like gprof , perf , or valgrind to analyze your application’s performance and identify slow functions or memory issues.

    gprof <executable> gmon.out
    
  5. <पी> Scale Resources: If the bottleneck is due to resource limitations, consider scaling up your hardware or using load balancing to distribute the load across multiple servers.

FAQs

1. What are the most used Linux commands?

<पी> The most used Linux commands include cd , ls , mkdir , rm , cp , mv , echo , cat , grep , find , man , sudo , apt-get , ssh , ping , df , du , free , top , ps , kill , killall , service , systemctl , reboot , shutdown , whoami , uname , uptime , history , and clear .

2. How do I list all available commands in Linux?

<पी> You can list all available commands in Linux by using the compgen -c command. This will display a list of all commands that are available on your system.

3. How do I find a file in Linux?

<पी> You can find a file in Linux using the find command. The basic syntax is find <path> -name "<filename>" , where <path> is the directory where you want to start searching, and <filename> is the name of the file you’re looking for. For example, find /home/user -name "example.txt" .

4. How do I kill a process in Linux?

<पी> You can kill a process in Linux using the kill command. First, you need to find the process ID (PID) of the process you want to kill using the ps or top command. Then, use the kill command followed by the PID. For example, kill 1234 , where 1234 is the PID of the process.

5. What is the difference between cp and mv ?

<पी> The cp command is used to copy files or directories, while the mv command is used to move or rename files or directories. cp creates a duplicate of the original file, leaving the original intact, whereas mv moves the file to a new location, removing it from the original location.

6. How do I check my Linux system’s memory usage?

<पी> You can check your Linux system’s memory usage using the free command. This command displays the total amount of free and used physical and swap memory in the system. For example, free -h will display the memory usage in a human-readable format.

निष्कर्ष

<पी> In this tutorial, you explored over 50 essential Linux commands covering file and directory management, process control, user permissions, networking, text processing, and shell utilities. You also worked through real-world examples, troubleshooting patterns, and comparisons between related commands.

<पी> You can now navigate the Linux filesystem, manage processes, configure permissions, and troubleshoot common issues from the command line. These commands form the foundation of effective Linux system administration and scripting.

<पी> To go deeper on specific topics, explore these tutorials:

  • The grep Command in Linux/Unix
  • The ls Command in Linux/Unix
  • Process Management in Linux
  • The ps Command in Linux
  • An Introduction to the Linux Terminal
<पी> मास्टर लिनक्स:कुशल सिस्टम प्रबंधन के लिए 50+ आवश्यक कमांड This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.


  1. स्वचालन के लिए पायथन सीखें:सीखने के संसाधन, पुस्तकालय और बुनियादी कदम स्वचालन के लिए पायथन सीखें:सीखने के संसाधन, पुस्तकालय और बुनियादी कदम

    ऑटोमेशन आईटी में एक प्रमुख प्रगति है क्योंकि यह कंप्यूटर को सामान्य कार्यों को संभालने का निर्देश देकर प्रोग्रामर के मैनुअल काम को कम करता है। स्वचालन में उपयोग किए जाने वाले कई उपकरण हैं, लेकिन कार्य के लिए सर्वोत्तम प्रोग्रामिंग भाषा का उपयोग करना महत्वपूर्ण है। पायथन स्वचालन के लिए सबसे अच्छे उ

  1. पायथन - पांडस डेटाफ्रेम के लिए एक स्कैटर प्लॉट बनाएं पायथन - पांडस डेटाफ्रेम के लिए एक स्कैटर प्लॉट बनाएं

    स्कैटर प्लॉट एक डेटा विज़ुअलाइज़ेशन तकनीक है। स्कैटर प्लॉट को प्लॉट करने के लिए प्लॉट.स्कैटर () का उपयोग करें। सबसे पहले, आइए आवश्यक पुस्तकालयों को आयात करें - हमारे पास टीम रिकॉर्ड्स के साथ हमारा डेटा है। इसे पांडा डेटाफ़्रेम में सेट करें - data = [["Australia", 2500],["Bangladesh&q

  1. Java में TableCellRenderer और TableCellEditor में क्या अंतर हैं? Java में TableCellRenderer और TableCellEditor में क्या अंतर हैं?

    टेबलसेलरेंडरर एक TableCellRenderer एक घटक बनाता है जो JTable . का मान प्रदर्शित करता है सेल. डिफ़ॉल्ट रेंडरर JLabel . का उपयोग करता है प्रत्येक टेबल सेल का मान प्रदर्शित करने के लिए। टेबल सेल रेंडरर इंटरफ़ेस को दो तरीकों से निर्दिष्ट किया जा सकता है:table.setDefaultRenderer() का उपयोग करके प्र