Week 2: Deep Linux CLI Marathon — from Vim to Disk Management

Shaurya DhingraShaurya Dhingra
6 min read

Cloud & DevOps Journey — Blog 2


What actually went down this week

I went hard on Linux fundamentals. No 30-second demos:
I opened shells, ran commands until something failed, read the manpages, then broke things more deliberately to learn how to fix them.

By the end of this stretch I had:

  • Finished 05 → 13 in my Linux-CLI track (Vim → Disk Management)

  • Built cheatsheets and README notes for each topic

  • Practiced on an AWS EC2 (free tier) Ubuntu instance — partitioned an attached EBS disk, made filesystems, used LVM, and added a swapfile

  • Set up and tested systemd unit files for a tiny Python app and practiced systemctl workflows


Why I had to start here (and why it sucked at first)

Linux is the base layer for everything I’m trying to learn in cloud and DevOps.
If you can’t move around the filesystem, understand processes, manage services, and handle disks, every higher-level tutorial becomes useless.

Also: the terminal is unforgiving. One careless rm -rf or wrong mkfs and you’ll learn to be careful. That’s a good motivator.


The topics I finished (short notes + useful commands)

I’m keeping these as compact practical notes — the commands are the things I actually typed and screenshot. Full cheatsheets are linked in the resources section.

05 — Vim editing

What I practiced:

  • Modes (normal, insert, visual), movement, search/replace, saving/quitting

Useful commands:

i           # insert
<Esc>       # return to normal mode
:wq         # save and quit
:%s/old/new/g

Why it matters: Editing config files in-place is 90% of sysadmin work.


06 — Shell basics

Key ideas: redirection, pipes, environment variables, history, aliases, globbing

Commands I used:

echo "hello" > file.txt       # stdout to file
command1 | command2           # pipe
VAR=value                    # env var
alias ll='ls -la'            # quick alias
history | grep ssh

Screenshots: examples of redirection, env, .bashrc alias additions.


07 — Searching & Text Processing

Tools I practiced: grep, sed, awk, cut, sort, uniq, wc, tail

Examples:

grep -R "ERROR" /var/log
awk '{print $1,$3}' file.txt
tail -f /var/log/syslog
du -ah . | sort -rh | head -20

Why: Parsing logs and extracting the right field is the difference between debugging and guessing.


08 — File & Directory Operations

Core ops: cp, mv, rm, ln, tar, zip, unzip, stat, file

Examples:

cp -r src dest
ln -s /path/to/file linkname
tar -czvf backup.tar.gz /my/dir
du -sh /var/www

Tip: Always check disk usage (df -h) before nuking anything.


09 — Permissions & Ownership

Practiced: chmod, chown, umask, SUID/SGID, sticky bit

Examples:

chmod 755 script.sh
chown ubuntu:ubuntu /home/ubuntu/app
chmod +s /usr/bin/someprog   # SUID (careful)

Lesson: Permissions are cheap; mistakes are costly. Test on a sample file first.


10 — User Management

Commands:

sudo adduser bob
sudo usermod -aG sudo bob
sudo passwd -l baduser   # lock
chage -l username        # password expiry info

I explored /etc/passwd, /etc/shadow, and /etc/skel for default user templates.


11 — Process Management

What I learned: foreground/background, job control, signals, nice, renice, system processes vs daemons

Useful commands:

ps aux | grep process
top / htop
jobs | bg | fg
kill -15 <PID>   # graceful
kill -9 <PID>    # force
nice -n 10 command

Bonus: Used strace, lsof, and pmap to inspect what processes were doing.


12 — Service Management (systemd / systemctl)

I wrote a simple systemd unit for a Python app and practiced:

sudo systemctl daemon-reload
sudo systemctl start myapp
sudo systemctl status myapp
sudo systemctl enable myapp
sudo journalctl -u myapp -f

Notes: systemctl mask is a blunt instrument — useful to prevent services from starting, but don’t forget how to unmask.


13 — System Info, Disk Management & Hardware (did this on EC2)

This is where I broke and rebuilt disks (safely on EBS), learned to LVM, and added swap.

Core commands:

# system info
uname -a
hostnamectl
lscpu
free -h

# disks
lsblk
sudo fdisk /dev/xvdf    # create partitions
sudo mkfs.ext4 /dev/xvdf1
sudo mkdir -p /mnt/newdisk
sudo mount /dev/xvdf1 /mnt/newdisk
sudo blkid               # get UUID -> add to /etc/fstab

# LVM
sudo pvcreate /dev/xvdf
sudo vgcreate vg1 /dev/xvdf
sudo lvcreate -L 1G -n lv1 vg1
sudo mkfs.ext4 /dev/vg1/lv1
sudo mount /dev/vg1/lv1 /mnt/lv1

# swap (file)
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Screenshots I captured: lsblk, df -h, fdisk steps, LVM lsblk view, and swapon --show.


The things that broke (and how I fixed them)

  • Tried to run shell commands inside fdisk interactive prompt → fdisk interpreted them as garbage and created weird tiny partitions.
    Fix: wipefs -a /dev/xvdf → fdisk, then g (new GPT) → nw. Then format from shell, not inside fdisk.

  • Device “busy” when running mkfs → kernel had stale state.
    Fix: sudo partprobe /dev/xvdf or reboot the instance. If processes hold it: lsof /dev/xvdf2 → kill offending process.

  • Permission errors with SSH / Git → wrong key permissions.
    Fix: chmod 400 my-key.pem, re-add key to ssh-agent if needed.


What I learned the hard way

  • Always check lsblk and df -h before formatting or deleting — your root disk is not a toy.

  • LVM gives flex, but do it on a throwaway volume first (loopback or separate EBS).

  • Swap files are safe and flexible on EC2 — partitions are less convenient for cloud volumes.

  • Cheatsheets and short README notes save hours later. Make them as you go.


Resources I actually used (and the cheatsheets I made)

My own cheatsheets (public):
01–13 cheatsheets & READMEs (cheatsheets live in my repo):
https://github.com/shauryad01/cloud-devops-journey/tree/main/linux-cli#-cheatsheets

GitHub repos where I dumped my notes & messy demos
Main journey log: shauryad01/cloud-devops-journey (check the linux-cli/ folder)
Cheat + demo files for each topic are in their respective subfolders.


What’s next (Week 3 plan)

  • Finish 14 — Networking Basics (IP, routes, DNS, ss, traceroute)

  • Complete 15 — SSH & Remote Management

  • 16 — Logs & Monitoring

  • 17 — Security

  • 18 — Troubleshooting

  • Build a Bash + cron mini-project (backup + rotate logs or a simple deployment script) and tie it into an EC2 workflow.

  • Start AWS basics (IAM, S3, EC2 networking) in parallel so I can map Linux networking to VPCs, security groups, and IAM roles.


Follow along

I’ll post my Week 3 update when I wrap up networking + automation.

0
Subscribe to my newsletter

Read articles from Shaurya Dhingra directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shaurya Dhingra
Shaurya Dhingra

DevOps & Cloud learner, currently in the deep end with Linux, Git, and AWS. BTech CSE student breaking things on purpose (and learning how to fix them). Exploring real infrastructure, automation, and the tools that keep modern systems running.