LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-19-2012, 09:36 AM   #1
dwmolyneux
Member
 
Registered: Feb 2012
Location: United States of America
Distribution: "First Time Gentoo user",Debian, Fedora, LinuxMint
Posts: 124

Rep: Reputation: Disabled
Question recursive ls output to file with path?


I was thinking about this and wasn't bringing anything up in a web search but I was wondering if anyone knows:

Is it possible to do a
Code:
ls -a / >> /path/to/file.txt
just once and be able to get all the sub paths or recursive in the output?

I'm just looking for a simple shortcut that will give me an output that I can refernce for easy access.
 
Old 06-19-2012, 10:14 AM   #2
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Stretch
Posts: 612

Rep: Reputation: 125Reputation: 125
This might help you: http://mywiki.wooledge.org/BashFAQ/010
 
Old 06-19-2012, 10:21 AM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Code:
ls -aR / | tee /path/to/file.txt
Run as root, otherwise the list will be incomplete because of users permissions to enter some folders.

However, if you just want to find the location of files, you don't need to do the above.

There is a command pair called updatedb and locate. The updatedb command builds a database of all files on the mounted partitions at the time the command is run, and locate will search that database for the pattern given as an option to the command. Like so: locate vim will find every instance of the pattern *vim* in the database. Careful selection of the search pattern limits the undesired returns.

Last edited by bigrigdriver; 06-19-2012 at 10:27 AM.
 
1 members found this post helpful.
Old 06-19-2012, 10:46 AM   #4
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
you might also do:
Code:
# find / *  -ls > /path/to/output_file.txt &
and you can expect a loooooooooong list of everything.


good luck
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to get the absolute path of the running executable file and current work path ? 915086731 Programming 3 11-01-2011 09:28 AM
[SOLVED] Move a file to some path and create that path when it doesn't exist WhisperiN Linux - Newbie 6 10-09-2010 11:47 AM
logging recursive grep output zvar Linux - Newbie 4 09-13-2009 08:45 AM
set path with output from text file. jstephens84 Slackware 3 12-04-2006 12:49 PM
using commands to output path, filename and info to a txt file bob_man_uk Linux - General 3 05-11-2006 02:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:36 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