Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Doug:
No need to be 'sorry', at least you're 1 up on some other folks who don't know that they don't know.
A relative path is more relational to the directory you are "in", for example:
if you are in /home/doug (your $HOME directory) a relative path to Documents could be ~/Documents, or $HOME/Documents.
Both of those are relative paths, they "relate" to your /home/doug directory.
A relative path would be like telling somebody "turn left on Spruce street, right on Walnut Ln, and stop at the 3rd house on your left", while an absolute path would be to tell somebody "go to 1234 Walnut Ln".
Absolute paths can be run from anywhere in the system, they point to a definite place. /home/user is always going to be /home/user no matter where you run that command from.
Relative paths are movements relative to your current location. ../dir1 means "go up one directory, and then into dir1". If your terminal is sitting in /home/user/docs, "../dir1" is going to point to a very different location than if you're sitting in /usr/local/include (the former would point to /home/user/dir1, the latter to /usr/local/dir1).
A relative path is more relational to the directory you are "in"
Yes.
Quote:
for example:
if you are in /home/doug (your $HOME directory) a relative path to Documents could be ~/Documents, or $HOME/Documents.
Both of those are relative paths, they "relate" to your /home/doug directory.
Wrong!
~/Documents or $HOME/Documents are still absolute paths.
A relative path would be like telling somebody "turn left on Spruce street, right on Walnut Ln, and stop at the 3rd house on your left", while an absolute path would be to tell somebody "go to 1234 Walnut Ln".
Misleading analogy.
Your relative path example is great, but for absolute path:
"START out going north on Elm St in Springfield, Iowa (USA) and THEN turn left on Spruce street, right on Walnut Ln, and stop at the 3rd house on your left".
The real difference between absolute and relative is that absolute tells you where to START (but may then give relative directions) while relative assumes the person giving the directions and the person getting the directions both already know the starting point.
BTW, I've never been to Iowa so there is chance the directions I just gave you are wrong.
The real difference between absolute and relative is that absolute tells you where to START (but may then give relative directions) while relative assumes the person giving the directions and the person getting the directions both already know the starting point.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.