Linux keeps your files in a tree starting at /. Knowing the layout and a handful of commands helps you navigate, inspect, and manage files confidently.
File system basics
- /: Root of the file system.
- /home: User directories.
- /bin, /usr/bin: User binaries.
- /sbin, /usr/sbin: System binaries.
- /etc: System config.
- /var: Variable data (logs, spool).
- /tmp: Temporary files.
- /dev: Devices.
- /proc, /sys: Virtual FS for kernel/process info.
Core navigation & file commands
- pwd: Print working directory.
pwd - ls: List directory contents.
ls -l(long) ·ls -a(all) ·ls -lh(human-readable) - cd: Change directory.
cd /path·cd ..(up) ·cd ~(home) - mkdir: Make directory.
mkdir newdir·mkdir -p parent/child - rmdir: Remove empty directory.
rmdir emptydir
Create, view, copy, move
- touch: Create empty file or update timestamp.
touch file.txt - cat: View/concatenate files.
cat file.txt - echo: Print text or write to file.
echo "hello" > file.txt(overwrite) ·echo "more" >> file.txt(append) - cp: Copy files/dirs.
cp source dest·cp -r dir1 dir2(recursive) ·cp -i(prompt) - mv: Move/rename.
mv old new·mv file /path/
Inspecting content
- wc: Count lines/words/chars.
wc -l file.txt - history: Show command history.
history· reuse with!123
Tips
- Use tab completion for paths and commands.
- Quote paths with spaces.
- Use absolute paths for scripts; relative paths for quick navigation.
- Keep
.bash_historyuseful: descriptive commands, comments with#when needed.
With these basics—layout, navigation, and core file commands—you can move around any Linux system, inspect files, and keep a clean workflow in the terminal.