Search code examples
ubuntuls

Get list of files from different computer running Ubuntu


I have 2 Ubuntu machines XX.XXX.XX.X and YY.YYY.YY.Y. Now I logged into the 1st machine. I want to know the list of files in a specific folder in the 2nd machine. If my system is the same one, then I can just use ls, but for the current situation, how can I get the list?


Solution

  • If you have OpenSSH server enabled on remote machines, just type in the local console:

    ssh [email protected] "ls -l "

    You can also use command diff, but first you must mount a folder using the sshfs filesystem:

    sudo sshfs -o allow_other,defer_permissions [email protected]:/ /mnt/folder1

    After this, execute the diff command as comparing two folder on your local machine.