SKPS
SKPS

Reputation: 5855

Access a file on remote/cluster directly

I am trying to compare two files one local and other one on remote. I used

meld a.txt user@host:/home/user/john/b.txt

This was not possible because file could not be detected. However, I could copy the same file from the same location to local via scp and do the comparison afterwards. How to access the file directly on cluster for example like:

vim user@host:/home/user/john/b.txt

Upvotes: 1

Views: 723

Answers (3)

Tiborcz Kiss
Tiborcz Kiss

Reputation: 65

Try save the remote file to your linux system and simply use diff -y file1 file2 command. You will see the diff between.

diffutils - packagre required for it

Upvotes: -1

samuelnihoul
samuelnihoul

Reputation: 269

Check the path in your example, I think it's incorrect. Try directly:

vim john@server:b.text

That should work.

Upvotes: -1

Mathieu
Mathieu

Reputation: 9659

In bash, you can create a file from a process with <(...):

meld a.txt <(ssh user@host cat /path/to/file/b.txt)

If you want to modify the remote file, you'll have to use some mounting.

One way to do it is to use sshfs

# sshfs setup
mkdir ~/remote
sshfs user@host:/path/to/file ~/remote

# meld invocation
meld a.txt ~/remote/b.txt

Upvotes: 3

Related Questions