RBCloud & DevOpsTHE PRACTICAL LEARNING LIBRARY
By Ravindra BagaleResources

CHAPTER 06 / 60

Filesystem, paths and essential commands

Navigate confidently and manipulate files safely inside a dedicated practice directory.

Concept + practical labBy Ravindra Bagale · ~5 min read · lab time additional

Mental model

Linux presents one directory tree rooted at /. /etc holds configuration, /var variable data and logs, /home user homes, /usr much installed software, /tmp temporary files and /proc a virtual view of kernel/process state. Absolute paths start with /; relative paths start from the current working directory. ~ expands to your home in a shell.

Guided command lab

bash
mkdir -p ~/academy/{notes,backup}
cd ~/academy
pwd
printf 'Cloud class\nLinux lab\n' > notes/day1.txt
ls -lah notes
cat notes/day1.txt
cp -i notes/day1.txt backup/
mv notes/day1.txt notes/linux.txt
stat notes/linux.txt
file notes/linux.txt
find ~/academy -type f -name '*.txt'
diff -u backup/day1.txt notes/linux.txt

mkdir -p creates missing parents; brace expansion creates two directories. > replaces content, whereas >> appends. cp -i and mv -i request confirmation before overwrites. diff exits 0 when files match and 1 when they differ; 1 is not always an execution failure.

Read and edit

Use less filename to scroll, /term to search and q to quit. In nano save with Ctrl+O and exit Ctrl+X. In vi/vim, i enters insert mode, Esc returns to normal, :wq saves/exits and :q! discards unsaved changes. Check whether the editor is installed before assuming it is present.

Links and archives

bash
ln notes/linux.txt notes/hard-link.txt
ln -s linux.txt notes/soft-link.txt
tar -czf backup/notes.tar.gz notes/
tar -tzf backup/notes.tar.gz
mkdir -p restore
tar -xzf backup/notes.tar.gz -C restore

A hard link points to the same inode and generally cannot cross filesystems; a symbolic link stores a path and can become dangling. List an unfamiliar archive before extraction and use a dedicated directory.

Delete deliberately

Use rm -i notes/soft-link.txt for the link. rm usually bypasses a desktop trash folder. Before recursive deletion, print and inspect the exact path. Do not use destructive wildcard commands as a first exercise.

Assignment and verification

Create a course directory containing three lessons; archive it, restore it and compare one file with diff. Explain why deleting a symbolic link does not delete its target, and why editing one hard-link name changes the content visible through the other.

Official reference

GNU Coreutils manual

Ravindra’s Tip

Delete करने से पहले pwd और target path देखो। Terminal में छोटी typing mistake भी गलत directory का data हटा सकती है।

Interview and revision check

Why does a symbolic link break after moving its target?

The link stores a path. If that path no longer resolves, the link is dangling even though the target data may exist elsewhere.

Ravindra Bagale · Cloud & DevOps Academy · Handbook and project downloads