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…
- 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.
- Use
sudo
wisely: Always verify which user you’re logged in as and whether they havesudo
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
andchgrp
correctly: I reinforced how to transfer ownership and group access of files/directories cleanly.
- Wrong
sed
syntax: Initially messed up a simple replace command by using/s/DevOps/devops/g
instead ofs/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>
beforeuserdel -r
. - Mounting EBS but not formatting it: I forgot to create a filesystem with
mkfs
before mounting. Alwaysmkfs.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.
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?
🟢 Solution
sudo -i
🟢 Solution
useradd user1
useradd user2
useradd user3
passwd user1
passwd user2
passwd user3
cat /etc/passwd | grep user
.🟢 Solution
groupadd devops
groupadd aws
📝 Note: You can verify the groups were created successfully by running
getent group | grep -E ‘devops|aws’
.
🟢 Solution
usermod -g devops user2
usermod -g devops user3
📝 Note: to verify
id user2 && id user3
🟢 Solution
usermod -aG aws user1
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.
🟢 Solution
mkdir -p /dir1 /dir7/dir10
touch /f2
🟢 Solution
chgrp devops /dir1 /dir7/dir10 /f2
ls -l /dir1 /dir7/dir10 /f2
Look at the group name in the output.🟢 Solution
chown user1:user1 /dir1 /dir7/dir10 /f2
🟢 Solution
su - user1
sudo useradd user4
sudo useradd user5
sudo passwd user4
sudo passwd user5
🟢 Solution
sudo groupadd app
sudo groupadd database
🟢 Solution
su - user4
mkdir -p /dir6/dir4
touch /f3
🟢 Solution
mv /dir1/f1 /dir2/dir1/dir2/
🟢 Solution
mv /f2 /f4
🟢 Solution
su - user1
mkdir -p /home/user2/dir1
🟢 Solution
cd /dir2/dir1/dir2/dir10
touch ../../../../opt/dir14/dir10/f1
🟢 Solution
mv /opt/dir14/dir10/f1 /home/user1/
🟢 Solution
rm -rf /dir4
🟢 Solution
rm -rf /opt/dir14/*
or
find /opt/dir14 -mindepth 1 -delete
🟢 Solution
echo "Linux assessment for a DevOps Engineer!! Learn with Fun!!" > /f3
🟢 Solution
su - user2
touch /dir1/f2
🟢 Solution
rm -rf /dir6 /dir8
🟢 Solution
sed -i 's/DevOps/devops/g' /f3
🟢 Solution
vi /f3
# Inside vi:
# Copy line 1:
yy
# Paste line 1 below it 9 more times:
p
🟢 Solution
sed -i 's/Engineer/engineer/g' /f3
🟢 Solution
rm -f /f3
🟢 Solution
find / -name f3 2>/dev/null
🟢 Solution
find / -type f 2>/dev/null | wc -l
🟢 Solution
tail -n 1 /etc/passwd
🟢 Solution
mkfs.ext4 /dev/xvdf
mkdir /data
mount /dev/xvdf /data
df -h
🟢 Solution
touch /data/f1
🟢 Solution
su - user5
rm -rf /dir1 /dir2 /dir3 /dir5 /dir7 /f1 /f4 /opt/dir14
🟢 Solution
userdel -r user1
userdel -r user2
userdel -r user3
userdel -r user4
userdel -r user5
groupdel app
groupdel aws
groupdel database
groupdel devops
🟢 Solution
rm -rf /home/user1 /home/user2 /home/user3 /home/user4 /home/user5
umount /data
rm -rf /data