Escape sequences such as encodings of terminal commands and function keys

learn more… | top users | synonyms

0
votes
0answers
14 views

How to escape special characters in gnu sed? [duplicate]

I have variables in shell: VAR_IN='Unsafe \t \ string I don't control.' VAR_OUT='some output' I need to change every VAR_IN to VAR_OUT in a stream. Idea is to: sed "s/$VAR_IN/$VAR_OUT/g" # this ...
8
votes
3answers
2k views

Make Less highlight search patterns instead of italicizing them

To my understanding man uses less as a pager, and when searching for keywords using less it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something ...
1
vote
2answers
51 views

What does [?1049h and [?1h ANSI escape sequences do?

When I used shell in a box and when I call less command (echo foo | less) in ajax response there was this code: \u001B[?1049h\u001B[?1h\u001B=\rfoo\r\n\u001B[7m(END)\u001B[27m\u001B[K what does \...
20
votes
5answers
6k views

Is there any reason why I get ^[[A when I press up arrow at the console login screen?

Whenever I'm at the console login, I press up arrow intentionally to see the previously typed commands. But I see this ^[[A. But when I press Ctrl Alt Print Screen Scroll Lock Pause Break Page Up ...
1
vote
0answers
50 views

How to use ! in the sed command?

Apologize if you feel this question very basic. Anyways, I am typing sed '/[iI]t/ a\\ Found it!' data but it says the error event not found. I tried escaping that ! with backslash \! but it doesn'...
0
votes
2answers
1k views

How to remove the ESC characters from Notepad++

How to remove the ESC characters in black background from Notepad++ v6.7.3
0
votes
1answer
21 views

Colorized tail: How to set default color

I have a function setup to provide color to the tail command using ANSI escape sequences with sed. function colortail { tail -f -n30 $1 | sed -e 's/\(.*MINOR.*\)/\o033[93m\1\o033[39m/' -e 's/.*MAJOR....
32
votes
6answers
21k views

Removing control chars (including console codes / colours) from script output

I can use the "script" command to record an interactive session at the command line. However, this includes all control characters and colour codes. I can remove control characters (like backspace) ...
14
votes
4answers
1k views

Escape sequences in output of script called from ncurses application

I'm currently running mcabber as my Jabber client (which uses ncurses) in a tmux session on my homeserver. Locally i run iTerm2 as a terminal emulator, which supports the triggering of growl ...
6
votes
1answer
145 views

ANSI code translator

Is there any tool that translates text with ANSI code to text-like output? tput cap names or the like? Reason for the inquiry is that I would like to use script or the like and view the resulting ...
3
votes
4answers
55 views

How to change the background color for exactly one line?

Here are my tries: The last one worked, but it breaks copy-pasting (adding a lot of spaces when copied). Is there a better way? Copyable text: $ PS1='\['$'\x1b[0m\]$ ' $ echo -e "\x1b[41;...
0
votes
1answer
20 views

Highlight Vim escape characters e.g. \n

I'm using the Jellybeans vim colorscheme but it doesn't highlight any escape characters. For example if I'm using C++ and have the following... std::string word = "hello\n"; ... the whole string ...
1
vote
2answers
66 views

Keyboard shortcuts C-h, C-m in bash [duplicate]

Bash uses GNU Readline. Readline provides a collection of keyboard shortcuts. However, there are some shortcuts that work on bash and that are not documented in Readline reference. Some examples are: ...
2
votes
2answers
263 views

Bell and escape character in prompt string

My prompt string is printed using this statement, printf '\033]0;%s@%s:%s\007' user host /home/user Why does it need an escape character (\033) and a bell character (007)? When i ran the same ...
0
votes
1answer
32 views

What \u001B]0;kuba@jcubic: ~\u0007 escape code do?

When using shell in a box this is returned from the server \r\n\u001B]0;kuba@jcubic:~\u0007\u001B[01;32mkuba@jcubic\u001B[00m:\u001B[01;34m~\u001B[00m$ what ESC]0; and \u0007 do?
0
votes
2answers
65 views

Create blinking text with echo and escape characters [duplicate]

I have learned about formatting options used in shell scripting, which go like this: \033[37:40mAnyText\033[0m Now I want to echo some text like this: echo -e "SomeText \033[5;31;47mMoreText\033[...
2
votes
2answers
207 views

How to use ESC sequences to make terminal region scrollable

I have a stm32f1 controlled device that uses USART/USB port to implement a user control interface. Using a standard terminal software (putty/minicom) a user has an ability to enter simple command in ...
0
votes
1answer
57 views

Hide and unhide cursor with tput

tput civis successfully hides the cursor. tput cvvis should unhide it, but it doesn't. Any idea what the problem might be?
0
votes
2answers
80 views

How to process a file containing quotes?

I know a fair bit about escape characters in BASH. I know that \ will escape the next character, " " will escape all characters except for $ and ", and finally ' ' will escape all characters except ...
2
votes
0answers
39 views

Portable color codes with printf? [duplicate]

There is a color codes script on GitHub suitable for sourcing, which I am modifying for my own purposes. Background I have an odd mix of environments to work in, from a Mac OS terminal, to various ...
2
votes
2answers
5k views

Proper escaping of double quotations for curl post data?

I'm trying to test out a server, by sending it JSON data and reading the response. I need to POST data like {"item":"value with spaces"} but when I use curl I find that it sends the backslashes as ...
1
vote
1answer
23 views

Understanding what is happening when I dump a terminal character sequence with Ctrl-v?

If I want to bind a key-mapping to a function or widget in zsh I have learnt that I first have to hit Ctrl+v - at a prompt, then enter the key sequence I want to use, then use the output in my key-...
2
votes
1answer
33 views

In the SGR number 38 and 48, where do the 2 and 5 numbers come from?

In multi-color-compatible terminals, one can set a color from a 256-color palette by using ESC[38;5;Nm, and any RGB color using ESC[38;2;R;G;Bm. I've been wondering though, where do the "2" and "5" ...
4
votes
2answers
34 views

Question about behavior of control key shortcuts

I am confused about how Ctrl-key combinations work in terminal. In bash man page, there are various combinations such as: C-e - go to end of the line C-f - go one character forward etc. But then ...
0
votes
0answers
38 views

escaped strings inside variable returned in single quotes

I have a number of mp3 files without correct file names. What I wish to do is to create a script that will read the artist and title from mp3 tag and rename the file according to the tag. The script ...
3
votes
2answers
146 views

posting data using cURL in a script

I'm trying to write a simple alternative script for uploading files to the transfer.sh service. One of the examples on the website mentions a way of uploading multiple files in a single "session": $ ...
4
votes
3answers
4k views

What is the problem with the output of plink?

On my Windows7 machine, I'm traversing to the installed path of PuTTy Application and running: plink <hostname> to connect to my remote Linux host. I see some unrecognized characters in the ...
6
votes
1answer
274 views

How to use less in a script without getting ESC escape characters?

When I use less at the command line the output is like but when I use less from within a bash script I get: How can I use less in a bash script and not get all the escape characters and have it ...
1
vote
1answer
130 views

Escape strings to be posted via curl

I am trying to make a script that takes some atom feeds and posts them to slack through the Slack API via curl. What I have now works for simple texts, but some of them have double quotes or & ...
1
vote
2answers
749 views

How to escape in YAML the correct way?

On CentOS 7 I am using cloud-init to spin off a droplet using the DigitalOcean API which requires YAML formatting. I got most parts working fine, but struggle on escaping the commands running at '...
0
votes
2answers
39 views

Problem with understanding keys bindings

I have a settings and a zsh session ~ bindkey | grep help "^[H" run-help "^[h" run-help Why when i press "Control + [ + h" word under cursor removes and nothing happens, but if i press "Alt + h"...
7
votes
2answers
9k views

export HTTP_PROXY and special characters in passwd

Suppose for the sake of argument my password below is abc123@ I need to authenticate my linux machine through a corporate proxy to get patches and updates... normally I'd use this: export HTTP_PROXY=...
15
votes
2answers
569 views

How do I use grep while keeping the original text color? [duplicate]

For example, I have a output: Hello, this is the output. (let's say that for example hello is colored red, and the is colored green, and output is colored purple). Now, let's say that this is the ...
5
votes
3answers
90 views

Is there any objective benefit to escape sequences over tput?

In people's '.*rc' files I see online or in various code, I tend to see a lot of people who manually use ANSI escape sequences instead of using tput. I had the understanding that tput is more ...
1
vote
0answers
22 views

How to remove a single quote from a file name? [duplicate]

I have some podcasts on my radio server which contain a timestamp when they should be played. I noticed one of them is put into single quotes 'filename.mp3', and I'm unable to remove them. Check this: ...
2
votes
2answers
221 views

How can a bash script detect support for window titling escape characters?

I have a debug trap that runs every time I enter a command in bash that sets the window title to indicate what command is running. I'm leaving out all the configuration details and boil it down to: ...
3
votes
1answer
71 views

What does it mean when characters appear on the prompt after an operation?

Compare the following two commands: mysqldump database_name --hex-blob -uuser_name -p | tee database_name_tee.sql mysqldump database_name --hex-blob -uuser_name -p > database_name_out.sql If I ...
0
votes
0answers
54 views

double quote single quote combination BCP on Linux

Can someone show me the correct way to structure this command? FYI - I think this boils down to an escape issue. There are several posts close but I have yet to find a solution which will run as a ...
3
votes
2answers
313 views

Graphical console applications in Emacs

I am having trouble running htop within an ansi-term in Emacs 24.2. It looks like some of the control characters are not interpreted correctly. I thought ansi-term was capable of handling font ...
-2
votes
2answers
61 views

blink code(escape code) has been removed?

According to Bash tips: Colors and formatting (ANSI/VT100 Control sequences) I attemped to active blink code in my program, But may be blink code has been eliminated. Is it true? If is not true, ...
1
vote
1answer
170 views

What do \t and \a mean in a shell script?

What do \t and \a perform or do in a script? For example, I am writing a script and it goes like this \t it displays a simple script \a
4
votes
2answers
471 views

Is it possible to use ANSI color escape codes in Bash here-documents?

I'm printing a message in a Bash script, and I want to colourise a portion of it; for example, #!/bin/bash normal='\e[0m' yellow='\e[33m' cat <<- EOF ${yellow}Warning:${normal} This script ...
3
votes
4answers
108 views

Bash converting path names for sed so they escape

I'm having a problem with a script. It is meant to change a value in a file called %DIR% so that it becomes a path name. The problem is the slashes in the directory name upset sed, so I get weird ...
0
votes
2answers
75 views

awk FS with back slashes

I use the command find . -maxdepth 1 -not -type d which generates output like ./filename.1.out I pipe the find command output to awk. The goal is to split on either the literal ./ or .. I have it ...
3
votes
1answer
87 views

What's the maximum length for a multibyte escape sequence?

ESC sends \x1b. That's 1 byte: the actual escape character. Page Up sends \x1b[H. That's 3 bytes. F2 sends \x1b[OQ. That's 4 bytes. F5 sends \x1b[15~. That's 5 bytes. What's the maximum length for ...
6
votes
2answers
447 views

What is the gnome-terminal ANSI escape sequence for “CTRL + arrow/s”?

I am trying to configure my bash ~/.inputrc to these settings (Note: ←, → mean the left and right arrow keys) Ctrl + ← - should jump back a word Ctrl + → - should jump forward a word Currently I ...
1
vote
1answer
67 views

Double quotes issue in bash script

I have a shell script I am trying to get working. I need the output to be a certain way and I know I'm just not escaping the characters correctly. script: #!/bin/bash set -x DATE=$(date +%Y-%m-%d-%M)...
7
votes
4answers
400 views

is there a pastebin service that supports terminal escape sequences?

Is there a pastebin service that supports colors? I understand some of them have syntax hilighting, but I'd like to do arbitrary coloring, preferably using the terminal escape sequences. Example, i'd ...
1
vote
1answer
152 views

Is it possible to do a here-document in one line or echo verbatim?

I often find myself testing out a command (e.g. cat file | awk 'stuff') in the shell and when I'm satisfied with the way it works, I append the command to a script file. Let's say this is the command ...
1
vote
1answer
63 views

Maximizing tmux session shows weird ANSI Sequences

I have a tmux session inside Putty. It was fine for past many months, but now I see a strange thing. When I maximize a normal Putty window, and if cursor is not on a new line, then I get some weird ...