Chapter 3: Linux Basic Commands
3.1 Why Linux?
Friends, most servers in the cloud run on Linux, and they have no graphical desktop – all the work happens from the terminal. That is why AWS is incomplete without learning Linux.
मित्रांनो, क्लाउडमधले बहुतेक सर्व्हर्स Linux वर चालतात, आणि त्यावर ग्राफिकल डेस्कटॉप नसतो – सगळं काम टर्मिनलमधून होतं. म्हणून Linux शिकल्याशिवाय AWS अपूर्ण आहे.
दोस्तों, क्लाउड के ज़्यादातर सर्वर्स Linux पर चलते हैं, और उन पर ग्राफ़िकल डेस्कटॉप नहीं होता – सारा काम टर्मिनल से होता है. इसलिए Linux सीखे बिना AWS अधूरा है.
More than 90% of cloud servers run Linux. It is free, stable, secure and fully controllable from the command line, which makes automation easy. On AWS, Amazon Linux, Ubuntu, RHEL/CentOS, Debian and SUSE are all available. There is usually no graphical desktop on a server — you manage it through a shell (usually bash) over SSH.
Linux file-system hierarchy
/ root of everything
├── bin, sbin essential commands (now links to /usr/bin, /usr/sbin)
├── boot kernel and boot loader
├── dev device files (/dev/nvme0n1, /dev/xvda)
├── etc configuration files (nginx, ssh, fstab, passwd)
├── home users' home folders (/home/ec2-user, /home/ubuntu)
├── root home of the root user
├── opt optional / third-party software
├── tmp temporary files (cleared on reboot)
├── usr programs, libraries, docs (/usr/share/nginx/html)
├── var variable data: logs (/var/log), web (/var/www), databases (/var/lib/mysql)
├── proc, sys virtual files with kernel & hardware info
└── mnt, media mount points for extra disks
On the Mauli Dairy server these folders will be used like this: the website files in /usr/share/nginx/html or /var/www/html, the Nginx config in /etc/nginx, and the logs in /var/log. Once this map is in your head, you will immediately know where to look for any file.
Mauli Dairy च्या सर्व्हरवर हे फोल्डर्स असे वापरले जातील: वेबसाइटच्या फाइल्स /usr/share/nginx/html किंवा /var/www/html मध्ये, Nginx चा कॉन्फिग /etc/nginx मध्ये, आणि लॉग्स /var/log मध्ये. एकदा हा मॅप डोक्यात बसला की कुठली फाइल कुठे शोधायची ते लगेच कळेल.
Mauli Dairy के सर्वर पर ये फ़ोल्डर्स ऐसे इस्तेमाल होंगे: वेबसाइट की फ़ाइलें /usr/share/nginx/html या /var/www/html में, Nginx का कॉन्फ़िग /etc/nginx में, और लॉग्स /var/log में. एक बार ये मैप दिमाग में बैठ गया तो कौन सी फ़ाइल कहाँ ढूँढनी है, तुरंत पता चलेगा.
Everything is a file
In Linux, disks (/dev/nvme1n1), processes (/proc/1234) and even hardware info are represented as files. Paths are case-sensitive: Index.html and index.html are different files.
Ravindra Bagale's Tip
Many students type cd /Home or Index.html and get stuck with "file not found". Paths in Linux are case-sensitive – Index.html and index.html are two different files. Use the Tab key, and the spelling and case will come out right automatically.
Ravindra Bagale's Tip – मराठी
बरेच students cd /Home किंवा Index.html type करतात आणि "file सापडत नाही" म्हणून अडकतात. Linux मध्ये paths case-sensitive आहेत – Index.html आणि index.html दोन वेगवेगळ्या files. Tab key वापरा, म्हणजे spelling आणि case आपोआप बरोबर येईल.
Ravindra Bagale's Tip – हिंदी
बहुत से students cd /Home या Index.html type करते हैं और "file नहीं मिल रही" पर अटक जाते हैं. Linux में paths case-sensitive हैं – Index.html और index.html दो अलग files हैं. Tab key इस्तेमाल करो, तो spelling और case अपने आप सही आएगा.
Lab
Chala, EC2 var login karun cat /etc/os-release chalva, mag ls / aani ls /etc bagha. Varchya tree madhle pratyek folder samor ek line liha – udaharan mhanje /var/log madhe logs, /etc madhe config files.