RH124 Ch 3: Managing Files and Links
Linux has one directory tree starting at /. Key places: /etc configuration, /home users' files, /root root's home, /var changing data such as logs, /tmp temporary files, /usr installed software, /dev devices.
Paths: absolute paths start with /; relative paths start from the current directory (pwd). . is here, .. is the parent, cd - goes back.
Core commands - mkdir -p a/b/c — create nested directories. - cp file dest/, cp -r dir dest/, cp -p keeps owner/mode/time. - mv old new — rename or move. - rm file, rm -r dir, rmdir emptydir. There is no undo, so run ls with the same glob first. - touch file — create an empty file or update its time.
Links - A hard link (ln target link) is a second name for the same inode. Both names are equal; the data stays until the last name is removed. Hard links cannot cross file systems or point to directories. - A symbolic link (ln -s target link) is a small file that holds a path. It can point to directories and other file systems, but breaks if the target moves. - ls -li shows inode numbers (same number = hard link) and - for symlinks.
Exam tips - ln -s takes the target first, the link name second — the same order as cp. - Create files as the user who should own them, or fix ownership afterwards with chown. - Globs like .pdf are case-sensitive: .PDF is a different set.