Skip to main content

Questions tagged [escape-characters]

Escape sequences such as encodings of terminal commands and function keys

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

Is there a reverse mapping of key codes or escape sequences to common keyboard keys?

I am using fish for my shell, so I have an easy way the escape sequences or key codes for various key presses using the fish_key_reader builtin. What I'm looking for is the reverse. Is there a way I ...
Hari's user avatar
  • 127
0 votes
0 answers
35 views

Node.js recently started emitting all stderr in red text. How to handle this cleanly?

I use ANSI colorized text output in logs and other output that I emit on stderr in some of my programs. Since I've been doing this kind of thing for years, I am pretty familiar with the capabilities. ...
Steven Lu's user avatar
  • 2,312
0 votes
2 answers
37 views

How to escape both single quotes and exclamation marks in bash

I have a long command and I just want to use alias to shorten it. But the command contains single quotes and exclamation marks. The origin command is ldapsearch -x -H ... -w 'abc!123'. I tried alias ...
Donghua Liu's user avatar
1 vote
1 answer
34 views

With urxvt: unable to prevent title in title bar from being overwritten

I'm using urxvt version 9.22 under Ubuntu 20.04.1. Even though I use -title MYTITLE on the urxvt command line, and even though I set the following Xresource ... URxvt.insecure: false ... the title in ...
HippoMan's user avatar
  • 657
0 votes
2 answers
57 views

Issue with double quotes inside double quotes in JSON

I have a shell script part of which is the following JSON: curl --request POST \ --url 'https://'$jira_instance'.atlassian.net/rest/api/2/field/'$field_ID'/context/'$context_ID'/option' \ --user $...
dlyk1988's user avatar
  • 103
2 votes
1 answer
53 views

How to "render" ouput from a command playing with tput so only the final terminal-postprocessed result is kept? [duplicate]

I captured the output of a script that uses tput to draw certain things on screen. When I perform cat myoutput then everything is well seen (looks like terminal reinterprets it from beginning), but ...
Whimusical's user avatar
1 vote
0 answers
112 views

How to convert an escape sequence to a human-readable keystroke?

I am looking for a Linux command, or a zsh command, or at least an online service that given: an escape sequence like "^[^[[1~", "\M-C\M-^X" or "^[[1;5F" (these are not ...
Radagast's user avatar
1 vote
0 answers
65 views

Differentiate Ctrl+BackSpace from BackSpace in MobaXTerm

I'm trying to configure zsh (.zshrc) in order to provide two different keystrokes, each one for a different action. While I need Backspace to just delete the previous character, control+backspace ...
FueraDeServicio's user avatar
2 votes
1 answer
127 views

Backslash in unquoted variable for glob expansion

Given these six files: $ touch 'sec*et' 'sec\*et' 'sec\et' secet secret 'sec\ xxx et' Why backslash in unquoted variable for glob expansion matches only the sec\*et file? $ v="sec\*et&...
midnite's user avatar
  • 443
-1 votes
2 answers
115 views

How to escape left double quotes and right double quotes?

I want to change name with mv command. The file is inside left and right double quotes. e.g “My file name.” want to change it to My_file_name How can can I can escape the special character “ and ”. I ...
llesh's user avatar
  • 13
0 votes
0 answers
15 views

Attaching custom escape sequence to kHome key

My idea is to attach an action in vim to kHome key (Home located on numeric keypad) that will not affect ordinary Home key. In terminal I run: $ cat # pressed kHome ^[[1~ # pressed Home ^[[1~ So, ...
user4035's user avatar
  • 1,115
0 votes
1 answer
84 views

Linux program to quote filename only when necessary?

Consider having these directories and files: $ tree /tmp/test /tmp/test ├── dir │   ├── file_normal │   ├── file with "double quote │   ├── file with 'single quote │   ├── file with space │   └── ...
midnite's user avatar
  • 443
2 votes
1 answer
111 views

Vim intercepts ssh escape

There is no issues to solve (that I know of). I am trying to better understand ssh. On my system the ssh escape character is tilde (~). If I ssh somewhere I can use it as expected: me@local$ ssh ...
kill -9's user avatar
  • 23
2 votes
1 answer
145 views

Print Variable containing backslashes

I have something like this: A=$(curl https://mysite.com) and the curl request returns the string \"Hello World\". When I now want to print A to the console using one of: echo "$A" ...
Cake's user avatar
  • 31
1 vote
1 answer
283 views

How to turn off the ANSI escape sequence of Bash?

I am running Jest, and the output would go like: print a line (for a test), and then erase it, and print another line. However, if I use a loop to do the tests (using expect), there is no way to see a ...
Stefanie Gauss's user avatar
1 vote
1 answer
160 views

How to convert all newlines to "\n" in POSIX sh strings

I have a string that contains newline characters. I want to escape all newlines in that string by replacing all newline characters with a string of two characters: "\n". How can I do this in ...
Flux's user avatar
  • 2,978
0 votes
2 answers
95 views

groff -mandoc creating "ESC[1m" versus overstriking with backspace for bold text

I found that groff uses different ways to indicate bold text for the utf8 output format. On FreeBSD 14, groff emits escape codes for a terminal (ESC, [1m): $ printf ".Dd today\n.Sh NAME\n" | ...
Jens's user avatar
  • 1,787
0 votes
1 answer
148 views

How do I escape opening and closing brackets [] to use with cp command?

I have a script that finds some directories and then copies their content to another directory. now the problem is that some of the found directories need to have brackets in their naming and they ...
Sharif Rezvani's user avatar
0 votes
0 answers
273 views

Problem with Loading initial ramdisk in Archlinux (character firing)

In the boot arch initial (Loading initial ramdisk) some characters are appearing, photo below: As well as when switching off, the same characters also appear, photo below: However, sometimes (...
Alexandre Loures's user avatar
0 votes
0 answers
105 views

Properly escape a string variable that contains special characters to be used in a shell script?

I feel dumb for asking such a simple question but Im absolutely stuck on this one. I've search everywhere, tried several methods to escape or properly quote this variable, but no matter what when I ...
ProfessionalAmateur's user avatar
1 vote
1 answer
166 views

What do these strings, '\M^?' and '^\M?', represent in zsh/ZLE?

In the documentation for the Zsh Line Editor, there is a section that says: For either in-string or out-string, the following escape sequences are recognised: \a bell character \b ...
xdhmoore's user avatar
  • 145
0 votes
1 answer
308 views

bash script creating string from number with plus sign

In a bash script, I stumbled over a simple looking problem of creating an expression from a parameter given as number and adding a plus + sign in front of it: YEA= expr $2 \* 365 echo ${YEA} pl="+...
Echo Uni's user avatar
-2 votes
1 answer
78 views

Understanding escapes used for changing text colour

I know that things: To change the output text to red, I need output an escape code like \033[31m. The \ is the escape. The 033 is the ASCII escape code in octal. But my question is, why I need to ...
Magenta's user avatar
  • 15
1 vote
1 answer
53 views

How can I make this command work in bash script? [duplicate]

Here is a command that works perfectly for me on the command-line: find . -type f -exec grep -Hin --include=*.h --include=*.c 'somestring' {} \; When I run the above command substituting the search ...
Vinod's user avatar
  • 165
0 votes
0 answers
37 views

Truncate output to terminal width (colour and wide char aware) [duplicate]

I have the alias: trunc='cut -c -${COLUMNS:-80}' This works just dandy when text doesn't contain colours and wide characters. I could play with tput rmam and tput smam, but these don't actually ...
Tom Hale's user avatar
  • 31.2k
0 votes
1 answer
560 views

How to escape characters inside variables in awk?

I'm trying to make a script that uses awk to get the recent file names from .config/okularrc and pipe them into dmenu, and back to awk to get the path for the name selected. However, I'm getting an ...
white-hat-er's user avatar
0 votes
3 answers
332 views

Handle parentheses in this xargs multi-command

I suspect the following has been answered already but I don't know the terminology for the issue I'm having well enough to find an existing answer. I'm working on a command to go through a list of ...
SSilk's user avatar
  • 153
0 votes
1 answer
100 views

Problem with bash builtin bind and escaping

I'm trying to add a history fuzzyfind hotkey to my bash shell. However, my intended command gets cut in the middle: [april@Capybara-2:~]$ cat ~/.bashrc bind "\"\C-r\": \"\$(...
AprilGrimoire's user avatar
0 votes
1 answer
68 views

Font Effects in 8-Bit and 24-Bit Colour Representations

I want to use 8-Bit and 24-Bit colours in terminal, and have seen some different versions. code="\e[38;5;${if}m" code="\e[38;5;${ir};${ig};${ib}m" I am unsure about the second ...
Vera's user avatar
  • 1
3 votes
1 answer
2k views

Why does escaping double quotes from Python's run (with shell=True) is different than in Bash?

I need to produce JSON configuration files with echo and tee called from my Python script. By trial-and-error I've found out that I have to use single quotes. Yet I don't understand all the behaviour ...
John Smith's user avatar
1 vote
1 answer
298 views

ANSI escape sequences in PS1 cause incorrect length calculation [duplicate]

I have a PS1 set up in my .zshrc which includes multiple ANSI escape sequences. An equivalent definition works nicely in Bash, but in Zsh (v5.8.1) it seemingly causes the shell to calculate the width ...
Konrad Rudolph's user avatar
3 votes
2 answers
537 views

Why does `htop` display `$'\t'` as `?` in `sort` command?

I was running a pipe command with one section being the following: sort -t $'\t' -T . -k1,1g When I was monitoring htop I saw this instead: What is the reason behind this? Does this mean my command ...
paropunam's user avatar
  • 257
3 votes
0 answers
850 views

Weird garbage (ansi escape characters?) in terminal when running VIM command

I have a script, that when run sometimes/often outputs an "unescaped" ANSI escape sequence when encountering this line: vim -X -u NONE -c "helptags ~/.vim/plugged/vim-fugitive/doc" ...
oligofren's user avatar
  • 1,170
1 vote
1 answer
1k views

echo -e \e does not print an escape from bash script on macos

I just moved to Mac. I'm using a shared shell script that's running in bash. The script itself works, however it is written to produce colored output, and that is broken. Here's the first two lines ...
Matthias's user avatar
  • 111
-1 votes
1 answer
630 views

Explain: echo -e "\e]52;;HelloWorld"

I think this is an OSC 52 statement and it will sent HelloWorld to the host clipboard if you use a OSC 52 supported terminal like Windows Terminal. I also know that -e will enable interpretation of ...
MrCalvin's user avatar
  • 699
0 votes
2 answers
213 views

Show quotes with echo inside bash -c

I am trying to echo I say "Hello, World!" with bash -c. This is (some of) what I have tried: $ bash -c "echo I say \"Hello, World"'!'"\"" $ bash -c "echo I ...
Liviu's user avatar
  • 105
0 votes
3 answers
427 views

How to interpret \e[H\e[2J ANSI escapes sequence from Linux terminal?

I'm asking again the question that was asked on StackOverflow with no answers I event added a bounty without an effect (I've just deleted that one). I think that people here may have better knowledge ...
jcubic's user avatar
  • 10k
1 vote
0 answers
135 views

Use altscreen like vim with screen with Ubuntu XTerm

When I exit a screen, I want to be able to return to the terminal looking as I left it. But right now, all I can do is have it clear the screen and put the terminal at the top or the bottom through ...
Jeff's user avatar
  • 123
1 vote
0 answers
34 views

What the... Variable String [duplicate]

I believe I am running into a scenario where escaping quotes and utilizing variables as strings is causing some issues and after some hours of troubleshooting this isn't seeming to come to a ...
Nathan's user avatar
  • 23
1 vote
1 answer
243 views

Strange escape sequences in terminal

I have kitty, and I use nnn as file manager. I actiavted the "preview-tui" plugin in nnn. When I hover over a folder, I see something like this: What are those strange escape sequences?
robertspierre's user avatar
0 votes
1 answer
200 views

How to make xterm recognize control-slash?

When I'm using an xterm, the keyboard sequence Ctrl+/ produces Ctrl-_. Here is the result of showkey -a when first hitting Ctrl+Shift+-, then hitting Ctrl+/. I am on a US ANSI keyboard. [ ~ ] showkey ...
Ajean's user avatar
  • 101
3 votes
0 answers
403 views

What is the meaning of ESC ( B ANSI escape code?

I'm working on the ANSI escape codes interpreter and I have this escape code from the top command. [K [7m PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ...
jcubic's user avatar
  • 10k
0 votes
0 answers
364 views

mkdir - create directory (with ":" in its name) does not work in specific directory, works in others

I am trying to create a directory for a movie on my Plex media server and ran into a strange issue. When I try to make a directory with the movie name ("Borat: Cultural Learnings of America for ...
Saar Koren's user avatar
9 votes
3 answers
2k views

Why do `ctrl+[` and `ESC` both produce `^[`? [duplicate]

In bash, I press ctrl+v to start verbatim insert. In the verbatim mode, I press the Esc key and bash shows ^[. I redirect it to file esc. Also in the verbatim mode, I press ctrl key with [ key, and ...
Gqqnbig's user avatar
  • 239
0 votes
1 answer
1k views

Prevent splitting command line argument at spaces when running in bash script [duplicate]

I'm trying to run a command in a bash variable, like this: cmd="python -m mymodule 'argument 123 456' argument2=32 argument3=234" $cmd It looks like it is splitting the command line ...
user1506145's user avatar
-4 votes
5 answers
5k views

How do I create a file named \*\\'"Best School"\'\\*$\?\*\*\*\*\*:) on linux with touch command [closed]

I have had these issues for a while now. I've tried different approaches, all to no avail.
daviSPhem's user avatar
3 votes
3 answers
2k views

Accurately overwriting previous lines of bash terminal output when text is wider than terminal (e.g. wraps mutliple lines)?

TL;DR - I know how to overwrite lines of output normally but none of the methods I've used previously (e.g. printf '\e[1A\e[2K') or have found online seem to work when the line being overwritten is ...
zpangwin's user avatar
  • 891
0 votes
1 answer
43 views

I am trying to understand what a particular echo statement does

I am trying to understand what the second echo statement does exactly (it's an existing script).. echo "Triggering report.. " curl -s -X POST "http://aaa.bbb" echo -e \ '\ ' I ...
Teddy's user avatar
  • 103
1 vote
0 answers
385 views

Is it possible to scroll arbitrary regions in a terminal?

I am researching the possibility of using an SSH connection for hosting a real-time, text based multiplayer game. It would be convenient for users to be able to type in "ssh mygame.com" and ...
DivideByZer0's user avatar
0 votes
1 answer
91 views

zsh: How can I escape each word separately?

How can the following list of commands can be quoted separately? s="cp mkdir [[ mv rm" quoted_s= ???? This should be the output of echo $...
Udi's user avatar
  • 183

1
2 3 4 5
10