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 06-21-2005, 08:28 PM   #1
benobi
LQ Newbie
 
Registered: May 2004
Posts: 18

Rep: Reputation: 0
ls to display path?


How do you get ls to display the path to the file?

For example, lets say I'm looking for a file in one of the million subdirectories in /etc. And I know it's in one of the subdirectories but I don't know which subdirectory and I don't wanna try going through each one.

I type:

ls -R /etc | grep blah

and it just displays all the "blah"s in the subdirectories of /etc, but it doesn't tell me exactly where in /etc the file is. I tried -l flag for long but that didn't help. I couldn't find anything in the man page for ls, but maybe I overlooked an argument?
 
Old 06-21-2005, 09:35 PM   #2
merchtemeagle
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: Slackware 13.37
Posts: 512

Rep: Reputation: 31
Code:
ls -lR /etc | grep blah
or using locate:

Code:
locate blah
 
Old 06-22-2005, 02:42 AM   #3
benobi
LQ Newbie
 
Registered: May 2004
Posts: 18

Original Poster
Rep: Reputation: 0
I still get the same result with that:

ls -lR /etc | grep fonts.conf

results in:

-rw-r--r-- 1 root root 17186 Apr 19 13:54 fonts.conf

But it doesn't tell me the path to fonts.conf. Based on the information ls gives me, I only know that fonts.conf is in one of the many subdirectories of /etc, but I don't know exactly which of the several subdirectories it is in.
 
Old 06-22-2005, 03:08 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Use find cmd eg
find . -iname 'somefilepatternhere' -print 2>/dev/null
btw, you'll need the quote marks if using wildcard in 'somefilepatternhere'
 
  


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
Image Path reference in Linux (Absolute path) javabuddy Linux - General 7 06-05-2006 08:45 AM
Apache path and kde path questions darkraider Debian 1 11-12-2005 06:07 AM
System envoirment (for exampe DISPLAY, PATH) originated from which file in linux ? stewchcken Linux - General 1 08-07-2005 01:46 PM
Removing path form PATH maginotjr Linux - Newbie 3 02-12-2005 03:23 PM
How to Chnage Python's module search path (sys.path)? lramos85 Linux - Software 1 05-02-2004 07:10 PM


All times are GMT -5. The time now is 04:33 AM.

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