Copying text from linux to windows notepad - linux

I would like to know, how to copy the entire lines of text from vi editor in Redhat to a notepad in windows.
If the size of the text to be copied is minimal, it can be easily done by selecting the lines through mouse and copying to notepad. However I have come across the situation of copying thousands of lines.

I would rather use a file as the media, and use the sz -be coomand send the file to windows.As a suggestion, you can search google about rz/sz command for more details.

If i say straight forward answer then there is no way i guess,
but workaround is there,
Make a public share of samba (not more than 1 min)
Access from windows
Create empty file from windows
At Linux box run
cat {path_to_file_you_want_to_copy_content} >> /public/empty_file
for eg:
cat abc >> /public/empty.txt
Hope that resolves your problem.

If i say straight forward answer then there is no way i guess..,
but try below use cases..,
download and install winscp software and connect to your instance (your linux machine) using username and password. Then copy your files from linux to windows.
if your linux is a virtual machine (running on putty or vmware) using mouse you can directly copy the conent of file in vi editor in linux machine and paste in new or existed file in windows.

Related

IBM Mainframe copy/paste

Disclaimer: I'm new to using Rumba to access IBM Mainframe.
I have currently set up a library for personal use and I have some code that I want to store in a member of this library, how can I copy/paste from a .txt file on my desktop into this program??? As of right now I can successfully copy/paste one line at a time from documents outside of Rumba.
There are various ways. The best one will depend upon the size of the file/amount of data to be transferred.
If it's only a few lines, block copy and paste should work, but you might have to play with Rumba's 'paste' edit settings such as how to handle new lines, etc.
Bigger files can be transferred with the TSO file transfer program ind£file (maybe ind$file on your system) which essentially copies a file to the screen and then Rumba 'scrapes' the screen for data to put into a file (this is for a mainframe-to-PC transfer; for going the other way the operation is reversed). This can be surprisingly quick.
Lastly there's FTP - either from the command line or via a program such as WinSCP.
Edit:
Based on your comment that the files are about 300 lines long, I'd look into using Rumba's file-transfer option using the ind$file utility. Once you have the files on one system, speak to your mainframe tech support team about the best way to get them to the other systems.
If you need help uploading the files, then the tech support team should be your first point of call.
What mainframe editor are you running? TSO/ISPF?
I copy and and paste from ".txt" files into ISPS all the time with no problem.
Select the text you want to copy (in the ".txt" file)
Press CTRL-C
Open the mainframe file using ISPF Edit (option 2).
Enter line command "Inn" at the line where where you want the copy to start.
(This inserts "nn" empty lines to receive the copied data. Personally, I usually use "nn"=20)
Position your cursor at the first character of the first empty line.
Press CTRL-V

Linux emacs/nano: how to select all text lines in a larger file and copy

I need to copy all text in large log files to clipboard. I have a remote connection to Linux and use the console terminal only. What I want is something like Select all -> Copy.
In emacs I used F10 -> Edit -> Select All, and then F10 again -> Edit -> Copy. But it didn't go to my clipboard, unable to paste it in my local windows instance (which works fine with the content displayed on screen; without scrolling).
Is there a better way in nano or emacs?
Cheers
Emacs has a very under-publicized capability that could make your life easier. You can actually open files remotely via ssh, just as easily as a local file, and with very little overhead. So as long as you can copy to clipboard from your local emacs, you can do what you need.
To open a file remotely, just hit C-x C-f as usual. But the file you want is something like
/ssh:otherserver.some.org:/path/to/file.log
where otherserver.some.org is replaced by the actual server name and /path/to/file.log is your actual path. After the first connection, tab completion also works. Editing works exactly as it does with a local file (including copying), except that when you save, the file is copied back to the remote via ssh.
This facility is called "TRAMP", so there will be hidden buffers with "tramp" in their names. Also note that tramp can use several other methods to connect to files, such as plink for Windows, and su to edit files as another user.
Other options for your problem are discussed here:
Getting Items on the Local Clipboard from a Remote SSH Session, or maybe even here:
http://winscp.net/eng/docs/task_edit.
If you have just a terminal session, then there is no way for emacs, nano or any other program running on the Linux side to send text to the Windows clipboard.
Your options are to connect by X11 or VNC, in which case it becomes possible to share a clipboard between Windows and Linux programs, or to copy the file by some other means.
If you are logging in by ssh, you could for example run ssh thelinuxmachine cat /the/log/file/locatioin > logfile.txt in a windows command shell. Connecting to the linux machine using an scp client such as http://winscp.net/ would probably also work.

Unix programming to copy to clipboard

Any idea if i can use a unix command to copy text from a file in unix onto my clipboard?
I can't use xclip and xsel as my company doesn't allow me to install utils.
Hence i am wondering if there is any workaround
If anybody needs a background to what i am doing here goes:
I am using an excel macro to launch putty and then send commands to putty using the excel macro. Part of this process requires me to copy text or certain text to my clipboard and paste it in an active cell in my excel sheet.
It is unlikely that xclip or xsel would be useful here, unless you actually start an X application from PuTTY.
If your excel macros allow the capture of any command output, you could use Plink, the cli tool which is included in a full PuTTY installation. You still need to address any issues with remote access (creating and managing public/private keypairs for authentication.)
Check the PuTTY docs for more information.

Duplicate keyboard typing to another terminal

I have laptop-desktop setup at home and I have successfully cloned my Archlinux installation from one to another. However, I would like to avoid having to {install all new software, edit settings, update} twice, so I was wondering if it'd be possible to log over ssh from laptop to desktop, do something in terminal and have linux copy everything I type into second terminal with ssh logged in?
Thanks for ideas!
You could type the commands into one terminal then edit ~/.bash_history and save the commands into a script. Copy the script onto the machine with the second terminal and execute it. The advantage of this is now you have a script that saved your setup so you can reuse it whenever you need to.
You can use clusterssh, which duplicates your typed input across multiple systems. It is designed for situations in which the exact same tasks, such as software installation or configuration commands, are needed to be performed exactly the same on multiple systems. See http://sourceforge.net/projects/clusterssh/. Also, the KDE Konsole terminal has similar functionality.

How do I reveal a file as "selected" in *nix from the command line?

Is there a semi-universal mechanism by which to reveal files as selected in various *nix window managers via the command line? For example, in Windows I can say the following:
explorer.exe /select,C:\TestDir\TestFile.txt
…and Explorer will reveal the file and select it for you. In OS X I can say the following:
osascript -e 'Tell application "Finder" to reveal "MacHD:Users:myaccount:Desktop:filename.txt"'
…and it will do the same. My question is, is there any way to do the exact same thing (somewhat universally) in any of the various popular *nix flavors across window managers? Obviously "Open Containing Folder" is simple enough, but I want to go the extra step of actually opening it with the specific file selected. Any assistance is appreciated.
Best.
I don't about other file managers (other answers can add that) but for nautilus it's been recently fixed
This allows to call nautilus
uri:///path/to/file from the command
line to open uri:///path/to with file
pre-selected.
For OSX AppleScript works for all versions, but if you know you'll be dealing with 10.6 or later you'd be better served by using the -R option for "open". It's around 30 times faster.
open -R "/Volumes/Users/Desktop/file-to-open.txt"
For Linux Nautilus allows for direct calling of the file, a generic solution for GNOME (you won't find one for "Linux") is the "gnome-open" command, which currently could open the directory but won't highlight the file:
"gnome-open /tmp/file.txt"

Resources