How to get the path of a file in UNIX?


 
Thread Tools Search this Thread
# 1  
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  
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
This User Gave Thanks to zazzybob For This Post:
# 3  
Sanju

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

Love,
Sanju.
# 4  
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  
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  
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  
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.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #260
Difficulty: Easy
Steve Jobs and Steve Wozniak co-founded Apple in 1976 to sell Wozniak's Apple I personal computer.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help to move .csv file from UNIX path to windows shared drive or c:\ drive

Hi Guys, Can any one help me on this. I need help to move .csv/.xls file from unix path to windows shared drive or c:\ drive? Regards, LKR (1 Reply)
Discussion started by: lakshmanraok117
1 Replies

2. Shell Programming and Scripting

Need help to move .csv file from UNIX path to window c: shared drive

Hi Guys, I need to move myfile.csv file from unix path(\oracle_home) to window c:\ shared drive h:\. Thanks in advance! Regards, Lakshman (1 Reply)
Discussion started by: lakshmanraok117
1 Replies

3. UNIX for Advanced & Expert Users

Need help on moving .csv file from UNIX to windows file path

Need help on moving .csv file from unix to windows file path. (1 Reply)
Discussion started by: lakshmanraok117
1 Replies

4. Shell Programming and Scripting

Generalising UNIX file path

There's a Unix configuration file that needs to be executed at the start of my script The location of the file is /Dstage/AA_INTERFACES/SYSTEM_FILES/MISC/ Now the script has to be deployed into a new UAT server for testing where the location above has been change to... (3 Replies)
Discussion started by: kumarjt
3 Replies

5. Shell Programming and Scripting

How to retrieve a file from specific path using unix script?

Hi i'm new to shell script, i want to get the filename from specific location which i mentioned in my script. The scirpt should read the filename exactly using the following command "ls -ltr | tail -1". Could someone show me on this. Below is my script #!/bin/ksh PATH= /usr/ if then ... (4 Replies)
Discussion started by: fresher
4 Replies

6. Shell Programming and Scripting

Retrieve directory path from full file path through sh

Hi, I have a file abcd.txt which has contents in the form of full path file names i.e. $home> vi abcd.txt /a/b/c/r1.txt /q/w/e/r2.txt /z/x/c/r3.txt Now I want to retrieve only the directory path name for each row i.e /a/b/c/ /q/w/e/ How to get the same through shell script?... (7 Replies)
Discussion started by: royzlife
7 Replies

7. UNIX for Dummies Questions & Answers

Find unix path to a file?

I know this is very newbie ... but I need help determining the proper file path to file...Have no idea how to do this I'm on a Mac OS X 10.6 Snow Leopard thanks very much (4 Replies)
Discussion started by: jmarc
4 Replies

8. UNIX for Dummies Questions & Answers

how to find complete path of a file in unix

hi experts(novice people can stay away as it is no child's game), i am developing a script which works like recycle bin of windows. the problem i am facing is that when ever i am trying to delete a file which is situated in parent directory or parent's parent directory i am unable to capture... (5 Replies)
Discussion started by: yahoo!
5 Replies

9. UNIX for Advanced & Expert Users

how to find complete path of a file in unix

hi experts(novice people can stay away as it is no child's game), i am developing a script which works like recycle bin of windows. the problem i am facing is that when ever i am trying to delete a file which is situated in parent directory or parent's parent directory i am unable to capture... (1 Reply)
Discussion started by: yahoo!
1 Replies

10. UNIX for Dummies Questions & Answers

vi - replacing a relative path with absolute path in a file

Hi, I have a file with about 60 lines of path: app-defaults/boxXYZ....... I want to change this to /my/path/goes/here/app-defaults/boxXYZ, but of course vi doesn't like the regualr :s/old/new/ command. Is there any other quick way to do this? Thanks ;) (2 Replies)
Discussion started by: Yinzer955i
2 Replies

Featured Tech Videos