
Absolute vs Relative Paths
<p>Paths are used to locate files and directories in Linux.</p> <p><strong>1. Absolute Path</strong></p> <p>An absolute path starts from the root directory:</p> <p>/</p> <p>It shows the complete location of a file or folder.</p
Aryan Vaishnani Posted on May 25 Absolute vs Relative Paths # linux # ubuntu Linux Administrator (22 Part Series) 1 History of Linux & Unix 2 Linux Distributions ... 18 more parts... 3 Open Source Philosophy 4 Linux Kernel vs User Space 5 Virtualization & Cloud Basics 6 Installing Linux (VM & Bare Metal) 7 Basic Boot Process 8 Getting Help (man pages, info, --help) 9 Shell Basics (Bash, Zsh, Sh) 10 Navigation (cd, pwd, ls) 11 File Management (touch, mkdir, cp, mv, rm, ln) 12 Viewing Files (cat, less, more, head, tail) 13 Text Editors (vi/vim, nano) 14 Command History & Completion 15 Wildcards & Globbing 16 Basic Input/Output Redirection 17 Linux Directory Structure (/bin, /etc, /var, /home, /usr, /tmp) 18 File Types (Regular, Directory, Link, Device, Socket, Pipe) 19 Absolute vs Relative Paths 20 Hidden Files & Directories in Linux 21 Mount Points in Linux 22 USB & External Media Handling Paths are used to locate files and directories in Linux. 1. Absolute Path An absolute path starts from the root directory: / It shows the complete location of a file or folder. Example /home/aryan/projects/app.py This path works from anywhere in the system. 2. Relative Path A relative path starts from the current directory. It does NOT start with /. Example Current directory: /home/aryan Command: cd projects Linux understands: /home/aryan/projects Special Symbols Symbol Meaning . Current directory .. Parent directory ~ Home directory Examples Current Directory ./script.sh Parent Directory cd .. Home Directory cd ~ Difference Table Absolute Path Relative Path Starts with / Does not start with / Full location Based on current location Works everywhere Depends on current directory Longer Shorter Real-World Example Current directory: /var/log Relative Path cd nginx Absolute Path cd /var/log/nginx Both go to same directory. Easy Trick Absolute Path = Full address Relative Path = Nearby shortcut Linux Administrator (22 Part Series) 1 History of Linux & Uni
📰Originally published at dev.to
Staff Writer