SSH Client that has a GUI directory tree whose view synchronizes with current dir in Terminal? - user-interface

I am looking for an SSH client with the following features:
A terminal/shell (text-only) interface.
A GUI with directory tree (like windows explorer).
The ability to keep these views in sync-- ie. when you enter the command cd .. in the terminal, the directory tree GUI will update its view, and navigate up one directory.
I know that several SSH clients exist with 1 and 2, such as winscp. However, I have never seen 3 in it or other clients.
Does anyone know of a SSH client with this ability to synchronize the view between the terminal session and the GUI?

WinSCP does do this.
If you use the SCP method (rather than FTP or SFTP) when connecting, you can open a terminal (from Commands > Open Terminal) and cd to your heart's content. When you close the terminal, the file view changes to where you left it.
Ok so its not instant... but all you have to do is close the terminal, see the new GUI, reopen with a shortcut (CTRL+T) and you have what you're looking for.

Related

How do I more easily copy and paste all the content in open file on remote server over ssh using tmux and iterm2?

Problem: I'm on a mac running a tmux server. Within my local tmux session, I connect to a remote linux server and open a file with vim. The text I want does not fit in a single pane without having to scroll. I want to grab the text in the file and copy and paste all of it to my local machine's memory.
Current Solution:
My current procedure for copying and pasting is very convoluted:
Zoom on the pane with ctl-b z
Turn off numbering in vim with :set nonumber
If the file or text I want does not fit in entire pane, I hit cmd - until the text is small enough to fit in the entire pane
Select text I need with my mouse while holding down the option key.
Hit cmd-c to copy to my local machine.
Better Solution?
My current solution is tedious and I'm tired of wondering if there is a better way. Anyone got a better solution?
Ideally, I'd love to be able to select the text with vim and have iterm2 somehow detect what has been selected in a pane and run a single keystroke to copy to my local machine. Not sure if that's possible or not.
OK, I went with the solution at github.com/wincent/clipper which works on my mac running macos 11.2.3.
The install instructions seem to be a little dated and are a bit confusing if you don't read them carefully. It took some trial and error to figure out how to get this working with vim on the remote machine:
Install with brew on your mac
Launch clipper as a daemon with brew services start clipper
On the remote machine, add the following line to your vimrc file:
nnoremap <leader>y :call system('nc -q 1 localhost 8377', #0)<CR>
Note: I had to add the -q 1 in there because I found vim would hang otherwise. The -q 1 arguments are not in the official documentation.
In your mac's ~/.ssh/config file:
Host *
RemoteForward 8377 localhost:8377
Make sure your remote server has port 8377 open!
On the remote machine, open a file with vim. Yank some lines. Then hit <leader>y.
Note: It took a while before it finally dawned on me that just <leader>y doesnt' work by itself. It's a two-step vim command process: 1) yank the text with a vim command 2) send the copied text to your mac with <leader>y.
That's it. My life feels so much better now. :)

Opening a project directory in PhpStorm from the Terminal

I want to open a project directory in PhpStorm using pstorm .
I am aware that there are many threads that have discussed this issue, but I have not been able to completely solve my problem with the solutions from those threads.
Using the IntelliJ Toolbox, I click the gear icon (top right) and I enable the Generate Shell Scripts option. I set the Shell script location to /usr/local/bin (which is in my PATH). The Shell Script Name is specified as pstorm.
The first issue is that the script isn't generated in /usr/local/bin. Presumably since the Toolbox doesn't have write privileges at that location. I then set it somewhere where it has write privileges - something like /home/username/.local/share/JetBrains/Toolbox/bin. The script is successfully generated there under pstorm:
# Generated by JetBrains Toolbox 1.20.7940 at 2021-03-24T16:55:42.325644
"/home/username/.local/share/JetBrains/Toolbox/apps/PhpStorm/ch-0/203.7148.74/bin/phpstorm.sh" "$#"
I then copy that file to /usr/local/bin: sudo cp pstorm /usr/local/bin
I then open a terminal and navigate to my desired directory, opening said directory in PhpStorm with pstorm .
PhpStorm then opens the directory. However, PhpStorm is then 'locked' as a child to the (parent) terminal instance and closing the terminal also closes PhpStorm. A more complete explanation relating to this behaviour is given here
I would really prefer that PhpStorm not be dependend on a terminal instance, much like when I run code . for VSCode.
Any ideas why it is doing this and how to 'solve' this behaviour?

Change directory in terminal using hyperlinks

Opening a gnome-terminal in the specified directory is straightforward:
gnome-terminal --working-directory ~/dotfiles
Creating hyperlinks is not a problem:
echo -e '\e]8;;file:///home/pmn/dotfiles\aThis is a link\e]8;;\a'
this produces a link that opens the file explorer in the correct folder when Ctrl+Clicked.
What I want to do is combine the two things, so that when I Ctrl+Click the link, a terminal pops up, already in the requested folder. It would not be a problem if the current terminal I'm in changed directory, but in that case I'd like to still see the previous terminal output and just do the equivalent of a regular cd (Edit: Note that the ~/dotfiles folder is just an example, I have several links that are generated by a script, and I'd like to be able to click on them to quickly open a terminal where needed).
I tried fiddling with registering custom applications:
In ~/.local/share/applications/mimeapps.list add:
(Note that the use of this file is deprecated, ~/.config/mimeapps.list should be used, if you have tips on doing that properly I'm open to them)
[Default Applications]
x-scheme-handler/mygnometerm=mygnometerm.desktop
In ~/.local/share/applications/mygnometerm.desktop add:
[Desktop Entry]
Type=Application
Terminal=false
Name=My Gnome Terminal
Exec=/bin/gnome-terminal --working-directory=%f
MimeType=x-scheme-handler/mygnometerm
Create the folder for the mime database:
mkdir -p ~/.local/share/mime/packages
Update the mime database:
update-mime-database ~/.local/share/mime
This does work: if I right-click on a folder in the file explorer and select My Gnome Terminal as the app to use, a terminal is opened already in the right folder.
If I print
echo -e '\e]8;;mygnometerm:///home/pmn/dotfiles\aThis is a link\e]8;;\a'
and click on the link, a terminal does pop up, but in the root folder, and the same happens when running
gio open mygnometerm:///home/pmn/dotfiles
I just need to combine everything, but I tried a lot of combination of what to echo in the link and could not find the right one.
I'm also open to other ways to achieve this behaviour, but at this point I'm quite curious in how to to it this way.
The use case, for the curious, is that I made a simple script to check the status of my repos, and I want to click on the ones with things to do without having to copy and paste the path. I reckon I'll save at least 5 seconds!
Cheers!

Permissions problem from running rsync through a keyboard shortcut

I have an Automator 'Quick Action' which simply runs a shell script (using bash) which comprises of a single rsync command. I've assigned a keyboard shortcut to this from System Preferences > Keyboard > Shortcuts.
Since updating to Catalina, I'm getting a permissions problem like shown in the second last comment here: https://developer.apple.com/forums/thread/126497.
Basically, I can run my rsync command in Terminal and it'll work fine. I can also open the Automator file and run it from there and it'll work fine. But running it from a keyboard shortcut throws the permissions error.
I've granted full disk access to both rsync and my quick action file, but to no effect. The last comment in that link mentions that you need to also grant full disk access to the program that calls your program (in their case it was cron), but I don't know what the calling program is in my case.

Putty shortcut command

I googled some but didn't seem to find the awnser there :p (if it is even possible)
I want to create a shortcut for Putty that when you start it, it will login and run a command called ftptop.
Do you guys know how? Or is this even possible? :p
I want to do this so I can overview all active FTP connections.
Also is there a command to just overview all incoming connections? (FTP, SQL etc)
I have recently made some putty shortcuts automation / ease of access on windows. This may help you guys.
create a folder XYZ in C:\User\%USERNAME%\XYZ
user must have Write access in this folder to avoid HostNotFound error
place putty.exe in it
place a text command_file.txt containing few commands i.e. ls -lrt; sleep 10; logoff
create a windows shortcut with following configuration:
Target : C:\User\%USERNAME%\XYZ\putty.exe -ssh Vm0000xxxx -m "C:\Users\%USERNAME%\command_file.txt -t -loghost "Terminal_Title"
Start in : C:\Users\%USERNAME%\XYZ
Icon : %USERPROFILE%\XYZ\icon.ico

Resources