In Linux, any special character can be literally inserted on the terminal by pressing Ctrl+v followed by the actual symbol. null is usually ^@ where ^ stands for Ctrl and @ for whatever combination on your keyboard layout that produces @.
So on my keyboard I do: Ctrl+v followed by Ctrl+Shift+@ and I get a ^@ symbol with a distinguished background color. This means it's a special character and not just ^ and @ typed in.
Edit: Several years later and a few input variations implemented by different terminals using keyboard layouts that require pressing Shift to access @.
- Ctrl+v followed by Ctrl+Shift+@
- Ctrl+v followed by Shift+@ without releasing Ctrl.
- Ctrl+Shift+v followed by @ without releasing Ctrl+Shift.
- Ctrl+Shift release Shift and re-press Shift keeping both Ctrl+Shift pressed followed by v and finally @. Seen in some terminals that implement a special input on Ctrl+Shift.
In Linux, any special character can be literally inserted on the terminal by pressing Ctrl+v followed by the actual symbol. null is usually ^@ where ^ stands for Ctrl and @ for whatever combination on your keyboard layout that produces @.
So on my keyboard I do: Ctrl+v followed by Ctrl+Shift+@ and I get a ^@ symbol with a distinguished background color. This means it's a special character and not just ^ and @ typed in.
Edit: Several years later and a few input variations implemented by different terminals using keyboard layouts that require pressing Shift to access @.
- Ctrl+v followed by Ctrl+Shift+@
- Ctrl+v followed by Shift+@ without releasing Ctrl.
- Ctrl+Shift+v followed by @ without releasing Ctrl+Shift.
- Ctrl+Shift release Shift and re-press Shift keeping both Ctrl+Shift pressed followed by v and finally @. Seen in some terminals that implement a special input on Ctrl+Shift.
$ echo -e "this is a sentence \0 test123"
this is a sentence test123
The null here ^^ IS NOT visible
$ echo -e "this is a sentence \0 test123" | cat --show-nonprinting
this is a sentence ^@ test123
But it IS here ^^
But maybe you did not want this for a script?
How can I type the null sign?
How can I type the null sign?
How to simulate NUL character from keyboard? - Stack Overflow
bash - Using/reading/writing the null and escape characters - Unix & Linux Stack Exchange
In Linux, any special character can be literally inserted on the terminal by pressing Ctrl+v followed by the actual symbol. null is usually ^@ where ^ stands for Ctrl and @ for whatever combination on your keyboard layout that produces @.
So on my keyboard I do: Ctrl+v followed by Ctrl+Shift+@ and I get a ^@ symbol with a distinguished background color. This means it's a special character and not just ^ and @ typed in.
Edit: Several years later and a few input variations implemented by different terminals using keyboard layouts that require pressing Shift to access @.
- Ctrl+v followed by Ctrl+Shift+@
- Ctrl+v followed by Shift+@ without releasing Ctrl.
- Ctrl+Shift+v followed by @ without releasing Ctrl+Shift.
- Ctrl+Shift release Shift and re-press Shift keeping both Ctrl+Shift pressed followed by v and finally @. Seen in some terminals that implement a special input on Ctrl+Shift.
Another suggestion is you can also type: Alt + 0216.
Best regards,
Dan
Hi! I'm Dan! An Independent Advisor and also a Microsoft user for several years. I'll be more than happy to assist you today!
Method 1:
The โ symbol can be entered by going into "Symbols", choose "Mathematical Characters" and from the dropdown "Subset".
Method 2:
Type 2205 and then press "Alt + X".
I hope this information is helpful. Please keep me updated on the status of this issue. If you have any more questions, feel free to ask and I will be glad to assist you.
Standard Disclaimer: There are links to non-Microsoft websites. The pages appear to be providing accurate, safe information. Watch out for ads on the sites that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the sites before you decide to download and install it.
Best regards,
Dan
This is not possible to do with Notepad, however, it can be done with a more advanced editor.
With Notepad++
Go to
Edit > Character Panelto show the ASCII Insertion Panel.Put the cursor where you want to insert the character.
Double-click the character (in the Character column) to insert.

With Notepad++
From HEX
- Type 00 00 00
- Select this text
- TextFX > TextFX Convert > Convert Hex to text
From Base64
- Type AA==
- Select this text
- Plugins > MIME Tools > Base64 Decode
The mapping is:
NUL -> AA=
NUL NUL -> AAA=
NUL NUL NUL -> AAAA
Printing the null character
On many recent shells you can write null character with dollar single quotes format $'\0', hexadecimal format \x00, unicode format \u0000 or \U00000000, or just as you tried with octal: '\0'. The point is that the command has to understand what to do with backslash-escaped characters. For example in case of echo usually one needs to add -e option and in case of printf that would be %b.
Let's check if it works:
$ echo -ne '\0'
$
So produces nothing, just like echo -ne '', similar
$ printf '%b' '\0'
$
Let's add some characters around (I will stick with printf '%b' from now on as more robust, but similar effect is with echo -ne):
$ printf '%b' a'\0'b
ab
Only two characters were printed, where did the null go?
$ printf '%b' a'\0'b | wc -c
3
Let's compare it with a''b:
$ printf '%b' a''b | wc -c
2
Last more check that we really print null character before trying to create file, let's pass the printed value to the command which will throw the error, like xargs:
$ printf '%b' a'\0'b | xargs echo
xargs: Warning: a NUL character occurred in the input. It cannot be
passed through in the argument list. Did you mean to use the --null option?
a
Notice how only a was printed at the end. Of course xargs -0 works fine:
$ printf '%b' a'\0'b | xargs -0 echo
a b
Creating the file with null?
Now let's try to create file with null character:
$ touch $'\0'
touch: cannot touch โโ: No such file or directory
$ mkdir $'\0'
mkdir: cannot create directory โโ: No such file or directory
# let's try another approach - using printf in command substitution:
$ touch "$(printf '%b' '\0')"
touch: cannot touch โโ: No such file or directory
$ mkdir "$(printf '%b' '\0')"
mkdir: cannot create directory โโ: No such file or directory
The result is exactly the same as in touch '', it seems null is just ignored all together. What if we skip double quotes around command substitution?
$ touch $(printf '%b' '\0')
touch: missing file operand
Try 'touch --help' for more information.
$ mkdir $(printf '%b' '\0')
mkdir: missing operand
Try 'mkdir --help' for more information.
This is the same situation as touch/mkdir without arguments at all. Yet another result is if we surround null with text:
$ touch "$(printf '%b' a'\0'b)"
$ ls
a # in zsh
ab # in bash
One can also try to redirect standard output to $'\0' but all one gets is different kind of error.
Single/double quotes vs. backslash: single quotes and backslashes are equivalent in quoting power. It's a lot more convenient to use single quotes to quote a long string with spaces, tabs, newlines, ()[]*$><?|{}~&;"`^!# and probably other characters I'm forgetting. But you could achieve exactly equivalent results with just backslashes (beware of the overloading of backslashes within backticks (`...`) though)
Double quotes are unique, though. $ expands inside double-quotes, but not single. "$foo" expands foo, but protects the expanded result from word-splitting and glob expansion.
http://mywiki.wooledge.org/BashFAQ might be a good place to start. The bash manual doesn't spend much time on how to use all the features it describes, just how they work individually.
It's literally not possible to pass a string containing a zero-byte as a command line argument, or to a system call. The ABI (application binary interface) that specifies exactly how data is passed between processes and the kernel uses C strings for everything (except binary data), including command line arguments and file / path arguments to system calls. C strings are character arrays where the end-of-string is marked by a zero-byte. There is no way to "escape" a zero byte to indicate that it's not the end of a string.
Any attempt to do something like touch $'foo\0bar' would just result in touch seeing its argument list as
argv[0] = "/bin/touch";
argv[1] = "foo";
Even though sitting in memory, argv[1] = "foo\0bar\0", the first \0 marks the end of the string. Actually, "foo\0bar\0" wouldn't make it as far as the new process's argv. It wouldn't make it out of the argv array in the exevce(2) system call that ran touch.
And even if you wrote a C or perl program with character arrays / strings containing null bytes, passing them to a system call like open(2) would cause the same interpretation of the string by kernel. System calls that need to handle arbitrary data, like read(2) and write(2), take a length argument as well as a pointer to the buffer.
It's not even possible to do much of anything with null bytes with bash. As jimmij points out, the bash syntax for writing a string literal with escape-sequence processing is $'string', but writing a \0 in your string literal acts as a string terminator inside bash. I guess this means bash stores strings internally as C strings, not with an explicit length.
str=$'foo\0bar'
echo "${#str}" # 3, showing that bash isn't even storing it in a variable.
echo "$str" | wc -c # 4. wouldn't work even if ${#str} did: echo's cmdline would eat it
wc -c <<< $'foo\0bar' # 4 (includes a newline)
So we can't use this syntax to send a null byte anywhere. We'd have to use tr or something.
However, bash printf does have some limited support for \0. The %b conversion processes backslash escapes, including \0. And printf already processes such escapes in its format string.
printf '\0'prints a zero byte. Pipe it intohexdump -Cto confirm.printf '%s\0%s' foo bar | hexdump -Cwritesfoo.bar(where . is a NUL byte) to stdout. Note that\0inside single or double quotes doesn't expand on its own; only$'\0'quoting would expand it before printf, which would make it act as a terminator.printf '%b' 'foo\0bar'does the same thing, but more complicated.
I was able to do this using TamperData Firefox plugin.
https://addons.mozilla.org/en-US/firefox/addon/tamper-data/
When given the Tamper Popup I typed "%00" in the Post Parameter Value field.
Still, I cannot find a way to type a null character just using the keyboard.
my suggestion would be to write the null character to an html element you would like it in ex:
document.getElementByID("my_null_tag").innerHTML += "\0"
You can do this with the Unicode Hex Input method (enable it in System Preferences โ Language & Text pane โ Input Sources tab, and then select it from the menu item) by holding Option and typing "0000".
Warning: the null character is not allowed in C-language strings (it's used to indicate the end of the string), so not all programs will cope with it. In TextEdit, for example, you can insert a null into a document, but when you save the document it'll only save the part before the null.
It depends on your terminal. In Terminal.app and iTerm2, you can use ^@ (Ctrl + Shift + 2). See here.