How to input hash (#) symbol to terminal?
Alt
is used as Meta on your system. That's why it behaves strangely in nano
and bash
.
On Ubuntu server (command-line only) with British keyboard layout, you need to press the right alt
key to get the hash symbol #
: Only the right alt
is interpreted as alt-gr
by your Linux system, and that's the modifier key required on non-Mac OS systems for the alternative characters on the keyboard.
I just came across this as I'm doing my LPIC and using a MB Pro running CentOS in a VM.
Ended up being CTRL+\
Ubuntu 12.04 with UK keyboard, installed on a MacBook Pro. Unfortunately the right-side Alt3 only emits a superscript "2", not the hash, And the left-side Alt3 prints nothing.
Going to System Preferences » Keyboard I can see that my current keyboard is listed as: English (UK, MacIntosh international)
.
Clicking on the little "keyboard" button at the bottom shows the position of all characters on each key. So for me the hash #
is Right-Ctrl|\ (right Alt, pipe and backslash). One of the previous posts said Alt but it was Ctrl