Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-04-2008, 01:37 PM   #1
LQ Newbie
Registered: Sep 2006
Posts: 6

Rep: Reputation: 0
grep question

or at least I think its grep I need to be using...

I need to get a list of all the absolute pathways of every file in a single folder (300+ files) and have them piped into a text document.

I've done it before but its been a really long time and I have no idea what to do anymore :'(

If anyone has any ideas it would be greatly appreciated!

Thanks =)
Old 10-04-2008, 02:24 PM   #2
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
How about simply:
$ find /path/here

Redirect stdout from that into your text file...
Old 10-08-2008, 07:50 PM   #3
Registered: Nov 2004
Distribution: Slackware
Posts: 73

Rep: Reputation: 15
If I understand your need, you want to list the entire contents of a directory, and pipe that into a text file.

since ls will only display the filenames, you can get the directory via the pwd command. Unless you absolutely need the path to preceed the filenames, I'll assume that simply listing the path at the beginning of the file is which case, the following commands should get you what you need:

pwd > /path/to/output_file && ls -ld * >> /path/to/output_file
The above assumes that you are running it from the directory you wish to list the contents of.

If I've misunderstood, and you have a bunch of symbolic links in said directory, and you're wanting to see where you're linking to...the following should do the trick:

ls -ld * |grep '>' > /path/to/output_file


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
grep question yawe_frek Programming 3 01-05-2008 08:07 AM
question about grep new_2_unix Linux - Newbie 5 12-07-2007 05:45 PM
maybe a grep question: me210 Linux - Software 3 01-19-2007 01:13 PM
grep question djgerbavore Linux - Newbie 3 11-04-2004 11:53 AM
grep question Hockeyfan Linux - General 1 05-15-2004 03:09 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:01 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration