LinuxQuestions.org
Help answer threads with 0 replies.
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, 06:01 PM   #1
bkone
Member
 
Registered: Jun 2006
Distribution: Suse
Posts: 87

Rep: Reputation: 15
Recursive listing?


What is Recursive Listing? In what circumstances would you need to use it?
 
Old 09-27-2007, 07: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, 08: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, 05:11 PM   #4
bkone
Member
 
Registered: Jun 2006
Distribution: Suse
Posts: 87

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, 05:50 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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, 09: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


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
recursive rename zomane Programming 8 06-26-2010 12:08 PM
non Recursive query and Recursive query prashsharma Linux - Server 1 06-27-2007 10:33 AM
Recursive directories listing cdog Linux - General 11 12-09-2006 08:04 AM
Recursive Question Mistro116@yahoo.com Programming 1 11-27-2005 06:29 PM
rm -r what is recursive wogga Linux - Software 3 05-28-2004 03:29 PM


All times are GMT -5. The time now is 10:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration