Bash Character transformations [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
Here's the latest from my terminal.
E┬$?: N⎺ ⎽┤c▒ °☃┌e ⎺⎼ d☃⎼ec├⎺⎼≤
┴▒±⎼▒┼├#└e⎽⎺⎽:·/de┴e┌⎺⎻└e┼├/⎽⎻┌☃├├e⎼$ └▒┼ └▒⎼▒├▒⎺┼
N⎺ └▒┼┤▒┌ e┼├⎼≤ °⎺⎼ └▒⎼▒├▒⎺┼
See '└▒┼ 7 ┤┼d⎺c┤└e┼├ed' °⎺⎼ ▒e┌⎻ ┬▒e┼ └▒┼┤▒┌ ⎻▒±e⎽ ▒⎼e ┼⎺├ ▒┴▒☃┌▒b┌e↓
┴▒±⎼▒┼├#└e⎽⎺⎽:·/de┴e┌⎺⎻└e┼├/⎽⎻┌☃├├e⎼$ ⎻☃┼± ±⎺±⎺┌e↓c⎺└
PING ±⎺±⎺┌e↓c⎺└ (216↓58↓217↓36) 56(84) b≤├e⎽ ⎺° d▒├▒↓
64 b≤├e⎽ °⎼⎺└ de┼▮3⎽1▮↑☃┼↑°36↓1e1▮▮↓┼e├ (216↓58↓217↓36): ☃c└⎻_⎽e─=1 ├├┌=63 ├☃└e=29↓▮ └⎽
64 b≤├e⎽ °⎼⎺└ de┼▮3⎽1▮↑☃┼↑°36↓1e1▮▮↓┼e├ (216↓58↓217↓36): ☃c└⎻_⎽e─=2 ├├┌=63 ├☃└e=32↓4 └⎽
64 b≤├e⎽ °⎼⎺└ de┼▮3⎽1▮↑☃┼↑°36↓1e1▮▮↓┼e├ (216↓58↓217↓36): ☃c└⎻_⎽e─=3 ├├┌=63 ├☃└e=27↓4 └⎽
64 b≤├e⎽ °⎼⎺└ de┼▮3⎽1▮↑☃┼↑°36↓1e1▮▮↓┼e├ (216↓58↓217↓36): ☃c└⎻_⎽e─=4 ├├┌=63 ├☃└e=25↓9 └⎽
^C
↑↑↑ ±⎺±⎺┌e↓c⎺└ ⎻☃┼± ⎽├▒├☃⎽├☃c⎽ ↑↑↑
4 ⎻▒c┐e├⎽ ├⎼▒┼⎽└☃├├ed← 4 ⎼ece☃┴ed← ▮% ⎻▒c┐e├ ┌⎺⎽⎽← ├☃└e 32▮3└⎽
⎼├├ └☃┼/▒┴±/└▒│/└de┴ = 25↓927/28↓721/32↓426/2↓415 └⎽
┴▒±⎼▒┼├#└e⎽⎺⎽:·/de┴e┌⎺⎻└e┼├/⎽⎻┌☃├├e⎼$ E┴e⎼≤├▒☃┼± ☃⎽ ☃┼ ▒ ┼e┬ ┌▒┼±┤▒±e
E┴e⎼≤├▒☃┼±: c⎺└└▒┼d ┼⎺├ °⎺┤┼d
┴▒±⎼▒┼├#└e⎽⎺⎽:·/de┴e┌⎺⎻└e┼├/⎽⎻┌☃├├e⎼$ ┌⎽
▒⎻⎻↓┘⎽ c⎺┼°☃± D⎺c┐e⎼°☃┌e d⎺c┐e⎼☃≥e↓⎽▒ ┼⎺de_└⎺d┤┌e⎽ ⎻▒c┐▒±e↓┘⎽⎺┼ Re▒d└e↓└d README↓└d
┴▒±⎼▒┼├#└e⎽⎺⎽:·/de┴e┌⎺⎻└e┼├/⎽⎻┌☃├├e⎼$
Now, I'm aware that cating binary files causes all kinds of crazy stuff to happen to your terminal. But I've never asked about it before. I'm trying to track down what exactly would cause this character transformation.
Everything seems to work normally. I can't read the output, but ping commands produce output that behaves as I would expect. ls has the same color coding. custom scripts have the same output (just transformed).
What character sequence would cause this consistent transformation?
typing reset puts me back into sanity.
Am I getting a character transformation via console codes? If so, can I prank friends with this? (alias ls=ls #+some character transformation). Note: I don't want this to have a possibility of ls turning into rm -rf or anything else malicious.

This is caused by the smacs (enter_alt_charset_mode) terminfo sequence being entered into the terminal. It can be switched back with the rmacs (exit_alt_charset_mode) terminfo sequence.
echo "$(tput rmacs)"

Related

What does rm ** does in LINUX [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 12 months ago.
Improve this question
what does rm ** do in linux.
started learning linux and stuck here.
I tried reading but couldnt understand or didn get the answer
* is a wildcard. Wildcard characters are used to define the pattern for searching or matching text on string data in the bash shell.
The shell interprets certain characters in filenames and for other purposes as well. It passes the interpreted version to commands. For example, the most commonly used special character is asterisk, * , meaning "zero or more characters". When you type a command like ls a* , the shell finds all filenames in the current directory starting with a and passes them to the ls command.
Since rm is to remove, rm ** will delete all the files from where you run the command.

removing first 8 bytes using dd is very slow [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm trying to remeove the first 8 bytes from binary file using the command:
dd if=new.pdf of=new2.pdf ibs=1 skip=8
but it's taking too long.
Is there a way to remove the first 8 bytes, in a faster way ?
ibs=1 is requesting dd to read one single byte at a time. It's going to be slow - for each byte, there is a context switch to the kernel.
I would:
tail -c+9 new.pdf > new2.pdf
I think you could use dd, choose the best block size for your specific environment, and... skip the bytes:
dd if=new.pdf of=new2.pdf bs=4M iflag=skip_bytes skip=8

Typing "cd.." in Linux terminal instead of "cd .." [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I come from MS-DOS background, where it is permitted to type cd.. (without the space between cd and ..) instead of cd ... The Linux terminal, however, finds cd.. objectionable.
Is there a way to make Linux terminal understand cd.. to mean cd ..?
I'm using Ubuntu.
And I am well aware that this is a rather silly problem, but I have cd.. committed to muscle memory (since early childhood, my brain has been wired that way) and I've been making that mistake at least twenty times every day, for several years now, ever since I started using Linux on a regular basis.
You could create an alias:
alias cd..="cd .."
If you add this to some file that's loaded whenever you log in (e.g., .bashrc if you're using bash), you'd get the effect of having this alias permanently available.

last | reboot in linux rebooted the machine, can someone explain why ? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
how does the pipeline work in the below?
last | reboot
The above rebooted the linux machine.
last search the last logged in user and last output is given to reboot and reboot will reboot the system.
last | reboot
| | => process1 output will be input
process1 process2 for process2
See the man 1 last it says
Last searches back through the file /var/log/wtmp (or the file
desig‐
nated by the -f flag) and displays a list of all users logged in (and
out) since that file was created.
As Daniel says importantly, reboot doesn't care about its input. It probably doesn't read it at all, so piping something in doesn't change its behavior.

Shell script save terminal (screen) outputs [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have a USB-Dongle that can recive radio signals (868Mhz).
This dongle coud be controlled over a screen terminal session:
screen /dev/ttyACM0
In this Terminal all 120sec appear strings:
T350B00B64C19
How can I save this strings in a variable to work with them.
Any ideas?
Starting screen with the -L option creates a log in the current working directory. I guess that should serve your requirements.
$ screen --help
...
-L Turn on output logging.
...
From man 1 screen:
-L tells screen to turn on automatic output logging for the windows.
If I understand correctly, you don't actually need screen; you just need to read from the serial device. For example:
while read data; do
# Work with value in $data
done < /dev/ttyACM0
Each call to read should block until the dongle writes another string to the serial device.
If you need to send commands to the device, you can also simply write the appropriate string to the same file:
printf "my-command" > /dev/ttyACM0
read response < /dev/ttyACM0

Resources