LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 12-15-2010, 08:03 PM   #1
Juve IT
LQ Newbie
 
Registered: Dec 2010
Posts: 1

Rep: Reputation: 0
Full Path Name


What is a full path name?
 
Old 12-15-2010, 08:19 PM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
As opposed to the relative path name, from the current directory, the full path name is the path from /.
 
1 members found this post helpful.
Old 12-15-2010, 08:23 PM   #3
coexistance
Member
 
Registered: Dec 2010
Location: Earth planet
Distribution: Debian GNU/Linux 6 (Squeeze) - AMD64
Posts: 50

Rep: Reputation: 9
Hello Juve_It!

A full path name is the complete(absolute) location of some file or link.

Example of :
Code:
#!/bin/sh/
less /home/some_user/docs/work/todo.txt
less ~/docs/work/todo.txt
See the "/home/some_user/docs/work/todo.txt" thing?
That's a full path on Linux shell.

See the "~/docs/work/todo.txt" thing?
That's a relative path that does exactly the same as the full path but is easier to type and is dependent of your working directory.

On linux a path usually starts with a slash character '/'.

cheers!

Last edited by coexistance; 12-15-2010 at 08:24 PM. Reason: small error
 
1 members found this post helpful.
Old 12-15-2010, 08:34 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,565

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
Quote:
Originally Posted by coexistance
See the "~/docs/work/todo.txt" thing?
That's a relative path that does exactly the same as the full path but is easier to type and is dependent of your working directory.
Actually that is an aliased path (ie. ~ is an alias for your home directory)

A relative path would be something like:
Code:
rel_path="docs/work/todo.txt"

less $rel_path
Depending on where you execute the script, this will look in the current directory for a directory called 'docs'.

The difference with the above is:
Code:
rel_path="~/docs/work/todo.txt"

less $rel_path
Irrelevant of where you are this will still look in your home path for 'docs' directory.
The real gotcha here is that if someone else executes the script it will look in their home directory

Whereas a full (or absolute) path would be:
Code:
abs_path="/home/some_user/docs/work/todo.txt"

less $rel_path
This will work no matter who calls it or where it is called from (assuming of course you have the permissions to the directory and file)
 
1 members found this post helpful.
Old 12-16-2010, 02:18 AM   #5
coexistance
Member
 
Registered: Dec 2010
Location: Earth planet
Distribution: Debian GNU/Linux 6 (Squeeze) - AMD64
Posts: 50

Rep: Reputation: 9
Ah! A relative path is made with variables!
thanks for pointing it out grail.

And sorry for the original poster.
cheers!
 
1 members found this post helpful.
Old 12-16-2010, 09:14 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Actually, the '~' thing is only for someone's home dir (that's a fixed convention, not a variable). A relative path in general means not starting at root ie '/', so for eaxmple

../../some/dir

is a relative path; in this case, go up 2 dirs, then down into some/dir.
 
1 members found this post helpful.
Old 12-16-2010, 09:22 PM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,899
Blog Entries: 27

Rep: Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186
Hi,

Welcome to LQ!

Quote:
Originally Posted by Juve IT View Post
What is a full path name?
Rute Tutorial & Exposition is a good tutorial and you will learn a lot.

Just a few more links to aid you to gaining some understanding. Sure some may seem beyond a newbie but you must start somewhere;



Linux Documentation Project
Linux Command Guide
Utimate Linux Newbie Guide
LinuxSelfHelp
Getting Started with Linux
Bash Beginners Guide
Bash Reference Manual
Advanced Bash-Scripting Guide
Linux Home Networking



The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!


 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the full path of a file in C? Basel Programming 3 10-30-2010 11:52 PM
Shell: tr can only be used when given full path (despite being in $PATH) chochem Programming 2 06-27-2008 09:37 AM
mod_rewrite full path chrille112 Linux - Newbie 6 03-06-2008 07:49 AM
Full Path Verbal Kint Linux - General 7 01-30-2008 10:34 PM
full path of a file ttilt Linux - General 1 11-08-2005 07:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration