Skip to content

`free -b` missing space when LANG is set to chinese

My locale variable is set as

LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

and command free -b result is

               total        used        free      shared  buff/cache   available
内存:25048236032  2680832000 13017890816  1001254912  9349513216 20966502400
交换:          0           0           0

There is no space between term column and total column. It is unfriendly for awk for later operations. For example: this

Edited by Hao Zhang