
To only list hidden files, you can use ls -ld. This time we can see a hidden file which wasn’t listed in the previous examples. To include hidden files in the directory listing output, use the -a or -all option with the ls command: $ ls -allĭrwxrwxr-x 2 cloud_user cloud_user 4096 Jan 18 10:36. Linux hidden files and directories are prefixed with a. List Hidden Files on Linux using LSīy default, hidden files are not displayed in the default ls output. The ls -l command shows a lot more information than the default output – but be aware that this will not show any hidden files. By default, the files are listed in name order, but if you wish to reverse the order of the output, you can do so by using the -r option with the command. It shows the file permissions, link count, owner and group information, file size and last modification date and time. This output gives a lot more information about the files in the directory listing. rw-rw-r- 6 cloud_user cloud_user 12 Dec 15 15:09 list2.txt rw-rw-r- 6 cloud_user cloud_user 12 Dec 15 15:09 list1.txt rw-rw-r- 1 cloud_user cloud_user 18 Dec 15 11:56 file3.txt rw-rw-r- 1 cloud_user cloud_user 12 Dec 15 11:48 config2.txt To display additional information about the files, use ls -l. Now, whilst we have a list of the files in the directory, that’s all we have. myfiles/Ĭonfig2.txt file3.txt list1.txt list2.txt You can also list the files in another directory by specifying the directory path to use with the ls command. On the Linux command line, just running ls by itself will result in listing the files contained in the current directory: $ lsĬonfig2.txt file3.txt list1.txt list2.txt list3.txt
#LINUX COMMANDS LIST DIRECTORY CONTENTS WINDOWS#
It is basically the equivalent of the Windows dir command, though is more flexible, as we will see later. If you have been using Linux then you are likely already aware of the ls command, as it is one of the first commands you will learn about using.

Using the LS Command to List Directory Contents on Linux
#LINUX COMMANDS LIST DIRECTORY CONTENTS HOW TO#
More Examples of How to List Directory Contents on Linux.

Sort the Directory List by other Attributes using the Sort Command.

