Listing Files & Directories
Shell·2 min read·Jan 1, 2025
To output the list of files and directories contained in the current working directory, you can use the ls command — which stands for list:
$ lsExample
Let's consider this filesystem representation, in which the current working directory is the home directory:
/├── home│ └── johndoe ← Current working directory│ │ ├── Documents│ │ └── DownloadsExecuting this command will list the content of the /home/johndoe directory in the form of columns:
$ lsDocuments DownloadsListing the content of directories
To list the content of one or more directories, you can use the ls command as follows:
$ ls [path ...]Unlock the CLI & Scripting with Bash module
Learn how to gain advanced control over the OS and automate complex routine tasks prone to manual errors with the CLI and Bash scripting.
You get immediate access to:
- 34 focused lessons across the CLI and Bash
- 4 real-world projects with commented solutions
- Ongoing updates to this bundle
- Lifetime access to this bundle