LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 08-23-2017, 01:58 AM   #1
sandyiitism
LQ Newbie
 
Registered: Aug 2017
Posts: 2

Rep: Reputation: Disabled
Smile how to copy and paste text directly from the terminal using keyboard and mouse without writing commands?


newbie
 
Old 08-23-2017, 02:30 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,565
Blog Entries: 4

Rep: Reputation: 3861Reputation: 3861Reputation: 3861Reputation: 3861Reputation: 3861Reputation: 3861Reputation: 3861Reputation: 3861Reputation: 3861Reputation: 3861Reputation: 3861
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.
Old 08-23-2017, 03:05 AM   #3
Kirppu21
LQ Newbie
 
Registered: Aug 2017
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by sandyiitism View Post
newbie
I usually just ctrl+shift+c after highlighting with a mouse and paste ctrl+shift+v
 
1 members found this post helpful.
Old 08-23-2017, 06:17 AM   #4
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Distribution: Mint/MATE
Posts: 2,949

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
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.
Old 09-02-2017, 07:15 AM   #5
sweepnine
LQ Newbie
 
Registered: Jun 2017
Posts: 16

Rep: Reputation: Disabled
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.
 
Old 09-02-2017, 07:24 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,970
Blog Entries: 19

Rep: Reputation: 4623Reputation: 4623Reputation: 4623Reputation: 4623Reputation: 4623Reputation: 4623Reputation: 4623Reputation: 4623Reputation: 4623Reputation: 4623Reputation: 4623
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.
 
Old 09-02-2017, 09:07 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,956
Blog Entries: 46

Rep: Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to copy and paste text directly from the terminal? sandyiitism Linux - Newbie 2 08-23-2017 07:20 AM
gnome-terminal opened for months looses mouse copy-paste kaza Red Hat 1 10-22-2012 02:01 AM
command to emulate the 'rich text copy-paste' event of mouse??? SIG_SEGV Linux - General 1 08-18-2012 07:32 PM
Is there terminal program that supports copy&paste with keyboard (read for specifics) robsku Linux - Desktop 1 08-18-2009 02:11 AM
Which light text editor can copy text from file and paste in browser? davidas Linux - Software 9 03-06-2006 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration