Why (and how) did using cat on binary files mess up the terminal?What can cause my shell to look like...
Is floating in space similar to falling under gravity?
Did airlines fly their aircraft slower in response to oil prices in the 1970s?
Select row of data if next row contains zero
The qvolume of an integer
If Sweden was to magically float away, at what altitude would it be visible from the southern hemisphere?
Why does the UK have more political parties than the US?
Why use water tanks from a retired Space Shuttle?
If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?
Mother abusing my finances
Thousands and thousands of words
How should I push back against my job assigning "homework"?
What are the slash markings on Gatwick's 08R/26L?
Points within polygons in different projections
Can an old DSLR be upgraded to match modern smartphone image quality
How can I grammatically understand "Wir über uns"?
What does the 0>&1 shell redirection mean?
Is there an evolutionary advantage to having two heads?
Is this light switch installation safe and legal?
How did early x86 BIOS programmers manage to program full blown TUIs given very few bytes of ROM/EPROM?
Can non-English-speaking characters use wordplay specific to English?
Is it possible to change original filename of an exe?
What is game ban VS VAC ban in steam?
Understanding STM32 datasheet regarding decoupling capacitors
How was Apollo supposed to rendezvous in the case of a lunar abort?
Why (and how) did using cat on binary files mess up the terminal?
What can cause my shell to look like this?Diff of PDF files leaves garbage on next command lineBinary Output from CurlWhy running `cat /etc/localtime` on PuTTY puts a stream of “PuTTY” in the prompt?Why does “head /bin/ls” reset the terminalJumbled interface due to reading binary files in screenColorized `cat` for source and script files?Cannot merge files using catHow to prevent random console output from breaking the terminal?Why does “head /bin/ls” reset the terminalDynamically extract comments from files using catHow are binary files “binary”?What is the difference in using Ctrl+D and Ctrl+C to terminate cat command?How to reverse the content of binary file?Why the output of “cat a.out” is some weird text, instead of binary?How should I output the contents of a file to terminal without using cat?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
If I understand the cat
manual correctly:
concatenate files and print on the standard output
cat
will take files as argument and print them on standard output.
What I don't get is if I use the command:
cat img.png > copy.png
I will obtain 2 png files identical while if I just
cat img.png
I have all chance that my terminal get messed up and misinterpret what I type.
- How's that possible?
- Binary values are still binary data. Why it does not simply shows a series of 0 and 1 or the interpretation of those binary data in ASCII or whatever the encoding in terminal is?
- Is this behavior also possible by
cat
ing a text file containing strange characters? - Should a mechanism to prevent this behavior like try{}catch{} statement should be implemented?
terminal cat binary
add a comment |
If I understand the cat
manual correctly:
concatenate files and print on the standard output
cat
will take files as argument and print them on standard output.
What I don't get is if I use the command:
cat img.png > copy.png
I will obtain 2 png files identical while if I just
cat img.png
I have all chance that my terminal get messed up and misinterpret what I type.
- How's that possible?
- Binary values are still binary data. Why it does not simply shows a series of 0 and 1 or the interpretation of those binary data in ASCII or whatever the encoding in terminal is?
- Is this behavior also possible by
cat
ing a text file containing strange characters? - Should a mechanism to prevent this behavior like try{}catch{} statement should be implemented?
terminal cat binary
2
Your terminal does not get messed up. It is in a state you forced it into by sending it control characters. That you cannot use it any more after changing the state might not be what you wanted, but it is entirely a result of you not understanding the consequences of your actions. That would be the same as switching your font color to green in a word processor and saying your word processor is messed up, only because you don't know how to switch it back to black font without e.g. exiting the program.
– Anthon
Mar 13 '14 at 10:30
4
areset
command might help sometimes, but this is no miracle solution.
– Ouki
Mar 13 '14 at 10:47
The actual sequence to type is Control-J reset Control-J. Almost always restores sanity.
– Joshua
Jan 1 '15 at 18:02
1
@Joshua And what's the difference between a lonereset
and areset
between Ctrl-J keypresses? I can't see any (nor any reason to go the more complicated way)
– syntaxerror
Jan 2 '15 at 1:56
1
Because if the terminal was left in RAW mode, Enter generates Ctrl-M instead of Ctrl-J so the shell doesn't see the necessary keystroke to end a line and run the command.
– Joshua
Jan 2 '15 at 3:37
add a comment |
If I understand the cat
manual correctly:
concatenate files and print on the standard output
cat
will take files as argument and print them on standard output.
What I don't get is if I use the command:
cat img.png > copy.png
I will obtain 2 png files identical while if I just
cat img.png
I have all chance that my terminal get messed up and misinterpret what I type.
- How's that possible?
- Binary values are still binary data. Why it does not simply shows a series of 0 and 1 or the interpretation of those binary data in ASCII or whatever the encoding in terminal is?
- Is this behavior also possible by
cat
ing a text file containing strange characters? - Should a mechanism to prevent this behavior like try{}catch{} statement should be implemented?
terminal cat binary
If I understand the cat
manual correctly:
concatenate files and print on the standard output
cat
will take files as argument and print them on standard output.
What I don't get is if I use the command:
cat img.png > copy.png
I will obtain 2 png files identical while if I just
cat img.png
I have all chance that my terminal get messed up and misinterpret what I type.
- How's that possible?
- Binary values are still binary data. Why it does not simply shows a series of 0 and 1 or the interpretation of those binary data in ASCII or whatever the encoding in terminal is?
- Is this behavior also possible by
cat
ing a text file containing strange characters? - Should a mechanism to prevent this behavior like try{}catch{} statement should be implemented?
terminal cat binary
terminal cat binary
edited 1 hour ago
muru
38.5k592168
38.5k592168
asked Mar 13 '14 at 9:54
KiwyKiwy
6,31753862
6,31753862
2
Your terminal does not get messed up. It is in a state you forced it into by sending it control characters. That you cannot use it any more after changing the state might not be what you wanted, but it is entirely a result of you not understanding the consequences of your actions. That would be the same as switching your font color to green in a word processor and saying your word processor is messed up, only because you don't know how to switch it back to black font without e.g. exiting the program.
– Anthon
Mar 13 '14 at 10:30
4
areset
command might help sometimes, but this is no miracle solution.
– Ouki
Mar 13 '14 at 10:47
The actual sequence to type is Control-J reset Control-J. Almost always restores sanity.
– Joshua
Jan 1 '15 at 18:02
1
@Joshua And what's the difference between a lonereset
and areset
between Ctrl-J keypresses? I can't see any (nor any reason to go the more complicated way)
– syntaxerror
Jan 2 '15 at 1:56
1
Because if the terminal was left in RAW mode, Enter generates Ctrl-M instead of Ctrl-J so the shell doesn't see the necessary keystroke to end a line and run the command.
– Joshua
Jan 2 '15 at 3:37
add a comment |
2
Your terminal does not get messed up. It is in a state you forced it into by sending it control characters. That you cannot use it any more after changing the state might not be what you wanted, but it is entirely a result of you not understanding the consequences of your actions. That would be the same as switching your font color to green in a word processor and saying your word processor is messed up, only because you don't know how to switch it back to black font without e.g. exiting the program.
– Anthon
Mar 13 '14 at 10:30
4
areset
command might help sometimes, but this is no miracle solution.
– Ouki
Mar 13 '14 at 10:47
The actual sequence to type is Control-J reset Control-J. Almost always restores sanity.
– Joshua
Jan 1 '15 at 18:02
1
@Joshua And what's the difference between a lonereset
and areset
between Ctrl-J keypresses? I can't see any (nor any reason to go the more complicated way)
– syntaxerror
Jan 2 '15 at 1:56
1
Because if the terminal was left in RAW mode, Enter generates Ctrl-M instead of Ctrl-J so the shell doesn't see the necessary keystroke to end a line and run the command.
– Joshua
Jan 2 '15 at 3:37
2
2
Your terminal does not get messed up. It is in a state you forced it into by sending it control characters. That you cannot use it any more after changing the state might not be what you wanted, but it is entirely a result of you not understanding the consequences of your actions. That would be the same as switching your font color to green in a word processor and saying your word processor is messed up, only because you don't know how to switch it back to black font without e.g. exiting the program.
– Anthon
Mar 13 '14 at 10:30
Your terminal does not get messed up. It is in a state you forced it into by sending it control characters. That you cannot use it any more after changing the state might not be what you wanted, but it is entirely a result of you not understanding the consequences of your actions. That would be the same as switching your font color to green in a word processor and saying your word processor is messed up, only because you don't know how to switch it back to black font without e.g. exiting the program.
– Anthon
Mar 13 '14 at 10:30
4
4
a
reset
command might help sometimes, but this is no miracle solution.– Ouki
Mar 13 '14 at 10:47
a
reset
command might help sometimes, but this is no miracle solution.– Ouki
Mar 13 '14 at 10:47
The actual sequence to type is Control-J reset Control-J. Almost always restores sanity.
– Joshua
Jan 1 '15 at 18:02
The actual sequence to type is Control-J reset Control-J. Almost always restores sanity.
– Joshua
Jan 1 '15 at 18:02
1
1
@Joshua And what's the difference between a lone
reset
and a reset
between Ctrl-J keypresses? I can't see any (nor any reason to go the more complicated way)– syntaxerror
Jan 2 '15 at 1:56
@Joshua And what's the difference between a lone
reset
and a reset
between Ctrl-J keypresses? I can't see any (nor any reason to go the more complicated way)– syntaxerror
Jan 2 '15 at 1:56
1
1
Because if the terminal was left in RAW mode, Enter generates Ctrl-M instead of Ctrl-J so the shell doesn't see the necessary keystroke to end a line and run the command.
– Joshua
Jan 2 '15 at 3:37
Because if the terminal was left in RAW mode, Enter generates Ctrl-M instead of Ctrl-J so the shell doesn't see the necessary keystroke to end a line and run the command.
– Joshua
Jan 2 '15 at 3:37
add a comment |
2 Answers
2
active
oldest
votes
cat
concatenates files given as arguments on command line to standard output, it reads bytes at a time an as default does not perform any interpretation of the bytes it reads.
In your first example you are redirecting stdout to a file, that's why you get a new file.
In your second example the bytes are written to the terminal, and it is the terminal which is interpreting sequences of characters as control sequences for the terminal, this is why you get unusual behaviour on your terminal. It has nothing to do with cat
as such, cat
doesn't know what you are going to do with it's output. You might be sending it through a pipe to another program to interpret/process/print or play "Singing in the rain".
So following the unix philosophy,
do one thing, do one thing only, but do it well
cat
should not attempt to second guess what you are trying to do.
edit 1 reply to @kiwy's 1st comment below.
Yes and No, let me explain,
No, if you cat
to a terminal, because it (the terminal software) is sending the output to your screen or interpreting control sequences (it is emulating an old piece of hardware ie. a teletype device).
but,
Yes if you cat to a pipe and the program recieving can interpret the characters as commands.
look cat this for an example, cat anyOldShellScript | bash
bash will interpret what it gets as commands.
does it means that if youcat
a binary files that may contains in plain text instruction likerm -rf .
this could be interpreted ?
– Kiwy
Mar 13 '14 at 10:12
I accept the answer though I don't really get why terminal can get messed up like this will if I type like dumbass on my keyboard I never manage to get this :D
– Kiwy
Mar 13 '14 at 10:30
And now irony... hum
– Kiwy
Mar 13 '14 at 10:43
@Kiwy control characters don't exist on your keyboard, but you can makeecho
output them if you choose. See stackoverflow.com/questions/5947742/… for how to do it and termsys.demon.co.uk/vtansi.htm for some of what is possible
– David Wilkins
Mar 13 '14 at 12:32
@DavidWilkins hey thanks that's nice, so much things to learn and no time for that :-(
– Kiwy
Mar 13 '14 at 12:33
add a comment |
I guess this happens mostly because of non-printable characters with codes below 0x20. Those are special control/escape codes, which are used for keys like Backspace, Delete etc.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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
});
}
});
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%2funix.stackexchange.com%2fquestions%2f119480%2fwhy-and-how-did-using-cat-on-binary-files-mess-up-the-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
cat
concatenates files given as arguments on command line to standard output, it reads bytes at a time an as default does not perform any interpretation of the bytes it reads.
In your first example you are redirecting stdout to a file, that's why you get a new file.
In your second example the bytes are written to the terminal, and it is the terminal which is interpreting sequences of characters as control sequences for the terminal, this is why you get unusual behaviour on your terminal. It has nothing to do with cat
as such, cat
doesn't know what you are going to do with it's output. You might be sending it through a pipe to another program to interpret/process/print or play "Singing in the rain".
So following the unix philosophy,
do one thing, do one thing only, but do it well
cat
should not attempt to second guess what you are trying to do.
edit 1 reply to @kiwy's 1st comment below.
Yes and No, let me explain,
No, if you cat
to a terminal, because it (the terminal software) is sending the output to your screen or interpreting control sequences (it is emulating an old piece of hardware ie. a teletype device).
but,
Yes if you cat to a pipe and the program recieving can interpret the characters as commands.
look cat this for an example, cat anyOldShellScript | bash
bash will interpret what it gets as commands.
does it means that if youcat
a binary files that may contains in plain text instruction likerm -rf .
this could be interpreted ?
– Kiwy
Mar 13 '14 at 10:12
I accept the answer though I don't really get why terminal can get messed up like this will if I type like dumbass on my keyboard I never manage to get this :D
– Kiwy
Mar 13 '14 at 10:30
And now irony... hum
– Kiwy
Mar 13 '14 at 10:43
@Kiwy control characters don't exist on your keyboard, but you can makeecho
output them if you choose. See stackoverflow.com/questions/5947742/… for how to do it and termsys.demon.co.uk/vtansi.htm for some of what is possible
– David Wilkins
Mar 13 '14 at 12:32
@DavidWilkins hey thanks that's nice, so much things to learn and no time for that :-(
– Kiwy
Mar 13 '14 at 12:33
add a comment |
cat
concatenates files given as arguments on command line to standard output, it reads bytes at a time an as default does not perform any interpretation of the bytes it reads.
In your first example you are redirecting stdout to a file, that's why you get a new file.
In your second example the bytes are written to the terminal, and it is the terminal which is interpreting sequences of characters as control sequences for the terminal, this is why you get unusual behaviour on your terminal. It has nothing to do with cat
as such, cat
doesn't know what you are going to do with it's output. You might be sending it through a pipe to another program to interpret/process/print or play "Singing in the rain".
So following the unix philosophy,
do one thing, do one thing only, but do it well
cat
should not attempt to second guess what you are trying to do.
edit 1 reply to @kiwy's 1st comment below.
Yes and No, let me explain,
No, if you cat
to a terminal, because it (the terminal software) is sending the output to your screen or interpreting control sequences (it is emulating an old piece of hardware ie. a teletype device).
but,
Yes if you cat to a pipe and the program recieving can interpret the characters as commands.
look cat this for an example, cat anyOldShellScript | bash
bash will interpret what it gets as commands.
does it means that if youcat
a binary files that may contains in plain text instruction likerm -rf .
this could be interpreted ?
– Kiwy
Mar 13 '14 at 10:12
I accept the answer though I don't really get why terminal can get messed up like this will if I type like dumbass on my keyboard I never manage to get this :D
– Kiwy
Mar 13 '14 at 10:30
And now irony... hum
– Kiwy
Mar 13 '14 at 10:43
@Kiwy control characters don't exist on your keyboard, but you can makeecho
output them if you choose. See stackoverflow.com/questions/5947742/… for how to do it and termsys.demon.co.uk/vtansi.htm for some of what is possible
– David Wilkins
Mar 13 '14 at 12:32
@DavidWilkins hey thanks that's nice, so much things to learn and no time for that :-(
– Kiwy
Mar 13 '14 at 12:33
add a comment |
cat
concatenates files given as arguments on command line to standard output, it reads bytes at a time an as default does not perform any interpretation of the bytes it reads.
In your first example you are redirecting stdout to a file, that's why you get a new file.
In your second example the bytes are written to the terminal, and it is the terminal which is interpreting sequences of characters as control sequences for the terminal, this is why you get unusual behaviour on your terminal. It has nothing to do with cat
as such, cat
doesn't know what you are going to do with it's output. You might be sending it through a pipe to another program to interpret/process/print or play "Singing in the rain".
So following the unix philosophy,
do one thing, do one thing only, but do it well
cat
should not attempt to second guess what you are trying to do.
edit 1 reply to @kiwy's 1st comment below.
Yes and No, let me explain,
No, if you cat
to a terminal, because it (the terminal software) is sending the output to your screen or interpreting control sequences (it is emulating an old piece of hardware ie. a teletype device).
but,
Yes if you cat to a pipe and the program recieving can interpret the characters as commands.
look cat this for an example, cat anyOldShellScript | bash
bash will interpret what it gets as commands.
cat
concatenates files given as arguments on command line to standard output, it reads bytes at a time an as default does not perform any interpretation of the bytes it reads.
In your first example you are redirecting stdout to a file, that's why you get a new file.
In your second example the bytes are written to the terminal, and it is the terminal which is interpreting sequences of characters as control sequences for the terminal, this is why you get unusual behaviour on your terminal. It has nothing to do with cat
as such, cat
doesn't know what you are going to do with it's output. You might be sending it through a pipe to another program to interpret/process/print or play "Singing in the rain".
So following the unix philosophy,
do one thing, do one thing only, but do it well
cat
should not attempt to second guess what you are trying to do.
edit 1 reply to @kiwy's 1st comment below.
Yes and No, let me explain,
No, if you cat
to a terminal, because it (the terminal software) is sending the output to your screen or interpreting control sequences (it is emulating an old piece of hardware ie. a teletype device).
but,
Yes if you cat to a pipe and the program recieving can interpret the characters as commands.
look cat this for an example, cat anyOldShellScript | bash
bash will interpret what it gets as commands.
edited Mar 13 '14 at 10:38
answered Mar 13 '14 at 10:08
X TianX Tian
7,95312237
7,95312237
does it means that if youcat
a binary files that may contains in plain text instruction likerm -rf .
this could be interpreted ?
– Kiwy
Mar 13 '14 at 10:12
I accept the answer though I don't really get why terminal can get messed up like this will if I type like dumbass on my keyboard I never manage to get this :D
– Kiwy
Mar 13 '14 at 10:30
And now irony... hum
– Kiwy
Mar 13 '14 at 10:43
@Kiwy control characters don't exist on your keyboard, but you can makeecho
output them if you choose. See stackoverflow.com/questions/5947742/… for how to do it and termsys.demon.co.uk/vtansi.htm for some of what is possible
– David Wilkins
Mar 13 '14 at 12:32
@DavidWilkins hey thanks that's nice, so much things to learn and no time for that :-(
– Kiwy
Mar 13 '14 at 12:33
add a comment |
does it means that if youcat
a binary files that may contains in plain text instruction likerm -rf .
this could be interpreted ?
– Kiwy
Mar 13 '14 at 10:12
I accept the answer though I don't really get why terminal can get messed up like this will if I type like dumbass on my keyboard I never manage to get this :D
– Kiwy
Mar 13 '14 at 10:30
And now irony... hum
– Kiwy
Mar 13 '14 at 10:43
@Kiwy control characters don't exist on your keyboard, but you can makeecho
output them if you choose. See stackoverflow.com/questions/5947742/… for how to do it and termsys.demon.co.uk/vtansi.htm for some of what is possible
– David Wilkins
Mar 13 '14 at 12:32
@DavidWilkins hey thanks that's nice, so much things to learn and no time for that :-(
– Kiwy
Mar 13 '14 at 12:33
does it means that if you
cat
a binary files that may contains in plain text instruction like rm -rf .
this could be interpreted ?– Kiwy
Mar 13 '14 at 10:12
does it means that if you
cat
a binary files that may contains in plain text instruction like rm -rf .
this could be interpreted ?– Kiwy
Mar 13 '14 at 10:12
I accept the answer though I don't really get why terminal can get messed up like this will if I type like dumbass on my keyboard I never manage to get this :D
– Kiwy
Mar 13 '14 at 10:30
I accept the answer though I don't really get why terminal can get messed up like this will if I type like dumbass on my keyboard I never manage to get this :D
– Kiwy
Mar 13 '14 at 10:30
And now irony... hum
– Kiwy
Mar 13 '14 at 10:43
And now irony... hum
– Kiwy
Mar 13 '14 at 10:43
@Kiwy control characters don't exist on your keyboard, but you can make
echo
output them if you choose. See stackoverflow.com/questions/5947742/… for how to do it and termsys.demon.co.uk/vtansi.htm for some of what is possible– David Wilkins
Mar 13 '14 at 12:32
@Kiwy control characters don't exist on your keyboard, but you can make
echo
output them if you choose. See stackoverflow.com/questions/5947742/… for how to do it and termsys.demon.co.uk/vtansi.htm for some of what is possible– David Wilkins
Mar 13 '14 at 12:32
@DavidWilkins hey thanks that's nice, so much things to learn and no time for that :-(
– Kiwy
Mar 13 '14 at 12:33
@DavidWilkins hey thanks that's nice, so much things to learn and no time for that :-(
– Kiwy
Mar 13 '14 at 12:33
add a comment |
I guess this happens mostly because of non-printable characters with codes below 0x20. Those are special control/escape codes, which are used for keys like Backspace, Delete etc.
add a comment |
I guess this happens mostly because of non-printable characters with codes below 0x20. Those are special control/escape codes, which are used for keys like Backspace, Delete etc.
add a comment |
I guess this happens mostly because of non-printable characters with codes below 0x20. Those are special control/escape codes, which are used for keys like Backspace, Delete etc.
I guess this happens mostly because of non-printable characters with codes below 0x20. Those are special control/escape codes, which are used for keys like Backspace, Delete etc.
answered Mar 13 '14 at 10:06
UVVUVV
2,10511628
2,10511628
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f119480%2fwhy-and-how-did-using-cat-on-binary-files-mess-up-the-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
2
Your terminal does not get messed up. It is in a state you forced it into by sending it control characters. That you cannot use it any more after changing the state might not be what you wanted, but it is entirely a result of you not understanding the consequences of your actions. That would be the same as switching your font color to green in a word processor and saying your word processor is messed up, only because you don't know how to switch it back to black font without e.g. exiting the program.
– Anthon
Mar 13 '14 at 10:30
4
a
reset
command might help sometimes, but this is no miracle solution.– Ouki
Mar 13 '14 at 10:47
The actual sequence to type is Control-J reset Control-J. Almost always restores sanity.
– Joshua
Jan 1 '15 at 18:02
1
@Joshua And what's the difference between a lone
reset
and areset
between Ctrl-J keypresses? I can't see any (nor any reason to go the more complicated way)– syntaxerror
Jan 2 '15 at 1:56
1
Because if the terminal was left in RAW mode, Enter generates Ctrl-M instead of Ctrl-J so the shell doesn't see the necessary keystroke to end a line and run the command.
– Joshua
Jan 2 '15 at 3:37