Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This one uses Samba:

 $ ls smb://192.168.5.4/wdtvlivehub/abc
 ls: cannot access smb://192.168.5.4/wdtvlivehub/abc: No such file or directory

I somehow managed to do it by;

  1. Browsing to the remote directory. (pcmanfm 0.9.9)
  2. Opening the current folder in a terminal.
  3. Executing pwd to get /home/myuser/.gvfs/wdtvlivehub on 192.168.5.4
  4. Doing ls /home/myuser/.gvfs/wdtvlivehub on 192.168.5.4 worked.

..What would be a more elegant way?

share|improve this question

migrated from stackoverflow.com Sep 18 '11 at 21:09

This question came from our site for professional and enthusiast programmers.

    
Is mounting the remote filesystem an option? –  tjameson Sep 18 '11 at 21:05
    
Yep, it can be. –  octosquidopus Sep 18 '11 at 21:15

2 Answers 2

up vote 1 down vote accepted

Your current method of using ~/.gvfs/ is fine, but you don't need pcmanfm for that – you can use gvfs-mount to connect to the share. Additionally, tools such as gvfs-ls and gvfs-cp will accept your smb:// URI.

$ gvfs-mount smb://host/share/

$ gvfs-ls smb://host/share/

$ ls ~/.gvfs/"share on host"/

(Remember to quote spaces within path names.)

Specifically for Samba, you can use the smbclient program, or mount the share on the VFS layer by using mount -t cifs. (The latter is, unfortunately, limited to root.)

$ smbclient //host/share

# mount -t cifs //host/share /mnt

(For other kinds of filesystems, such as SFTP and FTP, sshfs and curlftpfs exist respectively.)

share|improve this answer
    
I mentioned pcmanfm because that is most probably how I will get to the folder before executing it with the script. gv-ls seems to be exactly what I was looking for, though. Looks like it could even replace ls for local directories for the sake of consistency. –  octosquidopus Sep 18 '11 at 21:28

You can use the command smbclient, e.g.:

smbclient -N //192.168.5.4/wdtvlivehub/abc -c ls
share|improve this answer
1  
Great, but how can I achieve the same output as with regular ls (no columns nor formatting, just a list of files)? It's important because I want to pipe the output to another command. –  octosquidopus Sep 18 '11 at 21:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.