LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 01-02-2018, 10:48 PM   #1
StepNjump
Member
 
Registered: Jul 2011
Posts: 32

Rep: Reputation: Disabled
Easy question... where is my file located?


Hi guys,

I want to look for a file using ls and grep. It works.. I found my file BUT it doesn't tell me which directory it's located into...!

ls -salt | grep -iR searchterm

Can't find an ls switch that would provide me with that.

I know this must be an easy one but I can't find it.

THank you


StepNjump
 
Old 01-02-2018, 10:58 PM   #2
Soitgoes
Member
 
Registered: Oct 2016
Location: Beyond Thunderdome
Distribution: Gentoo
Posts: 67

Rep: Reputation: Disabled
You can’t use find or locate? Or is this strictly an exercise in curiosity? I would typically do:
Code:
# find / -name <filename>
 
Old 01-02-2018, 11:01 PM   #3
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora, Centos, Manjaro
Posts: 317

Rep: Reputation: 70
Try the find command like:-

$ find . -name searchterm

or for a wider search

$ find . -iname \*searchterm\* -exec ls -al '{}' \;
 
Old 01-02-2018, 11:41 PM   #4
StepNjump
Member
 
Registered: Jul 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Oh yes ArfaSmif, that's a good one too.
I just found a cool one:

grep -r -l --color=never --include="filemask.*" "string"

Thank you gentlemen.

Pete
 
  


Reply

Tags
directory, grep, ls, terminal



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 extract a rar file in linux,file was located in downloads,explain clearly with shabv Linux - Newbie 5 02-13-2015 03:15 PM
[SOLVED] how to un/install if i do not know the file located at slowerogue Linux - Newbie 16 10-17-2012 11:09 PM
DNS question - site located on 2 servers. xp2004xyz Linux - Server 1 10-27-2008 02:00 PM
Random question about the file hierarchy, specifically where trash is located Tribulation Ubuntu 3 07-20-2008 10:26 AM
Yum update complains missing file (broken dep), but file can be located. davidas Linux - Software 0 03-27-2004 09:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 07:48 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
Open Source Consulting | Domain Registration