I have found a file called ¬ on an old legacy Solaris server and I am confused about how to interact with it on the command line (bash 2.05).

¬ has the same function on the command line as the home key. When I press it, it moves the cursor to the start of the line. So if I try to remove it by typing rm ¬ I end up with with just rm.

I created a file called file with vim and was able to insert the ¬ character. The thing is, each program sees this character differently. Some examples:

bash-2.05# cat file

bash-2.05# vim file

bash-2.05# vi file

bash-2.05# less x
"x" may be a binary file.  See it anyway? 

bash-2.05# more file

bash-2.05# ls 

bash-2.05# ls -q 

bash-2.05# ls -b 

I was able to remove the file by running rm $(cat file). But my question is, how do I remove it by typing it on the command line? rm \302\254 didn't work and I'm not sure what to do with the Hex representation that less gives.

Is there a special way to insert ¬ into the command line?

I realise this might be quite hard to replicate since it is so old, but I thought I would ask anyway.

Thanks, Patrick

  • 3
    someone else may have a smarter answer, but if you can see (with ls -q or ls -b) that it's a single character, my fall-back in these situations is "rm -i ./?" to have rm ask you before removing any/all single-character files
    – Jeff Schaller
    Aug 18, 2016 at 0:09
  • If your terminal is properly setup, the character ¬ requires no special handling and rm ¬ will work.
    – John1024
    Aug 18, 2016 at 0:14
  • If you've created a file with the right character, then try rm -i $(cat file) Aug 18, 2016 at 0:19
  • 2
    Does typing Ctrl+V and then the ¬ character types it out for you? That may depend a lot on keyboard setup
    – grochmal
    Aug 18, 2016 at 0:30
  • 1
    @John1024 Genius :) That's what I am after. Thank you! Aug 18, 2016 at 0:31

4 Answers 4


The character ¬ is UNICODE code point U+00AC or 172 (decimal).

When represented in utf8 it becomes the two bytes xC2 and xAC (in hex),
or the equivalent octal values of \302 and \254.

That's why you can print such character in several ways in bash:

$ printf '\302\254'         # Add a \n to add a new line.

$ printf '\xC2\xAC'

$ echo -e '\0302\0254'        # Bash echo is special for requiring -e.

$ echo -e '\xC2\xAC'

$ echo $'\302\254'

$ echo $'\xC2\xAC'

Or even the UNICODE value directly (only if your console has been correctly set to use utf8 and since [Feb 27, 2011] Bash version 4.2, not for bash 2.05):

$ echo $'\u00AC'

$ echo $'\U000000AC'

Any of the methods above will work with Command-Substitution to pass the character as an argument to the command rm:

$ rm "$(printf '\xC2\xAC')"

If your console has been set up correctly.
You may get the character ¬ printed in the screen using CTRL-V and then the home key.

From Wikipedia

Unix interactive terminals use Control-V to mean "the next character should be treated literally" (the mnemonic here is "v is for verbatim")

rmspaceCTRLvhome# what you type.
rm ¬# what you get.

And, of course, if you could copy and paste

Select the character you want to use with the mouse:

left-click just before the character
move the mouse one character to the right
release the mouse left-click

Then press ctrlinsert to copy. It may be possible that you will need to right-click (a select window will appear) and select copy.

And move the cursor to the place where you will like to insert the character

and press shiftinsert to paste.

With this last method you may actually write the command:

$ rm ¬
  • ctrl-v is a must
    – Emmanuel
    Aug 18, 2016 at 12:22


rm $'\xc2\xac'

The unicode character ¬ in UTF-8 encoding consists of bytes c2, ac and the above uses bash's $'...' feature to enter those bytes in hexadecimal form.

In a terminal that supports unicode, this is not necessary: one can simply use rm ¬. This work-around is only needed when unicode is not supported.


Bash's $'...' feature (added in 2.0, copied from ksh93, also available in zsh, mksh and FreeBSD sh) is quite powerful. From man bash:

Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded as follows:

          \a     alert (bell)
          \b     backspace
          \E     an escape character
          \f     form feed
          \n     new line
          \r     carriage return
          \t     horizontal tab
          \v     vertical tab
          \\     backslash
          \'     single quote
          \"     double quote
          \nnn   the eight-bit character whose value is the octal value nnn (one to three digits)
          \xHH   the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
          \uHHHH the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHH (one to four hex digits)
                 the  Unicode  (ISO/IEC  10646) character whose value is the hexadecimal value HHHHHHHH (one to eight hex
          \cx    a control-x character

We used only the \xHH form (added in 2.02) in order to enter the bytes as hexadecimal.

The \uHHHH one, copied from zsh was only added in 4.2 so wouldn't work for you, but with more recent versions of bash (or zsh or ksh93 or mksh or FreeBSD sh), and assuming the current locale uses the UTF-8 charset, you could also do:

rm $'\u00AC'
  • @StéphaneChazelas Thanks for adding all the compatibility and version info.
    – John1024
    Aug 18, 2016 at 18:38

By using single quotes, you may avoid all types of shell expansion and everything is taken just as it is. For example, rm '¬' should delete the file.

  • But my problem is when I press ¬, ¬ is not entered onto the command line, my cursor is instead moved to the start of the line. It acts the same way if I were to type something and then press the home key on my keyboard. Aug 18, 2016 at 0:18

How about

rm -i * 

in the directory where the file lives?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .