To be able to view the content of a folder in Linux operating system distribution via command line is simply quite easy. It can be done by accessing terminal which is provided with the right bash prompt.
It is actually a shell command recognized by the shell that will be executed to perform certain task. In this context, the command is displaying the content of a certain or specific folder in mainly Linux operating system distribution.
Just type the following command in the bash shell prompt to be able to view the content of a folder :
ls -al folder_name Description : ls : It is a command usually available as default installed command to list the content exist within a directory. -a : It is an additional parameter used by ls command to display all the content including hidden files. The letter 'a' itself can be associated with 'all' or can be assumed as the abbreviation of all to make the parameter easy to be remembered when we want to display all types of content exist within the directory. -l : It is an additional parameter used by ls command to display the content in form of list. The letter 'l' itself can be associated with 'list' or can be assumed as the abbreviation of list to make the parameter easy to be remembered when we want to display the content exist within the directory in a list form display. folder_name : It is the name of the folder which the content is going to be displayed.
For an example in the real execution command in the bash prompt :
user@hostname:~/test-folder$ ls -al total 44 drwxrwxr-x 2 user user 4096 Sep 22 14:10 . drwxr-xr-x 117 user user 20480 Sep 23 11:28 .. -rwxr-xr-x 1 user user 52 Sep 3 21:30 my-bash-script -rw-rw-r-- 1 user user 0 Sep 19 08:02 test-file -rw-rw-r-- 1 user user 32 Aug 27 14:38 test-file-1 -rw-rw-r-- 1 user user 32 Aug 27 14:38 test-file-2 -rw-rw-r-- 1 user user 32 Aug 27 14:39 test-file-3 user@hostname:~/test-folder$
As we can see that the command is executed above will shown every content available in the current folder. For further information about the command, it can be read in the manual page of command ‘ls’.
One thought on “Displaying the content of a folder in linux”