LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Recursive listing? (https://www.linuxquestions.org/questions/linux-newbie-8/recursive-listing-587833/)

bkone 09-27-2007 05:01 PM

Recursive listing?
 
What is Recursive Listing? In what circumstances would you need to use it?

cmnorton 09-27-2007 06:11 PM

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.

andrews-mark 09-27-2007 07:21 PM

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

bkone 09-28-2007 04:11 PM

When and why would you need to use it? What benefits are there to using it? Very confused?

pixellany 09-28-2007 04:50 PM

Quote:

Originally Posted by bkone (Post 2906917)
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.

andrews-mark 09-29-2007 08:09 AM

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".


All times are GMT -5. The time now is 05:53 AM.