The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
PATH in unix thiyagak85 Shell Programming and Scripting 4 07-07-2008 12:24 PM
serach and replace file name in the path in a remote xml file kiranreddy1215 Shell Programming and Scripting 1 11-12-2007 11:31 AM
vi - replacing a relative path with absolute path in a file Yinzer955i UNIX for Dummies Questions & Answers 2 09-07-2006 12:47 PM
missing Path(in UNIX) when i launch a job on to unix machine using windows SSh megastar UNIX for Advanced & Expert Users 1 11-04-2005 07:36 AM
UNIX PATH info required PLEASE HELP (I'm new to unix) akitachi UNIX for Dummies Questions & Answers 1 05-10-2002 03:37 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-04-2007
smr_rashmy smr_rashmy is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 41
How to get the path of a file in UNIX?

Hi Frindz,

I want to get the entire path of a file.
I am in root directory and i know the file name, However dont know the path where it is.

Please tell me the command to get the entire path for the file?

Thanks in advance,
Rashmy.
  #2 (permalink)  
Old 10-04-2007
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Try

Code:
locate filename

If you don't have locate (or updatedb hasn't been run recently), try

Code:
find / -name "filename" -type f -print

Cheers
ZB
  #3 (permalink)  
Old 10-05-2007
sanjustudy sanjustudy is offline
Registered User
  
 

Join Date: Aug 2005
Location: India
Posts: 17
Sanju

type "pwd" at the file location prompt will show u the complete path

Love,
Sanju.
  #4 (permalink)  
Old 10-05-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
A file can have a number of paths which lead to exactly the same file.

Also, is some circumstances, such as being on a remote NFS mount while using an old UNIX, you can't get back via ".." to find the parent directory.
  #5 (permalink)  
Old 10-05-2007
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,993
if the file is a executeable and it's in your path:

Code:
which filename

showes the file first found in your path. if it's just any file read "man find"

hth
  #6 (permalink)  
Old 05-09-2008
smr_rashmy smr_rashmy is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 41
hi frnds,

see i am in home directory and i know the file name also,

which command will get me all the complete directory paths where the file presents?

Thanks,
Rashmy
  #7 (permalink)  
Old 05-09-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,800
The find command zazzybob gave you. Oops - edit - watcth the -type f. If your file has links with the same name then drop the -type f.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0