Questions tagged [special-characters]

If it has a meaning beyond its literal meaning, a meta-meaning, then we refer to it as a special character.

Filter by
Sorted by
Tagged with
161
votes
11answers
214k views

What is `^M` and how do I get rid of it?

When I open the file in Vim, I see strange ^M characters. Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here: What is this ^M ...
112
votes
2answers
10k views

Is Vim immune to copy-paste attack?

You should never paste from web to your terminal. Instead, you should paste to your text editor, check the command and then paste to the terminal. That's OK, but what if Vim is my text editor? Could ...
98
votes
7answers
99k views

Can't use exclamation mark (!) in bash?

I'm trying to use the curl command to access a http url with a exclamation mark (!) in its path. e.g: curl -v "http://example.org/!287s87asdjh2/somepath/someresource" the console replies with bash: ....
78
votes
7answers
8k views

How safe is it to cat an arbitrary file?

Sometimes when I cat a binary file by mistake, my terminal gets garbled up. Nothing a quick reset can't fix, but couldn't an attacker theoretically create a file that, when displayed on a terminal, ...
48
votes
16answers
27k views

How can I delete a file which filename has non-printing characters

I somehow managed to create a file that doesn't seem to have a filename. I found some information regarding how to get more details of the file in the following thread. However, I tried some of the ...
31
votes
3answers
13k views

What is the Mode_switch modifier for?

Playing with xmodmap I encountered a modifier key I hadn't heard of: Mode_switch. It seems to have something to do with inserting special characters. I assigned it to a key but it seems to have no ...
30
votes
10answers
3k views

Dealing with file names with special first characters (ex. ♫)

I have recently come across a file whose name begins with the character '♫'. I wanted to copy this file, feed it into ffmpeg, and reference it in various other ways in the terminal. I usually auto-...
29
votes
2answers
7k views

How to avoid escape sequence attacks in terminals?

Reading the details of CVE-2009-4487 (which is about the danger of escape sequences in log files) I am a bit surprised. To quote CVE-2009-4487: nginx 0.7.64 writes data to a log file without ...
25
votes
3answers
12k views

Understanding Unix file name encoding

I have a hard time understanding how the file name encoding works. On unix.SE I find contradicting explanations. File names are stored as characters To quote another answer: Several questions about ...
25
votes
2answers
37k views

What does the tilde (~) mean at the end of a filename? [duplicate]

What is the file with the ~ at the end of the filename for? $ ls # aliased to add flags -rwxrwxr-x 1 durrantm 2741 May 16 09:28 strip_out_rspec_prep_cmds.sh~* drwxrwxr-x 13 durrantm 4096 May 16 14:...
24
votes
10answers
15k views

How do I type the degree symbol under X11 (using a default English keyboard layout)?

I'm trying to put in an email the temperature outside in degrees. On my Mac, the degree symbol (°) is Option+Shift+8. But I'm writing the email in Thunderbird on an Ubuntu 10.10 with the default US ...
22
votes
8answers
8k views

how to type “smart quotes” (U+201C, U+201D)

It's like this: “ (U+201C) ” (U+201D).
22
votes
2answers
10k views

What does CTRL+4 (and CTRL+\) do in bash?

I just found out by accident that CTRL + 4 closes programs reading stdin input from the command-line. This is how it looks when I type CTRL + 4 or CTRL + / into programs reading stdin $ cat ...
21
votes
5answers
2k views

How can I find the common name for a particular glyph?

Sometimes, I'd like to know the name of a glyph. For example, if I see −, I may want to know if it's a hyphen -, an en-dash –, an em-dash —, or a minus symbol −. Is there a way that I can copy-paste ...
19
votes
2answers
1k views

Grep: unexpected results when searching for words in heading from man page

I'm running into weird behavior when trying to grep a man page on macOS. For example, the Bash man page clearly has an occurrence of the string NAME: $ man bash | head -5 | tail -1 NAME And if I ...
18
votes
1answer
2k views

Why is the circumflex/caret character used as a symbol for Ctrl?

I started using the Linux console a long time ago but I never questioned myself about the circumflex aka caret character (^). I'd like to ask why it's used as a replacement for the word Ctrl. I ...
14
votes
3answers
39k views

How do I put a hat on 'e' (ê)?

Since I've migrated to linux a few years ago, one issue still remains. The ê character features a lot in my "moeder taal" (home language). In Windows making the character was easy, I simply had to ...
14
votes
2answers
8k views

How can I write a non-breaking space? [closed]

Some word processing programs have a menu for entering special characters, including non-breaking spaces. It is also possible to copy the character created in the word processing program and paste it ...
14
votes
3answers
65k views

Search and replace control characters (^@, ^M, ^I…) in vi

I copied this line from /proc/some_proc_id/cmdline in my ubuntu machine, java^@-jar^@/usr/lib/selenium/selenium-server-standalone.jar^@-port^@4444^@-trustAllSSLCertificates^@ Somehow, the space ...
14
votes
4answers
26k views

How to grep for pipe |

How can I grep for line containing pipe character | or for character >: files content: |this is test where is > this is none now what I need using grep command is grep -iE "<some ...
13
votes
2answers
45k views

What does ^d mean in ls -l | grep ^d?

When I do ls -l | grep ^d it lists only directories in the current directory. What I'd like to know is what does the caret ^ in ^d mean?
13
votes
2answers
67k views

How to use a special character as a normal one?

Many questions like 'How to type the double-quote char (")?' are being asked, and we don't want to clutter our community with the same answer (Type it as \" if not enclosed in 's, " if enclosed in 's.)...
13
votes
2answers
9k views

How to display control characters (^C, ^D, ^[, …) differently in the shell

When you type control characters in the shell they get displayed using what is called "caret notation". Escape for example gets written as ^[ in caret notation. I like to customize my bash shell to ...
12
votes
7answers
12k views

What is the symbol *.* called?

What's the name for the *.* symbol and what is its significance?
11
votes
2answers
4k views

Match with grep when pattern contains hyphen “-”

I wrote the following command in order to match $a with $b, but when the value includes "-", then I get an error. How can I avoid that? # a="-Xmx5324m" # b="-Xmx5324m" # # # echo "$a" | grep -Fxc "$...
10
votes
2answers
4k views

Is the “tick” or “acute accent” character ´ (not `) used for anything in Linux shell?

We know that the backtick character is used for command substitution: chown `id -u` /mydir Which made me wonder: is the tick character ´ used for anything in the Linux shell? Note: incidentally, ...
10
votes
3answers
33k views

BASH and Carriage Return Behavior

I have one quick question. Is it normal that bash (i am using 4.4.11) is not displaying lines/text that is separated / end with plain \r ? I was a bit surprised to see this behavior: $ a=$(printf "...
10
votes
2answers
21k views

special character in filename (\#033OA)

I've got a slight problem with a very stubborn error during an rsync. It's caused by a file with a special character in its filename. There's been others but I could sort that out by doing some ...
9
votes
1answer
1k views

Mac-style option/alt key special characters on Linux

I'm on a Mac keyboard and I would prefer to have special characters available similar or the same to how they are accessed in OS X/macOS. Here is a similar question for Windows. E.g., alt+e+e → é and ...
8
votes
2answers
1k views

Why doesn't the command tr “\'\\\”\?\!“ ”01234" work?

In terminal, if I define some variable char as follows: export char=\'\\\"\?\! In effect, char is the string '\"?! And then I use the tr command to replace '\"?! with numbers 01234 tr "\'\\\"\?\!"...
8
votes
2answers
1k views

Command line input while a running script displays strange symbols

If I use the bash shell cli and run some program which doesn't return immediately, then I input some letters (basically typing the next command before noticing the previous didn't finish) and the ...
8
votes
2answers
1k views

Difference between ' and " on command line (bash)? [duplicate]

I used to use '' and "" (single and double-quotes) interchangeably on the command line, but I recently noticed that '$HOME/some/dir' is not expanded, while "$HOME/some/dir" is. I searched around a ...
7
votes
3answers
445 views

Why doesn't `echo abc^H` just print `ab`?

As I recall, ^H means Backspace. I generated it by pressing CTRL+V, CTRL+H. So the ^H should remove the last character, as it is the same as Backspace and it should act just as if I pressed Backspace ...
7
votes
3answers
7k views

How to print a variable that contains unprintable characters?

I want to display the value of the $IFS variable, which could contain unprintable characters (for example: newline). I used the following command to do so: echo -n "$IFS" | hexdump -C Which worked ...
6
votes
3answers
6k views

How to match a string containing the character “$” with grep?

How to match strings that contain $ character? Example - by the following grep doesn't return the match. param="ambari_parameter$" echo "ambari_parameter$" | grep $param echo "ambari_parameter$...
6
votes
2answers
3k views

Is there a way to find files containing only non-printing characters?

I've got a program that's behaving badly and has created a number of files with only a few non-printing characters. If I were to cat the files, I see nothing (since they are non-printing chars). ...
6
votes
1answer
1k views

How to detect and delete lines containing ˆ@

I have a simple problem: In my file, the are lines containing the string ˆ@ˆ@ˆ@ˆ@ˆ@ˆ@. I just want to delete all lines with this string, using for example the sed or grep commands. And I would like ...
6
votes
1answer
3k views

Using accents in Vim seamlessly

Very often I need to write text/program in foreign languages that need accents and special characters in vim, but sometimes it is very hard to get that working. What are the best alternatives to ...
6
votes
1answer
2k views

Representing/quoting NUL on the command line

Can \0 be used on the command line? Background For testing corner cases in GNU Parallel I was curious whether all characters were correctly quoted on the command line. Most of them are: perl -e '...
6
votes
2answers
239 views

How many commands can be queued up with control operators?

I have been reading up on control operators, and I was wondering if there was a limit to how many commands you could line up with control operators, such as ||, && and ;. In addition, is ...
5
votes
6answers
2k views

How do I remove a file I accidentally created named $file?

I was working on a shell script and I accidentally created a file with the variable as its name. Now I have $file in my ls output, and cannot remove it. What can I do?
5
votes
5answers
2k views

What are the special characters to print from a script to move the cursor?

I found that by printing \r from a script the cursor moves to the beginning of the line. What character will move the cursor up one line? Where is a list of these special characters? EDIT: Working ...
5
votes
2answers
2k views

Grep words with special symbols

How do I grep this? (Including the special characters) "Limit reached."[\n]" I tried back-slashing the special symbols but end up not working, like this: grep '\"Limit reached\.\"\[\\n\]\" ' I ...
5
votes
2answers
1k views

Relations between control characters, signals and terminal

What are the relations between control characters and signals? Or are they unrelated? Are control characters received by a terminal? After a terminal receives a control character, is the terminal ...
5
votes
3answers
925 views

How do I properly escape weird characters in a bash script?

I am no professional in scripting or find commands what so ever (Just a warning). I am trying to create a script that can move all my mp3 podcasts to a folder that I can then move to my phone. So ...
5
votes
2answers
5k views

How to skip special / socket files during rsync transfer?

Using the following command. rsync --archive --delete --partial --progress --recursive --no-links --no-devices --quiet source target Using --no-links and --no-devices already. Getting the error ...
5
votes
1answer
1k views

using ! character in echo

I am messing with echo and having issues with echo displaying the ! character. I tried this. echo -e "Wake!\nUp! bash: !\n!: event not found Then this # echo "Wake\!\nUp!" Wake\! Up! Well now the ...
5
votes
3answers
6k views

Help Shell script to pass variables to rsync

I'm trying to create a simple wrapper shell script for rsync. When I send file names to my script, rsync can never seem to identify the correct location. The file names have spaces in them. I've tried ...
5
votes
6answers
2k views

Rename folder with odd characters

I have a folder on my Mac called "␀␀␀␀HFS+ Private Data". I'm trying to delete it but it contains a bunch of odd characters that are choking unlink, rm and mv, making it difficult to remove it and ...
4
votes
4answers
1k views

Unable to remove the $ sign named files using linux? [duplicate]

Here is my ls command, which shows the list of files in my current directory: rper: ls -l $commandoutput[0] file.txt I tried to remove $commandoutput[0] line by using rm -rf $commandoutput[0], ...