Escape sequences such as encodings of terminal commands and function keys

learn more… | top users | synonyms

1
vote
1answer
12 views

LS_COLORS for 256-color terminal

I thought ls colors are defined as <file_type>=[<bg(40-47)>];<font_spec(0:5)>;<font_color(30-37)> but, I recently found this where there are more colors and colors are ...
2
votes
1answer
43 views

How do I properly escape this long su + sed command?

#!/bin/bash wineuser=tom su $wineuser -c "sed -i '$ialias ptgui "wine ~/.wine/drive_c/Program\ Files/PTGui/PTGui.exe\"' /usr/people/$wineuser/config/cshrc.csh" The acutal line inserted to tom's ...
5
votes
1answer
114 views

How do I store colored text in a variable and print it with color later?

If I do git status --short, git lists files that are not tracked with two red question marks in front: I'm trying to store this in a variable and print it with color later. Here's my bash script: ...
2
votes
2answers
95 views

How to escape correctly this word on vim?

I want to substitute this word ${ARRAY1[@]} with $1 on vim substitution command I did :%s:\$\{ARRAY1[\@]\}:\$1:g But give me error about number of repetition,i try also "" but doesn't work How to ...
1
vote
1answer
39 views

Reinterpret terminal output

I have a program that executes some commands in a terminal (for example apt-get update) and stores the output. How can I reinterpret the output, so I can remove all information that is not needed ? ...
1
vote
2answers
43 views

echo with backspace

I am trying to figure out why this happens in bash. Ok this is easy enough. $ echo -e 'a\txy\bc' a xc Ok this is easy enough. $ echo -e 'a\txy\b\b\b\b\b\b\b\b\bc' ac xy Ok this is easy ...
1
vote
1answer
33 views

How use '(' token when using it for searching with ag / awk?

$ ag findVersions( src/java/com/google -bash: syntax error near unexpected token `(' I tried quoting it, escaping it, both were not suitable. $ ag findVersions\( src/java/com/google ERR: ...
1
vote
1answer
36 views

sed exception handling of escaped characters

I want to delete anything that follows a % to the end of the line. Using cat /tmp/foo.txt | sed 's/%.*$//' works great with one exception: I want to ignore any escaped percent signs \%. So with ...
0
votes
1answer
47 views

How to remove the ESC characters from Notepad++

How to remove the ESC characters in black background from Notepad++ v6.7.3
2
votes
3answers
50 views

Command substitutions vs backslash escapes in a quoted string

Consider a double-quoted command substitution with backslash escapes inside it, like this: echo "$(echo '\\')" It prints out \\, whereas I would have expected it to print out only one backslash. My ...
1
vote
1answer
40 views

How to configure the system in order beeing able to hear the sound of the \a escape character?

I read, that if I execute: echo -e "\a" a sound emerges, but frankly speaking, i executed this command several times and no sound happened.
1
vote
2answers
104 views

sh -c: Unterminated quoted string error [duplicate]

I've spent hours trying to understand the following error. My Script CMD="sh -c 'echo \"a\"'" $CMD Error: "a"': 1: "a"': Syntax error: Unterminated quoted string of course when I do echo $CMD ...
1
vote
4answers
54 views

echo \\* - bash backslash escape behavior, is it evaluated backwards?

So in bash, When I do echo \* * This seems right, as * is escaped and taken literally. But I can't understand that, when I do echo \\* \* I thought the first backslash escaped the second one ...
1
vote
1answer
30 views

Apply Escape Characters in Redirected Output

I'm running a program that prints lots of escape characters (like "Esc[1A", to move the cursor up one line), and trying to redirect the output to a log file. When I run the program without ...
1
vote
1answer
53 views

using ansi escape codes to change the background color in xfce4-terminal

This works to change the background color for the entire terminal with xterm: printf '\033]10;%s\a\033]11;%s\a' Blue Red It doesn't work in xfce4-terminal, tho. Is there something that will work? ...
4
votes
4answers
145 views

Viewing man pages with scroll wheel support

I'd like to use the scroll wheel (xterm mouse escape codes) to scroll through man pages, like I can in emacs with xterm-mouse-mode. less doesn't seem to have support for that and short of recompiling ...
1
vote
1answer
793 views

How to remove junk characters from the file generated by script command in linux [duplicate]

I am using script command to record everything from terminal. But when I am opening the generated file its having lots of junk character. Can anyone help me to remove these junk characters from file ...
5
votes
1answer
94 views

Escaping strings in associative arrays (bash)

I am writing a script which executes a number of programs with arguments. To simplify it as much as possible, consider the following example: programs=( "ls" "echo" ) declare -A parameters ...
0
votes
0answers
52 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 ...
6
votes
2answers
131 views

How to determine the current color of the console output?

I know that, if a coloured terminal is available, one can colour the output of it using escape characters. But is there a possibility to find out, which colour the output is currently being displayed ...
2
votes
2answers
436 views

Remove escape characters using sed

I have input coming from pipe which contains special escape characters. For illustration, the stream looks like this: printf "foo.bar\033[00m" > file cat file How can I remove the trailing ...
0
votes
2answers
52 views

Substituting \ for \\ in column

I exported a column of thousands of salts from Mysql for hashcat. Every instance of the character \ was replaced with a double character \\ in the exported column. Is there a way to either sed or awk ...
1
vote
0answers
39 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
105 views

Shell string escape for command arguments [duplicate]

I'm trying to create "/tmp/pwet/foo bar" with this: DIR="/tmp/pwet/foo bar" ARGS="-p ${DIR}" mkdir $ARGS For integration reasons, I have to keep the ARGS building in 2 steps: ARG = some_options + ...
1
vote
1answer
72 views

Echoing Backspace Characters in the Terminal

I'm working with picocom running inside gnome-terminal. I have local echo switched on inside picocom using the -e option, and when I backspace I can see that caret moves backwards, however the ...
3
votes
0answers
22 views
+100

cssh intercepts F10

I am using cssh (cluster-ssh) to ssh to multiple machines simultaneously. Everything works great, except that cssh intercepts F10 key (which in cssh opens menu. This is very unfortunate, because I ...
1
vote
4answers
115 views

What is '“^[b” backward-word' When trying to configure ZSH?

I am on a MAC, and I am trying to figure out shortcuts for my ZSH running on Iterm2. When I type bindkey in the shell, I see (among other mappings), the following: "^[b" backward-word "^[f" ...
0
votes
1answer
92 views

ANSI escapes in Pash prompt are displayed as garbage in Gnome terminal

I would like to use Pash, a PowerShell implementation for mono on my CentOS box. After compilation I started it and got $ mono Source/PashConsole/bin/Debug/Pash.exe ...
1
vote
0answers
101 views

How can you (programatically) detect the ANSI escape code supported by terminal?

I am playing around with shell scripts that use ANSI codes and found that for one reason or another different escape codes are supported depending on your terminal/os.. In some cases I get a dump of ...
4
votes
3answers
932 views

How to escape single quotes correctly creating an alias [duplicate]

I've been given this one-liner to know how much memory my processes consume. $ ps -u $USER -o pid,rss,command | \ awk '{print $0}{sum+=$2} END {print "Total", sum/1024, "MB"}' Now I'd like to ...
4
votes
2answers
97 views

Sorting strings with ANSI escape codes

I am trying to print a sorted list of all zsh options, with set options colored green and unset options colored red. I cannot get sort to work properly with on the colored lines though.The below ...
2
votes
2answers
137 views

Non-printing escape sequence: when?

Recently, I have been playing around a lot with color in the terminal and, therefore, with escape sequences, too. I've read the relevant parts of the Bash manpage along with numerous helpful pages on ...
0
votes
2answers
131 views

How to printf an exclamation point in tcsh?

What's the best way to printf an exclamation point in tcsh? It seems like using single or double quotes has no effect on escaping the exclamation point; and using a backspace does work, but then it ...
1
vote
2answers
179 views

When to use bash ANSI C style escape, e.g. $'\n'

I don't use bash often but I recall in the past to pass a tab or newline on the command line I would have to escape the character using the special $ character before a single quoted string. Like ...
0
votes
1answer
93 views

Can I get my iTerm key-combos working in tmux?

I have some shortcut keys defined in iTerm, and I use them for key-mappings in Vim. For example, I map Ctrl-Enter to send a ^[O2P escape code, which I then use to define a Ctrl-Enter key-mapping in ...
2
votes
1answer
64 views

What does xterm's Escape Sequence option do and how do I enable it?

xterm's control-right-click menu contains an option named Escape sequence. It is always disabled ("grayed out") in Ubuntu-14.04. What is this option is used for? How do I enable it? I am looking for ...
5
votes
2answers
245 views

Escape code 50 in xterm

My coworker has the following in the ~/.bash_profile of many of our servers: echo -e "\033]50;SetProfile=Production\a" The text doesn't seem to matter, since this also works: echo -e ...
2
votes
2answers
29 views

How to escape a Whole Variable?

In the answer of thisquestion: https://superuser.com/questions/163515/bash-how-to-pass-command-line-arguments-containing-special-characters It said that we have to put an arg of a function in ...
1
vote
1answer
55 views

What standard shell command can evaluate escaped Unicode in a stream?

I'm looking for a pipeable command that will convert substrings in the form of ‘\unnnn’ to the actual characters. For example: $ echo 'co\u00ebfficient' | what_command coëfficient
2
votes
1answer
83 views

Tar actions not working as intended

I have a huge uncompressed tar file (1 tb) and I want to check it, therefore I am trying to extract it to see if everything goes well. Since it is going to take a long time, I'd like to have some info ...
1
vote
1answer
54 views

Why does sed globally substitute only the first occurence in multiple substiutions?

I want to globally substitute all \n new line characters with their \n escape sequence and all ' single quote characters with two '' of them like so: function esc_foobar { # Escapes any "'" ...
2
votes
2answers
62 views

Meaning of backslash

Why the following command prints Smith but not \Smith? echo \Smith
6
votes
1answer
1k views

Why do I have to escape a “dot” twice?

I know that we can escape a special character like *(){}$ with \ so as to be considered literals. For example \* or \$ But in case of . I have to do it twice, like \\. otherwise it is considered ...
2
votes
3answers
1k 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 ...
4
votes
2answers
7k views

How to change font colors in terminal?

I know how to change the font color via preferences, but it changes the color of ALL text, as in below:     What I'm going for is something more like this:     Any ...
0
votes
1answer
2k 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 ...
3
votes
4answers
204 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
78 views

Proper use of escape characters in desktop file

I have a command with a working .desktop Exec key as follows: Exec=env XDG_CONFIG_HOME=/home/bean/.config/gedit/ gedit %U I would like to use the $HOME variable instead and it works in the terminal ...
1
vote
1answer
489 views

Exit of “> ” mode in Unix shell

In sh (not Bash), how would we abort execution of command when the prompt is in > mode? For example, when entering a string with quotes only at the beginning, it makes the prompt look like >, ...
1
vote
1answer
468 views

Cat and Less give different output

I executed the following command # top > /home/user/top_output.txt Nothing Happened for a while and then i pressed Ctrl+C. When i checked the file that was created, it had the contents in it. So ...