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 - 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 09-27-2007, 05:01 PM   #1
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Rep: Reputation: 15
Recursive listing?


What is Recursive Listing? In what circumstances would you need to use it?
 
Old 09-27-2007, 06:11 PM   #2
cmnorton
Member
 
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Rep: Reputation: 35
ls -R

Recursive listing is asking to see the listing of the directory tree including your current directory and any directories and their contents below your current directory.
 
Old 09-27-2007, 07:21 PM   #3
andrews-mark
Member
 
Registered: Feb 2007
Location: London
Distribution: debian
Posts: 108

Rep: Reputation: 15
also, instead of "ls -R", you simply type "find". This will list out all files in, and recursively below, your current working directory. One of the advantages of "find" is that it will list out each file's path, relative to the starting point. It can be very handy in certain situations. For example, let's imagine your username is johndoe, typing
Code:
find ~johndoe | less
will list out the full path of every file in and below your home directory and pipe it to less so you can browse it.
-mark
 
Old 09-28-2007, 04:11 PM   #4
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Original Poster
Rep: Reputation: 15
When and why would you need to use it? What benefits are there to using it? Very confused?
 
Old 09-28-2007, 04:50 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by bkone View Post
When and why would you need to use it? What benefits are there to using it? Very confused?
Open a terminal, and type "ls"
then type "ls -R"

The difference between the 2 listings should be obvious. You would use the -R option whenever you need the extra information that it provides.

By the way, I don't think that this is really a good example of recursion....I had thought the definition had to do with a program (function) that called itself.
 
Old 09-29-2007, 08:09 AM   #6
andrews-mark
Member
 
Registered: Feb 2007
Location: London
Distribution: debian
Posts: 108

Rep: Reputation: 15
typing "ls" will list the files and directories in your current working directory. But what about the files and the directories inside the directories inside your current working directory. For that matter, what about the files and directories inside the directories inside the directories inside your current working directories. While we are at it, what about the files and directories inside the directories ... inside the directories ... inside the directories ... inside your current working directory - all the way down until there are no directories left to descend into. For that, you use "ls -R".
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
recursive rename zomane Programming 8 06-26-2010 11:08 AM
non Recursive query and Recursive query prashsharma Linux - Server 1 06-27-2007 09:33 AM
Recursive directories listing cdog Linux - General 11 12-09-2006 07:04 AM
Recursive Question Mistro116@yahoo.com Programming 1 11-27-2005 05:29 PM
rm -r what is recursive wogga Linux - Software 3 05-28-2004 02:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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