List files and directories using 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):

ls

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:

ls –a(Short from –all)

Lists all files and folders including hidden (starting with a dot) files and directories.

ls –R 

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

ls -l

(Short from –long) 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:

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

SiteGround is not affiliated with or endorsed by the SSH Project or its trademark owners.