how to copy and paste text directly from the terminal using keyboard and mouse without writing commands?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Do you mean a terminal as in a graphical terminal emulation program you run on your desktop to let you access the shell? On many desktops you can get to that with ctrl-alt-t There is also the console, which you can get to by ctrl-alt-f1 and so on. Returning from the terminal is usually ctrl-alt-f7
If you have a terminal then you can highlight the text to be copied, move the cursor with the keyboard and then press the middle key on the mouse to paste it in.
If you want to stay wholly within the shell for that, you can go to the beginning of what you want to copy and press ctrl-k That will cut from the cursor to the end of the line. Then you can move the cursor with the keyboard and press ctrl-y to paste in what was copied.
If you are using a terminal multiplexer like tmux (or screen) then there are a few more options.
You can try the Motif way: mark the desired portion of text with the left mouse button, move pointer to the destination, and paste with the middle mouse button. This method does not make use of a clipboard (but some graphic tools couple the marked text with a clipboard nevertheless).
Try gpm. It works both on text consoles and in X. When the gpm server is running, a block cursor linked to the mouse appears on your text console. Drag the mouse over text and it will be highlighted. Right-click and the highlighted text is copied to the current position of your typing cursor. You can use this to copy and paste between two text consoles too.
In an Xterm you don't see the block cursor, but you can still copy and paste without using the clipboard; in this case however, you need to middle-click, not right-click.
Adding to what Hazel stated. You can double click a word/phrase that will highlight the text. You can then pick a place with the left button then press your mouse wheel/middle button to place that marked text into place. 'man gpm';
Quote:
NAME
gpm - a cut and paste utility and mouse server for virtual consoles
SYNOPSIS
gpm [ options ]
DESCRIPTION
This package tries to be a useful mouse server for applications running on the Linux console. It is based on the "selection" package, and some of
its code comes from selection itself. This package is intended as a replacement for "selection" as a cut-and-paste mechanism; it also provides addi‐
tional facilities. The "selection" package offered the first cut-and-paste implementation for Linux using two mouse buttons, and the cut buffer is
still called "selection buffer" or just "selection" throughout this document. The information below is extracted from the texinfo file, which is
the preferred source of information.
The gpm executable is meant to act like a daemon (thus, gpmd would be a better name for it). This section is meant to describe the command-line
options for gpm, while its internals are outlined in the next section.
Due to restrictions in the ioctl(TIOCLINUX) system call, gpm must be run by the superuser. The restrictions have been added in the last 1.1 kernels
to fix a security hole related to selection and screen dumping.
The server can be configured to match the user's taste, and any application using the mouse will inherit the server's attitude. From release 1.02 up
to 1.19.2 is was possible for any user logged on the system console to change the mouse feeling using the -q option. This is no longer possible for
security reasons.
As of 0.97 the server program puts itself in the background. To kill gpm you can just reinvoke it with the -k cmdline switch, although killall gpm
can be a better choice.
SPECIAL COMMANDS
Version 1.10 adds the capability to execute special commands on certain circumstances. Special commands default to rebooting and halting the system,
but the user can specify his/her personal choice. The capability to invoke commands using the mouse is a handy one for programmers, because it
allows to issue a clean shutdown when the keyboard is locked and no network is available to restore the system to a sane state.
Special commands are toggled by triple-clicking the left and right button -- an unlikely event during normal mouse usage. The easiest way to triple-
click is pressing one of the buttons and triple-click the other one. When special processing is toggled, a message appears on the console (and the
speaker beeps twice, if you have a speaker); if the user releases all the buttons and presses one of them again within three seconds, then the spe‐
cial command corresponding to the button is executed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.