Copy and Paste Without Mouse in Console Editors
For a general overview of copy and paste in Linux, visit this page.
Joe
In joe to copy and paste, you must first mark the block. This is similar to
hilighting with the mouse.
- Move the cursor to the beginning of the text you wish to highlight
- Press “Ctrl-k b” (for beginning).
- Move the cursor to the end of the text you wish to copy
- Press “Ctrl-k k”.
- Move the cursor to the spot where you wish to copy the text to
- Press “Ctrl-k c” for copy).
If you press “Ctrl-k m” instead, you move the text rather than simply copying it.
You can open more than one file in joe and copy and paste from one file to
the next.
- Open both files: ‘joe file1 file2’
- There will be a split screen with one file in each.
- Press “Ctrl-k n” to move down to the next window
- Press “Ctrl-k p” to move up to the previous window
- Mark the block of text you want to copy. Move to the other file and paste.
Another sort of copy and paste is to insert a file into the current text.
- Press “Ctrl-k r” followed by the name of the file.
The contents of the file will be placed at the cursor of the file you are editing.
Vi/Vim
With vi you do “yank” and “put.” When you open the file in vi, you are in command mode. If you have already entered Insert mode prior to the copy and paste, you will need to first go into Command mode again. ESC key gets you there.
- Go to the line you want to begin copying
- Count the number of lines you want to copy
- Type ‘#y’ where # is the number of lines to ‘yank’ or copy the lines.
- Move the cursor to where you want to paste and type “p” for put (paste).
In vi you can have more than one file open at a time in split windows. That way you can yank and paste from one file to another.
- Open your files “vi file1 file2”
- Make a new windows “Ctrl-W, n”.
- That puts you into the new window which is blank.
- Open up the other file in that window with “:n” (new file).
To copy and paste from one file to the other
- Move from window to window with “Ctrl-W, W”
- Yank the text you want
- Go to the file you want to put it in
- Type “p” to paste it into the other file.
Emacs
My favorite way of copying text in emacs is by means of the “kill-ring”.
To delete a line in emacs, press ctrl-k (“kill”). Press it twice, and the cr/lf-character that marks the line-end will also be killed. But the data you kill is not discarded right away. It is stored in the so called “kill-ring”. Thus you can think of it as the “cut” command in GUI-applications.
Ctrl-y (“yank”) then inserts the contents of the kill-ring into the file at the current cursor position. You can yank the same kill-ring multiple times at different positions in the file.
The kill-ring is emptied if you kill something after moving the cursor.
After a short while of practicing, you will be able to perform cut, copy and paste operations just as quick as with the mouse in a GUI.
There is a way of marking regions and cut/copy/paste them in emacs, but I never use them. I just love the kill-ring. :)
Copyright (c) by the authors.
Prior to editing, authors agreed to license their contributions by the terms of the GPL.
See our licensing page for details.
Linux® is a registered trademark of Linus Torvalds.
Welcome to LinuxBasics.org - The online community that helps people to get Linux installed and running.
During this tour, we will guide you through our website, which has many facets which wait to be explored
The biggest project we are running is our Linux course, based on the LBook.
The book is stored in wiki-format, which enables us to update and correct it as we go.
Discussion for the course is on our Forum
Our Forum is used for discussion of Linux and for questions and answers.
Search the mailing-list that was used prior to the Forum.
The questions and answers from the list are stored in the list's archives in order to help others with the same problems.
Every weekend, we meet to chat in IRC. These meetings are NOT mandatory, but are a nice chance to get to know each other better.
IRC is also a great tool to solve many problems, since it is very quick and easy to ask for more details if you need them.
The tutorials are one of the oldest sections on the LBo-website.
Here you find explanations on how to do specific tasks in Linux. Many of the tutorials were created after a certain problem
has been discussed (and usually solved :) on the mailing-list.
The tutorials are categorized in
In the links section, you find outbound links to other valuable resources.
One of our later additions to the site. We maintain a mirror of the Linux Documentation Project. This is our contribution to the "home of the HOWTOs"
Another later addition is the LBlog which focuses on how to do stuff on the Linux Desktop. It begins with the basics on installing Ubuntu.
Using the integrated site-search, you can search the tutorials, the LBook and all other wiki-pages
Simply type the search term into the box in the upper-right corner of our webpages
As a community, we depend on your feedback and collaboration. So, if you have something to share with others, please contact us. If you have a suggestion for a topic you would like to see covered here, please add it on the Wishlist.
There are many ways to contribute: You can answer questions on the Forum, you can write a complete tutorial or just a step-by-step documentation on how you completed a specific task using linux. Ask questions if the information on this site is not clear, tell us if we got something wrong, spell-check our writings, whatever.
We are looking forward to meeting you at LinuxBasics.org
Anita, Jisao, Sam and Stefan