To show the contents of a directory in the Linux terminal, you can use the ls
command, which stands for “list”:
ls
This will display a list of all the files and directories in the current directory.
You can also specify a directory path as an argument to ls
to display the contents of a specific directory:
ls /path/to/directory
Additionally, you can use various options with the ls
command to modify its behavior. For example, to display file sizes and permissions in a long format, use the -l
option:
ls -l
To display all files, including hidden files (which start with a dot (for example .htaccess file)), use the -a
option:
ls -a
To sort the files by modification time (newest first), use the -t
option:
ls -t
There are many other options available for the ls
command, which you can explore by typing man ls
in the terminal to access the manual page.