Copying blocks of text in terminal
up vote
16
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
add a comment |
up vote
16
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
How did you generate the entire block of text? In other words, what command did you use to get that info?
– Allan
17 hours ago
add a comment |
up vote
16
down vote
favorite
up vote
16
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
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
New contributor
edited 24 mins ago
Monomeeth♦
45.1k795137
45.1k795137
New contributor
asked 17 hours ago
Mended
813
813
New contributor
New contributor
How did you generate the entire block of text? In other words, what command did you use to get that info?
– Allan
17 hours ago
add a comment |
How did you generate the entire block of text? In other words, what command did you use to get that info?
– Allan
17 hours ago
How did you generate the entire block of text? In other words, what command did you use to get that info?
– Allan
17 hours ago
How did you generate the entire block of text? In other words, what command did you use to get that info?
– Allan
17 hours ago
add a comment |
3 Answers
3
active
oldest
votes
up vote
19
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
13 hours ago
@jmh See my answer.
– Konrad Rudolph
9 hours ago
@KonradRudolph ok, thanks...
– jmh
8 hours ago
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
Or justcut -c 56-
or so.
– Wildcard
1 hour ago
add a comment |
up vote
5
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 |
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',
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
19
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
13 hours ago
@jmh See my answer.
– Konrad Rudolph
9 hours ago
@KonradRudolph ok, thanks...
– jmh
8 hours ago
add a comment |
up vote
19
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
13 hours ago
@jmh See my answer.
– Konrad Rudolph
9 hours ago
@KonradRudolph ok, thanks...
– jmh
8 hours ago
add a comment |
up vote
19
down vote
up vote
19
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 17 hours ago
answered 17 hours ago
Monomeeth♦
45.1k795137
45.1k795137
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
13 hours ago
@jmh See my answer.
– Konrad Rudolph
9 hours ago
@KonradRudolph ok, thanks...
– jmh
8 hours ago
add a comment |
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
13 hours ago
@jmh See my answer.
– Konrad Rudolph
9 hours ago
@KonradRudolph ok, thanks...
– jmh
8 hours ago
2
2
This doesn't work in iTerm but works fine in Terminal.
– jmh
13 hours ago
This doesn't work in iTerm but works fine in Terminal.
– jmh
13 hours ago
@jmh See my answer.
– Konrad Rudolph
9 hours ago
@jmh See my answer.
– Konrad Rudolph
9 hours ago
@KonradRudolph ok, thanks...
– jmh
8 hours ago
@KonradRudolph ok, thanks...
– jmh
8 hours ago
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
Or justcut -c 56-
or so.
– Wildcard
1 hour ago
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
Or justcut -c 56-
or so.
– Wildcard
1 hour ago
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 14 hours ago
Vinnie James
1765
1765
Or justcut -c 56-
or so.
– Wildcard
1 hour ago
add a comment |
Or justcut -c 56-
or so.
– Wildcard
1 hour ago
Or just
cut -c 56-
or so.– Wildcard
1 hour ago
Or just
cut -c 56-
or so.– Wildcard
1 hour ago
add a comment |
up vote
5
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
5
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
5
down vote
up vote
5
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 9 hours ago
Konrad Rudolph
1,16221026
1,16221026
add a comment |
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
How did you generate the entire block of text? In other words, what command did you use to get that info?
– Allan
17 hours ago