Open and edit code file from remote server in my preferred editor? - linux

I am having a lot of trouble solving a SFTP problem...
I would like to be able to open and edit text files in my preferred editor such that I can execute a command on my remote server and it will open the file in Visual Studio Code. Once that file is opened in VS code, I would like to be able to edit it and, when I save, it will save the changes to the same location on the server.
I know something like this is possible because I have used WinSCP where I can double click a text file from the server through the UI and it will open it in whichever editor I choose. When I save changes, it will update those changes on the server. I really want to know what WinSCP is doing behind the scenes when I do that.
Any help would be appreciated. Thanks!

WinSCP is running on your local machine, so it can open a local editor. So, it's not comparable.
You cannot execute local a application from a remote server.

Related

kdevelop detect concurrent file opens

My favorite editor, geany, has an option "Disk check timeout", after this timeout it checks if someone else has overwritten the file that I'm editing. This is a simple tool to detect if two people work on the same file (we don't use a version control system). Is there an option or a plugin for kdevelop that does the same thing?
Edit: as Zhigalin said KDevelop does the check automatically but only for local files, I need it for files opened using sftp.
In KDevelop this check is always active, you will get a popup as soon as you focus on that file in the editor.
Edit: if you are speaking of remote files than the reply is no, there is no such functionality.
So you have 4 options:
File a proposal here (which probably won't get implemented soon because of few active developers)
Patches are always welcome
[suggested] Start using a version control system like Git, there are even tools to automatically deploy on server when you make commit on a specific branch.
Use AutoFS(FUSE) to mount your server as a local folder.

Viewing updates of a dynamically generated log on a remote linux server from a windows machine

I have connected my windows 7 machine via winscp sftp with a cubietruck that runs on debian jessie server.
I need to watch on windows the updated log of an installed app in the linux server.
With winscp I can see this log file. I set the winscp to refresh the remote panel every 10 seconds. I tried to open this log with the following editors:
1) Sublime text with autorefresh plugin
2) Notepad ++ with update silently set
3) Glogg
Unfortunately even though the remote panel was refreshed and watched the log file to grow in size, the file opened in the editors was not updated.
I also tried to set Keep Local Directory up To Date , which creates a replicate file in a local directory in windows. When I had this file opened with the above editors and the remote log file changed then a new file was created on the local disk, without succeeding in watching the updated log.
Does anyone know any solution to this issue or a working alternative ?
You can try klogg. It is a fork of glogg. Glogg opens files in such a way that may prevent other programs from accessing them, that is described here. That has been fixed in klogg(see the issue for details).

How can i execute my exe file form server

I want to keep my exe on Sever. And on Client Desktop icon for that application will contain the address of that server whenever user will click on desktop icon it should call from server location on his computer. That exe should run on his computer. what should i use? How can achieve this. Please help me. Thanks in advance
You can use shared folder fo this.
Place exe file in the sared folder and create a shortcut.
It depends on what you are trying to accomplish.
If you are doing this so you can change the actual EXE without updating the users computer, then you would have a simple app on the users computer that would look for the exe on the server. Once it found it, it could execute it via:
Process.Start(exeName) // where exeName is a reference to the executable you want to run, including path.
Once that has started, your app can now exit as it is no longer working.
Using this approach, you can have your app check for the exe of your choice and run that.
If you just want to be able to keep the exe on the server, then just click on the exe in the server (in windows explorer) and drag it to the users desktop as a shortcut and you are good to go.
Enjoy

Notepad++ upload to FTP and keep file

So I have a domain and a directory on my computer that can be accessed with my ipadress as link and I want so when I click save it uploads the updated version to the FTP AND updates the file on my computer so both my domain website and my ipadress website will be updated with the new changes, is that possible?
I'm sorry if it is hard to understand the text, kinda hard to explain to...
Use Win-scp.
Install it, then either:
Open the file directly from the server and when you save the file will be uploaded
click on Keep remote directory up to date and once you save for file locally, winscp will upload it for you.
To work with Notepad++ with winscp you need to configure winscp to use notepad++.

VIM support to upload via SFTP

I am used to Sublime's plugin that let's you do a mapping between your local project and a remote project. By doing so, when you are done editing a file, you can do a right click and "Upload file" action which automatically updates the file in the remote server.
I am wondering what would be the best way to do this while programming with VIM. I am looking for an easy way to be able to map a local project to a remote one and be able to upload the file easily.
Thanks
If all you want is to edit files on a remote server,
try vim's netrw feature:
vim scp://you#yourserver//path/to/directory/
Edit a file directly:
vim scp://you#yourserver//path/to/directory/somefile.txt
Or if you are already in vim, hit ESC, then type:
:e scp://you#yourserver//path/to/directory/
This assumes that:
you have ssh installed (usually the case for Linux or OSX; if you are on Windows then it depends).
you have ssh access to the server via some convenient method (sshagent and keys)
Most serious FTP clients let you edit remote files locally. Filezilla, gFTP, Transmit, Cyberduck, YummyFTP… they all have their own "Edit in…" button. GUI FTP clients may not be sexy hacker tools but they work very well.
Some of those serious FTP clients have synchronisation features or folder watchers. It might be worth your time to look around for such a feature.
Of course, you can also use Vim itself to edit a remote file via FTP or SFTP:
$ vim sftp://user#machine/filename
$ vim ftp://user#machne/filename
and list remote files:
$ vim sftp://user#machine/directory/
See :help netrw for more info.
Did you consider using a VCS like Subversion, Git or Mercurial?

Resources