How to print unicode character in Linux ?

Today we will look what are unicode characters in Linux and how to print these characters in Linux.

Unicode represents a computer encoded language standard for presentation, expression and handling of text used in most of the world’s computing systems.


Printing Unicode Characters

1. On Bash or Z Shell & in Python

### In Bash shell above version 4.2 or in Z Shell
[root@nglinux ~]# echo -e "\u2621"
### \u - Unicode escape sequence
### 004C - Hexadecimal number

### Using python on Bash Shell
[root@nglinux ~]# python -c 'print u"\u2621"'

2. On Old Bash shell by uing utf-8 format

[root@nglinux ~]# echo -e '\xE2\x98\xA1'

Using above way, we can print all available unicode numbers.

Lets see an example how to print copyright unicode character.

3. Printing copyright symbol.

### Using python
[root@nglinux ~]# python -c 'print u"\u00A9"'

### using utf-8 hexadecimal encoding
[root@nglinux ~]# echo -e '\xC2\xA9'
[root@nglinux ~]# 

I hope you liked the idea.

Lets have a look at the available unicode characters.

Unicode Character Table

To get their unicode characters corrosponding to the system, you may have a look at the site:

After getting the unicode chacracter, we need to convert them to unicode UTF-8 hexa decimal representation to look the system on all bash shells.

We can use application on to get the hex code.

Leave a Reply

Your email address will not be published.