Due to the large number of directories in the Raspberry Pi operating system, listing the files is becoming a difficult task for the beginners. People won’t be able to find the files easily and because of the growing demand of Raspberry Pi operating systems nowadays due to its simplicity, it is necessary to provide a solution that can help people in managing their files. Moreover, taking a full command over the Raspberry Pi operating system in a day is not possible, however, if someone has really started to begin his/her work on Raspberry Pi, then he/she will learn most of its commands in a few days. Here, in this article, we will discuss the basic commands to list files on Raspberry Pi so that everyone can navigate the files easily.
Command to list files on Raspberry Pi
You can list your files through the built-in terminal of the Raspberry Pi operating system and for this purpose, you need to find out the commands in order to see the list of files on the terminal.
Here are some of the commands which you will use if you want to see the list of files on the Raspberry Pi operating system. In order to use the commands, you should open your terminal on Raspberry Pi, which you can find next to the menu option.
Using the Is Command to list the files in Raspberry Pi
After opening the terminal on your Raspberry Pi, you are required to enter the “ls” command in the terminal in order to list the files and directories. The command will provide you with the list of your home directories:
You can see the list of contents of any directory through a simple command. You need to enter the command “ls /directory_name” in the terminal to view the list of files in a directory. Suppose “/etc” which is a built-in directory and if you use the command “ls /etc” in the terminal you can list the files in the directory.
If you want to see a list of files in a subdirectory, you can do that quite easily through a command. You just need to enter the command “ls /directory_name /subdirectory_name” to view the list of files in the subdirectory of a directory. For example, let’s replace “directory_name” with “etc” and “subdirectory_name” with “alternatives” as shown in the below mentioned command.
If you want to list the files in multiple directories, you can easily get them if you enter the command in the terminal with directory paths, for instance:
There are some other commands that you should need to follow if you want to list files in some other ways.
To view the list of hidden files starting with “.”, enter the command “ls -a” in the terminal and you will see the list of hidden files in the directories:
You can see both readable and hidden files in the directories by entering the command “ls -all” in the terminal and you will see all files on the terminal:
If you want to see the list of directories in a single column, use the command “ls -1” and it will show you the list in a single column.
Adding the command “ls -1a” will show you the list of hidden files starting with “.” in a single column:
The command “ls -1h” provides the similar input which “ls -1” gives you. It shows you the list of readable files in a single column.
If you are interested in seeing the list of files in recursive order, enter the command “ls -r” in the terminal to get the result you want.
If you want to see the list of files which are used or modified based on date and time, just enter the command “ls -t” in the terminal to see it:
If you want to sort the files based upon their size you can do that easily by entering the command “ls -S” in the terminal.
If you want further help in using the commands which are used for listing the files, you will easily get by entering the command “ls –help”. You will see a detailed list of commands with their functioning and it will help you in choosing your command based on your choice.
Conclusion
From the list of files you can find your required documents within a few minutes and this is something which is required by most people to save their time.You can manage your files without going in each folder. Moreover, it saves your precious time in finding your files in a directory as you can easily see your files in the list. There are many commands to follow and you will see them in the help so remember these commands and it will make your coming days better.