// Linux Basics

Files, folders and paths

Absolute paths, relative paths, hidden files and sensible file handling.

Everything in Unix sits in one directory tree starting at /. Your home folder is usually /home/yourname, and ~ is a shortcut to it.

Absolute versus relative paths

cd /etc
pwd
cd ~/Documents
ls ../

/etc is an absolute path because it starts at the root /. ../ is relative to where you are standing.

Important directories

Path What lives there
/home Ordinary users' home directories
/etc System-wide configuration files
/usr/bin Many installed programs
/var/log System and service logs
/tmp Temporary files; do not trust them for storage
/mnt and /media Common mount points for disks

Practice with harmless files

mkdir -p ~/darkpc-lab/notes
printf 'first note\n' > ~/darkpc-lab/notes/one.txt
cp ~/darkpc-lab/notes/one.txt ~/darkpc-lab/notes/two.txt
mv ~/darkpc-lab/notes/two.txt ~/darkpc-lab/notes/renamed.txt
find ~/darkpc-lab -type f

Use cp to copy, mv to move or rename, and find to discover files.

Know before you delete

rm normally sends a file to no recycle bin. Check your directory with pwd and ls before deleting. Avoid copying random sudo rm -rf commands from the web.

ls -lah ~/darkpc-lab/notes

You can keep the practice folder as your personal sandbox.