How do I print and in Unix?

I have a script written in bash and I am printing some numbers with whom I want to print arrow keys to show increase/decrease. How do I literally print these arrow keys (let's say I assign them to some variable and print these along with my numbers) with my numbers using echo or printf in my shell script?

Using below link I tried:

echo -e '\x1b\x5b\x35\x7e'

but it does not print anything. I can't find how to print arrow keys in this link.

  • 1
    What's wrong with printf '↑'?
    – Marco
    Aug 11, 2015 at 12:59
  • Not Sure ..but how to get ↑ there in my unix m/c? Aug 11, 2015 at 13:06

2 Answers 2


With bash 4.2 and above (or ksh, mksh, pdksh, lksh, zsh), you can use ANSI C Quoting:

echo $'\U2191'

or setting locale with unicode characters:

LC_ALL=C.UTF-8 printf '\U2191\n'

or you can use perl instead:

perl -CS -le 'print "\x{2191}"'
  • #!/bin/bash echo "hello" echo $'\U2191' ( LC_ALL=C.UTF-8 printf '\U2191\n' ) Output: hello \U2191 \U2191 ..Am i doing anything wrong Aug 11, 2015 at 13:28
  • What is your bash version?
    – cuonglm
    Aug 11, 2015 at 13:32
  • version 3.2.52 . Aug 11, 2015 at 14:38
  • @user1107108: It only work with bash 4.2 and above.
    – cuonglm
    Aug 11, 2015 at 14:43
  • â ...is printed with perl ...is it that my terminal does not support it at all Aug 11, 2015 at 15:19

Go to the unicode table: http://unicode-table.com/en/sets/arrows-symbols/, pick up the arrow you like, and then print it with the appropriate code preceded by \u:

echo -e "\u2191"

or even better use printf:

printf "\u2191\n"
  • both above just prints - \u2191 Aug 11, 2015 at 13:12
  • @user1107108 What happens when you just copy with mouse the ↑ character and paste it into terminal?
    – jimmij
    Aug 11, 2015 at 18:42
  • it converts it to a . (dot) Aug 12, 2015 at 8:20

You must log in to answer this question.

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