The ls
command in Linux is used to list the contents of a directory. It is one of the most frequently used commands in Linux. The command lists all the files and directories in the current working directory by default. You can also specify a directory path as an argument to list its contents. Here are some examples of how to use the ls
command:
- To list all files and directories in the current working directory:
ls
- To list all files and directories in a specific directory:
ls /path/to/directory
- To list all files and directories in a specific directory with detailed information:
ls -l /path/to/directory
- To list all files and directories in a specific directory with detailed information and hidden files:
ls -la /path/to/directory