Fun with Linux for Cloud & DevOps Engineers

While working on Linux, I realized how much there is to explore — managing users, understanding file systems, and dealing with permissions gave me a new appreciation for the system’s depth.

During this journey, I came across an intriguing project titled “Fun with Linux for Cloud & DevOps Engineers,” which perfectly aligned with my interest in expanding my Linux knowledge…

🧠 What I Learned

  • Linux Fundamentals: User creation, group management, permissions, file/directory operations, and working with bash commands confidently.
  • EC2 & EBS (AWS): How to launch an EC2 instance, create and attach an EBS volume, format it, mount it, and manage file systems on it.
  • Filesystem Navigation: Creating deep directory structures and performing tasks using both absolute and relative paths.
  • Practical Scripting: Performing operations using commands like sed, find, df -h, mount, umount, and more — all without needing a GUI.
  • System Clean-Up: Learning how to properly delete users, groups, and clean up home directories and mount points.

✅ Best Practices That Helped Me

  • Use sudo wisely: Always verify which user you’re logged in as and whether they have sudo privileges (id, groups are your friends).
  • Check mounts with lsblk & df -h: These commands helped me understand disk usage and confirmed whether my EBS volume was mounted properly.
  • Use chown and chgrp correctly: I reinforced how to transfer ownership and group access of files/directories cleanly.

❌ Mistakes I Made (And How I Fixed Them)

  • Wrong sed syntax: Initially messed up a simple replace command by using /s/DevOps/devops/g instead of s/DevOps/devops/g. The leading / isn’t needed.
  • Trying to delete users while sessions were active: I couldn’t delete users until I killed their running processes. Use pkill -u <username> before userdel -r.
  • Mounting EBS but not formatting it: I forgot to create a filesystem with mkfs before mounting. Always mkfs.ext4 /dev/xvdf (or your device name) first.
  • Assuming attached EBS is automatically mounted: It isn’t! You have to mount it manually and ensure it persists by adding it to /etc/fstab (if needed).
  • Forgetting AWS AZ matching: You must create EBS volumes in the same Availability Zone as your EC2 instance, or you won’t be able to attach it.

🎮 Turning It Into a Game

Your mission, should you choose to accept it, is to complete this real-world DevOps challenge step-by-step. Don’t worry—answers and hints are hidden like a side quest. Reveal them only when you need help. Ready?

1. Login to the server as a super user

🟢 Solution
sudo -i

2. Create users and set passwords: user1, user2, user3

🟢 Solution
useradd user1
useradd user2
useradd user3

passwd user1
passwd user2
passwd user3
📝 Note: You can verify the users were added successfully by running cat /etc/passwd | grep user.

3. Create groups: devops, aws

🟢 Solution
groupadd devops
groupadd aws

📝 Note: You can verify the groups were created successfully by running getent group | grep -E ‘devops|aws’.

4. Change primary group of user2, user3 to ‘devops’

🟢 Solution
usermod -g devops user2
usermod -g devops user3

📝 Note: to verify id user2 && id user3

5. Add ‘aws’ group as a secondary group to user1

🟢 Solution
usermod -aG aws user1
📝 Note: The -aG option stands for append (-a) and groups (-G). It appends the user to the new group without removing them from existing groups.

If you omit -a, the user will be removed from all other secondary groups and only be part of the aws group — which is usually not what you want.

6. Create the file and directory structure

🟢 Solution
mkdir -p /dir1 /dir7/dir10
touch /f2

7. Change group of /dir1, /dir7/dir10, /f2 to ‘devops’

🟢 Solution
chgrp devops /dir1 /dir7/dir10 /f2
📝 Note: Confirm the group has changed using: ls -l /dir1 /dir7/dir10 /f2 Look at the group name in the output.

8. Change ownership of /dir1, /dir7/dir10, /f2 to ‘user1’

🟢 Solution
chown user1:user1 /dir1 /dir7/dir10 /f2

9. Login as user1 and create users and set passwords – user4, user5

🟢 Solution
su - user1
sudo useradd user4
sudo useradd user5

sudo passwd user4
sudo passwd user5

10. Create Groups – app, database

🟢 Solution
sudo groupadd app
sudo groupadd database

11. Login as user4 and create /dir6/dir4 and file /f3

🟢 Solution
su - user4
mkdir -p /dir6/dir4
touch /f3

12. Move file /dir1/f1 to /dir2/dir1/dir2

🟢 Solution
mv /dir1/f1 /dir2/dir1/dir2/

13. Rename file /f2 to /f4

🟢 Solution
mv /f2 /f4

14. Login as user1 and create /home/user2/dir1

🟢 Solution
su - user1
mkdir -p /home/user2/dir1

15. Change to /dir2/dir1/dir2/dir10 and create file /opt/dir14/dir10/f1 using relative path

🟢 Solution
cd /dir2/dir1/dir2/dir10
touch ../../../../opt/dir14/dir10/f1

16. Move file from /opt/dir14/dir10/f1 to user1’s home directory

🟢 Solution
mv /opt/dir14/dir10/f1 /home/user1/

17. Delete directory recursively /dir4

🟢 Solution
rm -rf /dir4

18. Delete all child files and directories under /opt/dir14 using a single command

🟢 Solution
rm -rf /opt/dir14/*

or

find /opt/dir14 -mindepth 1 -delete
📝 Note: -mindepth 1 avoids deleting the parent /opt/dir14, but deletes everything else inside.

19. Write text to /f3 file

🟢 Solution
echo "Linux assessment for a DevOps Engineer!! Learn with Fun!!" > /f3

20. Login as user2 and create file /dir1/f2

🟢 Solution
su - user2
touch /dir1/f2

21. Delete /dir6 and /dir8

🟢 Solution
rm -rf /dir6 /dir8

22. Replace “DevOps” with “devops” in /f3 without using editor

🟢 Solution
sed -i 's/DevOps/devops/g' /f3

23. Copy line1 and paste 10 times in /f3 using vi editor

🟢 Solution
vi /f3
# Inside vi:

# Copy line 1:
yy

# Paste line 1 below it 9 more times:
p

24. Search for “Engineer” and replace with “engineer” in /f3 using a single command

🟢 Solution
sed -i 's/Engineer/engineer/g' /f3

25. Delete /f3

🟢 Solution
rm -f /f3

26. Search for file named ‘f3’ and list all absolute paths

🟢 Solution
find / -name f3 2>/dev/null

27. Show count of files in ‘/’ directory

🟢 Solution
find / -type f 2>/dev/null | wc -l

28. Print last line of ‘/etc/passwd’

🟢 Solution
tail -n 1 /etc/passwd

29. Create and attach 5GB EBS volume in same AZ via AWS Console or CLI

(AWS Console action – attach volume to EC2 instance)

30. Create file system and mount on /data

🟢 Solution
mkfs.ext4 /dev/xvdf
mkdir /data
mount /dev/xvdf /data
df -h

31. Create file ‘f1’ in /data

🟢 Solution
touch /data/f1

32. Login as user5 and delete files and directories

🟢 Solution
su - user5
rm -rf /dir1 /dir2 /dir3 /dir5 /dir7 /f1 /f4 /opt/dir14

33. Login as root and delete all users and groups

🟢 Solution
userdel -r user1
userdel -r user2
userdel -r user3
userdel -r user4
userdel -r user5

groupdel app
groupdel aws
groupdel database
groupdel devops

34. Delete home directories and unmount /data

🟢 Solution
rm -rf /home/user1 /home/user2 /home/user3 /home/user4 /home/user5
umount /data
rm -rf /data

35. Detach and delete EBS volume from AWS and terminate EC2 instance

🏁 Final Thoughts

This project wasn’t just about typing commands — it was about understanding why things work the way they do in Linux and AWS. Every mistake led to better clarity, and every small success boosted my confidence. If you’re someone who prefers doing over reading, try this out. It’s not only a resume-booster but also a great way to document your journey publicly.