
The dot (.) at the end of the command implies the current working directory. To list the files and directories in the current working directory using vim editor, run the command shown below. This implies that a directory is also a file which contains some list of files and subdirectories. We already know that everything is considered as a file in Linux. In addition to viewing and editing files, vim editor can also be used for listing files and directories. Use the following command shown below.įor i in * do echo $i done 10. This is another method to list the contents of the directory. Access rights to group, owner and others.

#Bash list directory contents how to
How to List only Directories Using Find Command The dot (.) symbol indicates the current working directory.

To display all files which are present in the current working directory, use the following command. You can search files by name, extension, group, modification date, permissions etc. The find command helps us to look up for files for which we know only the approximate names.In simple words the find command searches for a file in the current working directory and recursively through the subdirectories that matches the given search criteria. The output will display both files and directories. To display the contents of current working directory run the following command. It will display the given parameters in the specified format or execute the command depending on the option specified. This command is used for formatting and printing text. In the above output, d indicates directories. To print the detailed information of each file and directory use the -l command-line option. The forward slash in the above output indicates the directory and others indicate files. The dir command is used to list the contents of the directory.
