Here is the tree command to list folders & subfolders. You can install it using following command. Tree command can also be used to get list of directories & subdirectories. In this case, find command will only display the directories and not the files like ls -R command. $ find /home/data -type d #directories in /home/data You can also use find command to list directories at a particular location using type -d option. So when we use grep command with drw search string, it will show only directories. File permissions of directories start with ‘d’ while those of files start with ‘-‘. The output of ls -all command displays file permissions of each file & directory. $ sudo ls -all | grep drwĭrwxr-xr-x 18 ubuntu ubuntu 4096 Jul 8 02:33. If you don’t want a recursive search but simply want to see all the folders & subfolders in a location, then you can pass the output of ls -all command to grep and filter it to list only directories, as shown below. home/ubuntu) mention it after ls command. If you want to list directories & subdirectories of a specific folder (e.g. If you do not specify any folder then ls command will recursively display folders & subfolders in present working directory. Within each section, it lists files in that subfolder. The above command lists files in present folder followed by separate sections for each subfolder. You can recursively list directories & subdirectories using ls -R command. You can easily display directories & subdirectories in Linux using ls, tree, find, du command commands. How to List Directories & Subdirectories in Linux In this article, we will look at the different commands to list directories & subdirectories in Linux. Sometimes you may need to view or display directories & subdirectories only in a recursive manner in Linux.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |