List Files and Directories using SSH

Learn how to list files and folders via SSH

In order to list all files and directories using an SSH client, you would need to execute the appropriate command. The command name, in this case, is ls and it accepts various parameters.

When using the command alone (without arguments):

the output will be all visible files and folders without additional formatting or information.

In order to view more information about the files (such as their permissions, ownership, last modified date, etc) and at the same time to list the files and directories, you would need to supply additional arguments to the command. The most common arguments are as follows:

The above command lists all files and folders including hidden (starting with a dot) files and directories.

Lists recursively (i.e follows subfolders as well) all files and folders under the current directory.

Lists all files and folders, each on a separate line, and provides additional information about them (permissions, ownership and modified date). The arguments, as is with most Unix based commands, can be combined. For example:

will list all files (even the hidden files starting with dot), provide more information about them and will continue recursively into each subfolder.