mjl.
← All articles

Linux Filesystem Navigation and Command-Line Help

linuxshellcommand-line

Linux administration becomes much easier when you can move through the filesystem and find the right command without memorising everything. This article covers the safest first steps on a Debian-like system.

Paths and navigation

/ is the filesystem root. A path beginning with / is absolute; a path without it is relative to the current working directory. ~ expands to the current user’s home directory.

pwd
ls -lah
cd /etc
cd ~
cd -

Useful directories include /etc for configuration, /var/log for logs, /home for user data, /usr/bin for installed programs, and /tmp for temporary files. Do not treat /tmp as permanent storage.

Finding files and commands

find /etc -type f -name '*.conf' 2>/dev/null
grep -Rni 'Listen' /etc/apache2 2>/dev/null
command -v ssh
stat /etc/hosts

Redirecting 2>/dev/null hides permission warnings for a deliberate reason. Do not use it while diagnosing a command whose errors you need to see.

Getting help

man ip
ip --help
info coreutils

In a manual page, type /pattern to search, n to find the next match, and q to quit. Use man 5 passwd for a configuration-file format and man 8 systemctl for an administrator command.

Safe habits

  • Check the current directory before using a relative path.
  • Quote paths containing spaces or shell metacharacters.
  • Prefer --help or man over copying an unverified command.
  • Read a destructive command twice before pressing Enter.

Next step

Continue with Linux Users, Groups, and Permissions before changing ownership or access rights.