Copying blocks of text in terminal
up vote
22
down vote
favorite
Is it possible to copy a "block" of text from a terminal window without having to copy entire lines?
Example:

Say I just wanna copy the text I’ve circled in the image above, is this possible? Or do I also have to copy everything to the left of the block I want to copy?
macos terminal copy-paste
New contributor
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
22
down vote
favorite
Is it possible to copy a "block" of text from a terminal window without having to copy entire lines?
Example:

Say I just wanna copy the text I’ve circled in the image above, is this possible? Or do I also have to copy everything to the left of the block I want to copy?
macos terminal copy-paste
New contributor
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
22
down vote
favorite
up vote
22
down vote
favorite
Is it possible to copy a "block" of text from a terminal window without having to copy entire lines?
Example:

Say I just wanna copy the text I’ve circled in the image above, is this possible? Or do I also have to copy everything to the left of the block I want to copy?
macos terminal copy-paste
New contributor
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Is it possible to copy a "block" of text from a terminal window without having to copy entire lines?
Example:

Say I just wanna copy the text I’ve circled in the image above, is this possible? Or do I also have to copy everything to the left of the block I want to copy?
macos terminal copy-paste
macos terminal copy-paste
New contributor
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited Dec 15 at 3:49
Monomeeth♦
45.3k796137
45.3k796137
New contributor
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Dec 14 at 10:38
Mended
1113
1113
New contributor
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
27
down vote
You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.
See screenshot below:

If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
Dec 14 at 15:14
add a comment |
up vote
7
down vote
When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.
Or you can use copy mode:
Cmd+Shift+C to enter copy mode
Ctrl+v to enter vertical/block mode- Move the cursor using the cursor keys on the keyboard (see link for more movement options)
- Once you’re done, use Ctrl+k, y to copy the selection.
add a comment |
up vote
6
down vote
You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy
2
Or justcut -c 56-or so.
– Wildcard
Dec 15 at 2:46
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "118"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Mended is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f345611%2fcopying-blocks-of-text-in-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
27
down vote
You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.
See screenshot below:

If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
Dec 14 at 15:14
add a comment |
up vote
27
down vote
You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.
See screenshot below:

If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
Dec 14 at 15:14
add a comment |
up vote
27
down vote
up vote
27
down vote
You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.
See screenshot below:

If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.
You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.
See screenshot below:

If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.
edited Dec 14 at 11:07
answered Dec 14 at 10:40
Monomeeth♦
45.3k796137
45.3k796137
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
Dec 14 at 15:14
add a comment |
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
Dec 14 at 15:14
2
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
Dec 14 at 15:14
This doesn't work in iTerm but works fine in Terminal.
– jmh
Dec 14 at 15:14
add a comment |
up vote
7
down vote
When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.
Or you can use copy mode:
Cmd+Shift+C to enter copy mode
Ctrl+v to enter vertical/block mode- Move the cursor using the cursor keys on the keyboard (see link for more movement options)
- Once you’re done, use Ctrl+k, y to copy the selection.
add a comment |
up vote
7
down vote
When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.
Or you can use copy mode:
Cmd+Shift+C to enter copy mode
Ctrl+v to enter vertical/block mode- Move the cursor using the cursor keys on the keyboard (see link for more movement options)
- Once you’re done, use Ctrl+k, y to copy the selection.
add a comment |
up vote
7
down vote
up vote
7
down vote
When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.
Or you can use copy mode:
Cmd+Shift+C to enter copy mode
Ctrl+v to enter vertical/block mode- Move the cursor using the cursor keys on the keyboard (see link for more movement options)
- Once you’re done, use Ctrl+k, y to copy the selection.
When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.
Or you can use copy mode:
Cmd+Shift+C to enter copy mode
Ctrl+v to enter vertical/block mode- Move the cursor using the cursor keys on the keyboard (see link for more movement options)
- Once you’re done, use Ctrl+k, y to copy the selection.
answered Dec 14 at 18:17
Konrad Rudolph
1,18221026
1,18221026
add a comment |
add a comment |
up vote
6
down vote
You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy
2
Or justcut -c 56-or so.
– Wildcard
Dec 15 at 2:46
add a comment |
up vote
6
down vote
You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy
2
Or justcut -c 56-or so.
– Wildcard
Dec 15 at 2:46
add a comment |
up vote
6
down vote
up vote
6
down vote
You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy
You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy
answered Dec 14 at 13:23
Vinnie James
1845
1845
2
Or justcut -c 56-or so.
– Wildcard
Dec 15 at 2:46
add a comment |
2
Or justcut -c 56-or so.
– Wildcard
Dec 15 at 2:46
2
2
Or just
cut -c 56- or so.– Wildcard
Dec 15 at 2:46
Or just
cut -c 56- or so.– Wildcard
Dec 15 at 2:46
add a comment |
Mended is a new contributor. Be nice, and check out our Code of Conduct.
Mended is a new contributor. Be nice, and check out our Code of Conduct.
Mended is a new contributor. Be nice, and check out our Code of Conduct.
Mended is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Different!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f345611%2fcopying-blocks-of-text-in-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown