Working with files and directories
In this section, we’ll cover commands for working with files and directories and how to navigate the filesystem. We’ll start with the ls
command, which is used to list files, directories, and their permissions.
The ls
command in Bash is like the Swiss Army knife for listing directory contents. It’s simple yet packed with options to customize the output to your needs. Let’s dive into how you can use ls
to make your life at the terminal easier and more productive.
At its most basic, ls
will list the files and directories in your current directory using the following command:
~ $ ls Desktop Documents Downloads Music Pictures
This will display all non-hidden files and directories. Hidden files (those starting with a dot) won’t show up. To see hidden files as well, use the -a
option to get the following output:
Figure 2.1 – Hidden...