Link to home
Create AccountLog in
Avatar of cofactor
cofactor

asked on

how to copy text in clipboard

I connect to a Linux server using putty. Is there any way to copy entire content of text file in clipboard ?

I know, putty has a menu "Copy All to Clipboard" . That  works . But  however if the text file is big and does not fit in the putty screen  then I dont get the entire text file content in clipboard.

 Is there any way to copy entire text content  in clipboard ?

Avatar of torimar
torimar
Flag of Germany image

I don't think this is possible.

Depending on what you are trying to do, have you ever checked out WinSCP? :: http://winscp.net/eng/index.php

It offers customizable options to open a remote file locally for editing; it also imports you putty settings and will let you open a putty window alongside WinSCP so that you get the best of both worlds.
Avatar of rindi
You can use cat to list the contents of the file, then use "Copy all to Clipboard" in putty. That has worked for me.
Avatar of cofactor
cofactor

ASKER

>>>>Depending on what you are trying to do, have you ever checked out WinSCP?
Yes. I use WinSCP  many times.

But this time it wont be of any help.

with PUTTY , I connect to a Gateway Linux box (public ) and from there I connect to another linux box (private) through SSH .

I can not connect directly to private box from WinSCP.  and so WinScp wont be of much help here.

So, I am looking for a Putty solution.
>>>>You can use cat to list the contents of the file, then use "Copy all to Clipboard" in putty. That has worked for me.

already tried. this does not work.

If your file size is big , then "Copy all to Clipboard"  copies only whatever is seen in putty screen ..rest is not copied.
If there is a GUI version of an Editor installed you can try using that with X-Forwarding on and XMing loaded on your Windows PC. I'm not sure though if this will work when connecting the way you have. But it may be worth a try. If there is no GUI text editor installed install one with your package manager.
>>>If there is a GUI version of an Editor installed

How to check that ? What command I should fire from putty  to check whether there is a GUI version installed or not ?
>>>with PUTTY , I connect to a Gateway Linux box (public ) and from there I connect to another linux >box (private) through SSH .

I  can connect to Gateway Linux box using WinSCP.  But I  can not connect to another linux box (private)  directly from WinSCP..

Do you see any chance using WinSCP here to get the contents from another linux box (private)  ?
Depends on the GUI installed on the Remote PC. Try nedit, and if it isn't installed, install it using your package manager. Nedit is a pretty lean editor.
>>>>Try nedit, and if it isn't installed, install it using your package manager.

I tried nedit.  its not installed.  

I'm not the administrator and at this moment I wont get any administrative help.

I typed  uname -a  

It prints  Ubuntu linux.

Is it of any help to solve my issue ?
Try gedit. If it uses gnome that should be installed on it. But it's just a remote chance that it'll work. The gateway will probably not let X Windows to pass to your PC. Also make sure you have an X-Windows installed on your local PC, like xming that I mentioned.
>>>Try gedit. If it uses gnome that should be installed on it.

gedit not installed.
Then there is probably no GUI installed on the PC.
My purpose is, I have a file in Ubuntu server  . I have the same file in Local box . I just  want to compare these files to see if there is any change in text and what change.

I can download the file to local box using put  command ...no problem....But I am looking for a quick solution instead of downloading the file every time typing command  ...its painful.

How can I make this job simpler ?  what are other alternative options ?
Hello cofactor,

you might be intrested in sshfs. It's a ssh program you can mount the ubuntu servers filesystem on your local machine via ssh. Than you can edit the files on the remove ubuntu server as if it was on your local machine and do all the stuff like diff, sdiff or even gui commands like gedit.

http://fuse.sourceforge.net/sshfs.html

thanks
@Jelcin

Is not that  link  installing the package in ubuntu server ? that requires administrative access to  the ubuntu server.  I can not do that . I'm not Administrator.
This is a filesystem client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: i.e. on the server side there's nothing to do.  On the client side mounting the filesystem is as easy as logging into the server with ssh.

it should work without admin access on the server since you just need to install sshfs on your local machine. The most ssh servers already have built in the command needed to use sshfs.

and you can even tunnel over two machines like this

localmachine <---> box1 <----> box2
but am not sure if sshfs will work over an ssh tunnel since both are ssh - never tried that...

here is a link how to setup an ssh tunnel over two machines

http://www.linuxquestions.org/questions/linux-newbie-8/ssh-tunnel-through-2-machines-564389/

over ssh tunnel you should be able to use any programm you like...
>>>>you just need to install sshfs on your local machine.

My  localmachine   is   windows server 2003 Edition
 I see your installation file  http://sourceforge.net/projects/fuse/files/sshfs-fuse/    is  sshfs-fuse-2.3.tar.gz

Is not this a linux installer ?  Where is the windows installer ?
ahh ok sorry :/

than you could use VM with linux on it or have a look at these two projects:

http://blog.markusbordihn.de/2009/04/sshfs-under-windows.html

http://winscp.net/eng/index.php

but i don't know exactly how they integrate with windows. At least WinSCP should integrate with windows Explorer if i read everything right.

thanks and sorry again
>>>At least WinSCP should integrate with windows Explorer if i read everything right.

I already have WinSCP . how does it ssh tunnel over two machines ? I can connect to box1  using WinSCP ....but then how to box2 ?

Please tell me steps to check it out.
Hello,

localhost------->proxy------>target

you need to use putty from Windows cmd:

putty proxy-ip -L your-port:target-ip:22

than you need to login to the proxy machine

than start WinSCP and connect via SCP protocol

but for ip type in "localhost" and for port type in "your-port"

than you need to login to the target machine

as an example:

putty 192.168.178.26 -L 54321:88.198.14.114:22

in WinSCP type in "localhost" for ip and "54321" for port

thanks

Could you please explain these terms.


>>>putty proxy-ip -L your-port:target-ip:22

I guess

proxy-ip = IP of Box1

 your-port = is it any port I can choose ?  

target-ip= IP of Box2


Where do I  keep the privatepublick.ppk  file now ?normally ,  I connect to gateway box1  with a privatepublick.ppk in putty window.  If I use cmd  , then how does this privatepublick.ppk be used ?  Is it not required ?
The easiest way is to into the PuTTY Configuration under Session -> Logging and turn on session logging (All session output).  Then you type the file on the host and turn off the logging.  The output is in the putty.log file (or whatever you set the logging to go to).
The other alternative is to change the number of lines in PuTTY for the scrollback (scrollbar) to something large enough to capture your file.  It is in the PuTTY configuration under 'Window'.
hello,

with putty on the command line you can use the option "-i yourkeyfile" to specify your private key.
But you can also do the ssh tunnel in the menu. But it's simpler to explain with cmd options.
If you want me to take screen shots how to do the ssh tunnel in the Putty GUI let me know.

thanks
>>>how to do the ssh tunnel in the Putty GUI let me know.

Yes. Please.  

IF I do that then I can use WinSCP with localhost login ..right ?  

(For your information , I connect to box1 and box2 with port 2020 )
>>>The easiest way is to into the PuTTY Configuration under Session -> Logging and turn on session >>>logging (All session output).

Interesting . Will check this out and share the experience here.
ASKER CERTIFIED SOLUTION
Avatar of Josef Pospisil
Josef Pospisil
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
An update to using the Putty Log.  I have tested using it with Windows 7 and if you create the file in C:\ it will create the file, but you won't have access to it (maybe as Administrator).

Better to create the file in your My Documents directory (C:\Users\username\Documents\putty.log).  That would be a different directory for XP.

Get to the PuTTY Configuration screen by right-clicking the top of the window and doing "Change Settings..."  You will need to turn off logging the same way (or close the window) to cause the file to close and data to be written.  To do the comparison, you will need to edit the file to take out the "=~= PuTTY log  =~=~" at the top and the commands you issued.
@Jelcin

This is working!  ..you are truly a master :)

Just have a small question.  Is it that I have to keep open the putty window(I guess  this makes the connectivity)   before opening up WinSCP always ?

What I did was, I opened up putty window and then WinSCP ...then it works.   Is it not possible to save this tunneling settings right inside  WinSCP itself  ?

Well, I can afford this much though ...no problem.
Worked fine.