Is there a way to do a remote "ls" much like "scp" does a remote copy?

Is there a way to do a remote "ls" much like "scp" does a remote copy in a standard linux shell?


Solution 1:

You could always do this:

ssh user@host ls -l /some/directory

That will SSH to the host, run ls, dump the output back to you and immediately disconnect.

Solution 2:

To list all files in a directory:

rsync host.name.com:directory/path/'*'

For something like find directory/path -ls

rsync -r host.name.com:directory/path

Solution 3:

For all coming via google to this question because they are looking for a way to list remote files but can not access the remote server via ssh (common case for backup servers) you could use 'sftp'.

Example:

sftp [email protected]
ls
cd somedir
exit

Start an interactive session in a specific remote directory:

sftp [user@]host[:dir]