The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
listing of directories with / at end...without ls -F vasanthan UNIX for Dummies Questions & Answers 10 04-16-2008 01:34 AM
listing of directories with / ...not to use ls -F vasanthan UNIX for Advanced & Expert Users 1 04-16-2008 12:20 AM
Listing Deleted Files and Directories raviviolet13 Shell Programming and Scripting 1 09-06-2007 10:47 PM
Listing directories and ${1:+$1/}* GMMike UNIX for Dummies Questions & Answers 5 01-24-2005 06:38 PM
files and directories listing bbolson UNIX for Dummies Questions & Answers 1 12-11-2001 10:30 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-05-2008
Registered User
 

Join Date: Jun 2007
Posts: 34
listing all code in all files in all directories

Hi all,
can any one help me out in this:::
basically i need to list all the contents in all files in all directories (starting from root and then onwards)...i will get the session saved in a file (just a secure CRT, etc)

seems to be a simple one.
if anyone can come forward, its really appreciated.

root password is available.

Regards,
Reply With Quote
Forum Sponsor
  #2  
Old 05-05-2008
Registered User
 

Join Date: Sep 2006
Location: Mysore, India
Posts: 160
Is this what you are looking for?

Code:
ls -lR / >list.dat
Reply With Quote
  #3  
Old 05-06-2008
rubin's Avatar
Registered User
 

Join Date: Nov 2007
Posts: 216
Quote:
Originally Posted by asadlone View Post
...
basically i need to list all the contents in all files in all directories (starting from root and then onwards)...i will get the session saved in a file (just a secure CRT, etc)
...
Regards,
Code:
find / -type f | xargs cat > outfile

If you need the names of each file to prepend to the content's file in the final output file, use the following code ( slower than the previous one ) :

Code:
find / -type f | while read files
 do 
   echo "$files";  cat "$files" 
 done > outfile
Reply With Quote
  #4  
Old 05-11-2008
Registered User
 

Join Date: Jun 2007
Posts: 34
ok thanks. if we wanna ignore the binary files how we gonna do it... coz we cannot 'cat / view' them as it shows hexadecimal characters...
Reply With Quote
  #5  
Old 05-11-2008
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 917
You can use the file command on each file before displaying it. If the output of that command contains the word "text", display it, otherwise display an error like "so-and-so is a binary file".
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:14 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0