LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-25-2007, 12:27 PM   #1
smp0219
LQ Newbie
 
Registered: Jan 2007
Posts: 3

Rep: Reputation: 0
How to copy/paste a line in nano editor


Hi,

I am new to using nano editor for editing files. I would like to know how to copy one or more lines of text and paste them elsewhere within the same file.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-25-2007, 12:31 PM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Move to the beginning of the line, press Ctrl + K and the line will be cut. Then move to the desired position and press Ctrl + U.

nano is rather limited, you may want to use something like gedit, which does allow using a mouse.

Last edited by jay73; 04-25-2007 at 01:12 PM.
 
1 members found this post helpful.
Old 04-25-2007, 01:05 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
There are some more options, but the syntax is non-intuitive. (ctrl-G for all the options)

nano is very handy a fast for simple things....
 
Old 12-08-2008, 02:34 PM   #4
Rotten
LQ Newbie
 
Registered: Dec 2008
Posts: 1

Rep: Reputation: 4
I found this thread and it helped me somewhat. I think what OP wants to do is 'copy' the line, not cut it. Therefore he/she should use 'ALT-6' to copy the current line into the buffer. You can copy as many lines as you like into the buffer, then use 'CTRL-U' to paste those lines. It's a little unintuitive in the NANO help, because for 'CTRL-U' it says 'uncut the line' which to some people actually means undo the last operation. I would prefer if the manual said 'PASTE the line'.

In summary:

'ALT-6' to copy a line (copy as many lines as you like, and they will be pasted in the order you copied them)

'CTRL-U' to paste the lines

Happy Nano-ing!

Last edited by Rotten; 12-08-2008 at 02:35 PM.
 
4 members found this post helpful.
Old 08-25-2009, 05:35 PM   #5
alexander_n
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Rep: Reputation: 4
Select - Copy - Paste

Select: ALT + M + A
Copy: ALT + 6
Paste: CTRL + U


Quote:
Originally Posted by Rotten View Post
I found this thread and it helped me somewhat. I think what OP wants to do is 'copy' the line, not cut it. Therefore he/she should use 'ALT-6' to copy the current line into the buffer. You can copy as many lines as you like into the buffer, then use 'CTRL-U' to paste those lines. It's a little unintuitive in the NANO help, because for 'CTRL-U' it says 'uncut the line' which to some people actually means undo the last operation. I would prefer if the manual said 'PASTE the line'.

In summary:

'ALT-6' to copy a line (copy as many lines as you like, and they will be pasted in the order you copied them)

'CTRL-U' to paste the lines

Happy Nano-ing!
 
4 members found this post helpful.
Old 01-03-2016, 11:16 AM   #6
gardo984
LQ Newbie
 
Registered: Jan 2016
Posts: 2

Rep: Reputation: Disabled
thankss!!!

Thank u very much man!! it help me a lot!! blessings!!
 
Old 01-03-2016, 11:17 AM   #7
gardo984
LQ Newbie
 
Registered: Jan 2016
Posts: 2

Rep: Reputation: Disabled
thanks!!

Quote:
Originally Posted by alexander_n View Post
Select: ALT + M + A
Copy: ALT + 6
Paste: CTRL + U
it help me alot!! thanks!!!
 
Old 01-03-2016, 06:40 PM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by smp0219 View Post
Hi,

I am new to using nano editor for editing files. I would like to know how to copy one or more lines of text and paste them elsewhere within the same file.
Nano me this
 
Old 07-24-2018, 02:30 PM   #9
rojinmroy
LQ Newbie
 
Registered: Jul 2018
Posts: 1

Rep: Reputation: Disabled
Replying to an old thread..
Just in case it helps someone.
may be your distro terminal shortcut works for pasting lines into the nano editor.
On ubuntu I use Ctrl+Shift+v to paste in the nano editor.
 
Old 07-24-2018, 02:57 PM   #10
m.a.l.'s pa
Member
 
Registered: Oct 2007
Location: albuquerque
Distribution: Debian, Arch, Kubuntu
Posts: 366

Rep: Reputation: 139Reputation: 139
Here with nano (tried just now in Fluxbox, Debian Stretch), I can also simply select the text with the cursor, then use the middle mouse button to paste the selected text.
 
Old 08-06-2019, 03:24 PM   #11
xbaez
Member
 
Registered: Mar 2004
Location: USA
Distribution: Ubuntu
Posts: 291

Rep: Reputation: 30
Quote:
Originally Posted by alexander_n View Post
Select: ALT + M + A
Copy: ALT + 6
Paste: CTRL + U
Thank you that was so helpful.
 
  


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 not cut in the nano text editor jxrod2000 Linux - Software 16 06-05-2011 04:21 AM
How to copy-paste on command line? jameshao Linux - General 3 02-02-2009 01:14 AM
Which light text editor can copy text from file and paste in browser? davidas Linux - Software 9 03-06-2006 11:28 AM
How do you copy and paste a line in VI? Thaidog Linux - General 3 05-08-2005 05:46 AM
Copy Paste under command line? Stingreen Linux - General 7 02-10-2002 06:46 PM

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

All times are GMT -5. The time now is 11:56 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