Week 1 – Linux + Networking Foundations (Cloud Base)

 


🚀 Week 1 – Linux + Networking Foundations (Cloud Base)


🐧 Linux Section


✅ File System Commands

pwd # show current directory path ls # list files ls -l # long listing (permissions, owner, size) ls -a # show hidden files ls -lh # human readable sizes ls -lrt # latest modified files at bottom cd /var/log # move to log directory cd .. # go back one directory mkdir test # create directory mkdir -p a/b/c # create nested directories cp file1 file2 # copy file cp -r dir1 dir2 # copy directory recursively mv file newfile # rename file mv file /tmp # move file rm file # delete file rm -r dir # delete directory rm -rf dir # force delete (careful ⚠️) find / -name nginx # search file by name du -sh * # check size of each file/folder tree # show directory structure

✅ Permissions & Ownership

ls -l # view permissions chmod 755 file # rwxr-xr-x chmod +x script.sh # add execute permission chown user file # change owner chown user:group file # change owner + group chgrp dev file # change group only umask # show default permission mask

Special bits

chmod 4755 file # SUID chmod 2755 dir # SGID chmod 1777 /shared # sticky bit (like /tmp)

✅ Process Management

ps # current shell processes ps aux # all processes detailed top # live CPU/memory monitor htop # better UI monitor kill 1234 # stop process using PID kill -9 1234 # force kill pkill nginx # kill by name bg # run job in background fg # bring job to foreground jobs # list background jobs nice -n 10 app # lower CPU priority uptime # server running time + load

✅ Services (systemctl)

systemctl start nginx # start service systemctl stop nginx # stop service systemctl restart nginx # restart service systemctl reload nginx # reload config only systemctl status nginx # check service status systemctl enable nginx # start at boot systemctl disable nginx # disable at boot journalctl -xe # view system logs journalctl -u nginx # logs of specific service

✅ Logs (Debugging hero tools)

cd /var/log # go to logs directory tail file.log # last 10 lines tail -f file.log # live log streaming less file.log # scroll log safely grep ERROR file.log # search only ERROR lines grep -i fail file.log # case-insensitive search awk '{print $1}' file.log # print first column cut -d" " -f1 file.log # split and extract column

✅ Disk & Storage

df -h # disk usage summary du -sh * # folder size du -ah | sort -rh # biggest files first lsblk # show disks mount # show mounted volumes mount /dev/sdb1 /mnt # mount disk umount /mnt # unmount disk

✅ Memory & System Info

free -m # memory usage top # CPU/memory usage vmstat # performance stats cat /proc/meminfo # detailed memory info

✅ Package Manager

Ubuntu/Debian

apt update # refresh repo list apt upgrade # upgrade packages apt install nginx # install package apt remove nginx # uninstall apt search docker # search package

RHEL/CentOS

yum install nginx # install yum remove nginx # remove yum update # update packages

✅ Bash Scripting Basics

#!/bin/bash # shebang name="ghouse" # variable echo $name # print variable if [ $name == "ghouse" ]; then # condition echo "Hello" fi for i in {1..5}; do # loop echo $i done

Run:

chmod +x script.sh # make executable ./script.sh # run script


🌐 Networking Section


✅ IP & Interface

ip a # show IP address ip route # show routes ifconfig # old command alternative hostname -I # show local IP

✅ DNS

nslookup google.com # check DNS resolution dig google.com # detailed DNS info cat /etc/resolv.conf # DNS server config

✅ Connectivity

ping google.com # test connectivity traceroute google.com # show path packets take mtr google.com # live traceroute (if installed)

✅ Ports & Services

netstat -tulnp # show open ports + process ss -lntp # modern netstat alternative lsof -i :8080 # which app using port 8080

✅ HTTP Testing

curl google.com # fetch webpage curl -I google.com # headers only curl -v google.com # verbose debug wget file.zip # download file

✅ SSH

ssh user@ip # connect server ssh -i key.pem user@ip # connect using key scp file user@ip:/tmp # copy file to server scp user@ip:/tmp/file . # copy from server

✅ Advanced Debug (Powerful)

telnet ip 80 # test port manually nc -zv ip 80 # port open check tcpdump -i eth0 # capture packets

🧠 MUST-KNOW THEORY

Memorize:

OSI Model

Application Presentation Session Transport Network Data Link Physical

Important Ports

22 SSH 80 HTTP 443 HTTPS 3306 MySQL 5432 PostgreSQL 6379 Redis

🎯 Week 1 Final Practice (Real DevOps Tasks)

Do these WITHOUT Google:

✅ Install nginx
✅ Host webpage
✅ Check logs
✅ Kill high CPU process
✅ Fix permission denied
✅ Find which app using port
✅ Fix DNS issue
✅ Disk full cleanup
✅ Write auto-restart script

Comments

Popular posts from this blog

Managing Amazon EBS Volumes and Snapshots Across Regions

Git for Beginners: Complete Guide from Installation to First Push on GitHub

AWS - Amazon Web Services