Share:
Notifications
Clear all

User of ls -r command in linux

1 Posts
1 Users
0 Reactions
433 Views
(@ivan)
Posts: 93
Trusted Member
Topic starter
 

The ls -r command in Linux is used to list files and directories recursively. This means it will display the contents of the specified directory and all its subdirectories.

Usage:

bash


ls -r [directory]

Options:

  • -r: This flag stands for "recursive." It will traverse through all subdirectories.

Example:

To list all files and directories in the current directory and its subdirectories, you can simply run:

bash


ls -r

If you want to list the contents of a specific directory recursively:

bash


ls -r /path/to/directory

Additional Tips:

  • Combine with other options like -l for a detailed list (permissions, size, modification date):

    bash
    
    
    ls -lr
  • Use with grep to filter results:

    bash
    
    
    ls -r | grep "pattern"

This command is helpful for getting an overview of all files in a directory tree, especially in complex directory structures.

 
 
Posted : 27/10/2024 6:20 pm
Share: