how to find the path of a file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to find the path of a file?
# 1  
Old 03-26-2008
how to find the path of a file?

Hi all,

Is there any way to find the the path of a file?
I mean executable files and just anyother file we can think of?

i know of one cmd called which
$which mount
/usr/bin/mount

this is fine, but "mount" is a cmd not a file that can be searched
eg: say i have created a text file called "myfile"
i dont know the path to it, how do i find it?

Thanks
# 2  
Old 03-26-2008
refer man find....

Code:
find / -name "filename" 2>/dev/null

# 3  
Old 03-26-2008
# 4  
Old 03-26-2008
And if you have locate, your disk will already be indexed every night, so no need to run a heavy-duty on-line find command at all (unless it's a file you created recently).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find a file and set path in variable?

Hi Folks - I was wondering if you could help convert batch code in Linux? For instance, I use the following piece of code in DOS to find a file/executable, and then the FULL path as a variable. ::-- If startMaxl.exe exists, set full path --:: for %%D in (c d e f g h i j k l m n o p q r s t... (4 Replies)
Discussion started by: SIMMS7400
4 Replies

2. Shell Programming and Scripting

Find zero byte file but don't need path

Just i want to ask How to search and display name of zero byte file I have used find command but it is showing complete file path Thanks find . -size 0 giving me zero byte file with location 1)/home/user/a (4 Replies)
Discussion started by: vivek1489
4 Replies

3. UNIX for Advanced & Expert Users

Find exact path of a file/directory

Hello Folks, A wrapper takes an argument of file or directory name. I want to allow paths that reside within the current directory only. Can simply discard the paths like "/A" & "../" as they go outside the current by looking at the path beginning. How to validate this one: A/../../../b... (4 Replies)
Discussion started by: vibhor_agarwali
4 Replies

4. Shell Programming and Scripting

How to a find a file in which path it is there?

Hi Firends, Good Morning to all, I want a find command to search a paticular file present in my system(ie search through under all users and all directories.) I am looking forward from you.:) Advance Thanks, Siva Ranganath CH (3 Replies)
Discussion started by: sivaranga001
3 Replies

5. 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

6. UNIX for Dummies Questions & Answers

find locked files, print file path, unlock file

using OS X and the Terminal, I'd like to find all locked files in a specified directory, unlock them, and print a list of those files that were unlocked how can I do this? I'm familiar with chflags nouchg for unlocking one file but not familiar with unix enough to do what I'd like. Thanks! (0 Replies)
Discussion started by: alternapop
0 Replies

7. Shell Programming and Scripting

Find a path of a specific file

Hi, A variable value is /home/samir/datas/data.txt I want /home/samir/datas. How can I get that. (11 Replies)
Discussion started by: samir_standing
11 Replies

8. UNIX for Dummies Questions & Answers

command to find the path of a file

What is the command to find the path of a file if we know the file name and the root directory where the file resides.. For eg. if a file abc.dat resides in /home/mydir/myfiles/. I am looking for a command which will be fired from / directory, takes abc.dat as input and display the path of... (3 Replies)
Discussion started by: abhilashnair
3 Replies

9. Shell Programming and Scripting

to find the file with full path

Hi, I have written this shell script: fl=`ls -1lrt $mylist | grep '\.xml$' | awk '{print $9}'` echo $fl (1) for i in $fl do for dir in $mylist do if then echo $dir/$i >> tmp (2) fi done done The mylist contains some directory names. The satement (1) gives the sorted list... (5 Replies)
Discussion started by: surjyap
5 Replies

10. Shell Programming and Scripting

Find a file in sub-directories.. o/p just the path

Hello All, I am somehow stumped with this ting. 'Find' will sure show me.. but I want only thepath of all the occurences of the file in any of the sub-dirs.. Any help will be sincerely appreciated. thanx! (3 Replies)
Discussion started by: pranavagarwal
3 Replies
Login or Register to Ask a Question