Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
08-23-2017, 01:58 AM
|
#1
|
LQ Newbie
Registered: Aug 2017
Posts: 2
Rep:
|
how to copy and paste text directly from the terminal using keyboard and mouse without writing commands?
newbie
|
|
|
08-23-2017, 02:30 AM
|
#2
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,565
|
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.
|
|
1 members found this post helpful.
|
08-23-2017, 03:05 AM
|
#3
|
LQ Newbie
Registered: Aug 2017
Posts: 1
Rep:
|
Quote:
Originally Posted by sandyiitism
newbie
|
I usually just ctrl+shift+c after highlighting with a mouse and paste ctrl+shift+v
|
|
1 members found this post helpful.
|
08-23-2017, 06:17 AM
|
#4
|
Senior Member
Registered: Dec 2011
Location: Simplicity
Distribution: Mint/MATE
Posts: 2,949
|
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).
|
|
1 members found this post helpful.
|
09-02-2017, 07:15 AM
|
#5
|
LQ Newbie
Registered: Jun 2017
Posts: 16
Rep:
|
In case you want to copy an argument of a previous command you can use the alt-dot-thing.
Assume before you did this.
Code:
cp /mnt/some/thing /tmp/right/here
Now you want changed permission on the second argument of the cp call. Then type
Code:
chmod u+x <alt>-2-.
It becomes
Code:
chmod u+x /tmp/right/here
However, if there were other commands inbetween your need press an extra dot for each of them. For example
Code:
chmod u+x <alt>-2-.-.-.
if there were two command between the cp and the chmod call.
Last edited by sweepnine; 09-02-2017 at 05:03 PM.
|
|
|
09-02-2017, 07:24 AM
|
#6
|
LQ Guru
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,970
|
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.
|
|
|
09-02-2017, 09:07 AM
|
#7
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,956
|
Member response
Hi,
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.
|
Look at this thread for additional commands; 20 Linux Command Tips and Tricks That Will Save You A Lot of Time
Hope this helps.
Have fun & enjoy!
|
|
|
All times are GMT -5. The time now is 12:24 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|