Get the App
SLTechnology News&Howtos  ›  Servers  › 

The usage of locale, bc and date under linux

Shulou Source: shulou.com Published: 2022-06-02 04:03:48 11月15日 Update

Editor to share with you how to use locale, bc and date under linux. I hope you will gain a lot after reading this article. Let's discuss it together.

Today I'd like to introduce some very useful linux commands.

Locale

First of all, let's look at how to set up and view the current language family. Generally speaking, after we install the linux system, the system uses the English language family by default. To view the current language family, you can use the following command:

# echo $LANGen_US.UTF-8

If you want to change it to the Chinese language family, how to do it. First of all, we need to see whether the package in the language family currently supported by the system does not include Chinese. Check the language family supported by the system by using the following command:

# locale-aaa_DJaa_DJ.iso88591aa_DJ.utf8aa_ERaa_ER@saaho. Zh_CN.utf8...

Zh_CN.utf8 this is the Chinese language family you need. Now, let's change the language family to Chinese, as follows:

# LANG=zh_CN.utf8

Let's test whether the setting is successful. Let's see if there is any Chinese in the help message.

# ls-help usage: ls [options]... [file].

Note: the above method to modify the language system is only temporary and will fail after the system is restarted. To permanently change the language family, you need to modify the configuration file / etc/locale.conf

Bc

Bc command is a calculator language that supports interactive execution of arbitrary precision. Bash has built-in support for four operations of integers, but does not support floating-point operations, and the bc command can easily perform floating-point operations, and of course integer operations are no longer needed. Therefore, we often use the bc command when writing shell scripts. Let's see how it works:

# enter the bc command and you will enter the interactive interface # bcbc 1.06.95Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.This is free software with ABSOLUTELY NO WARRANTY.For details type `warranty'. 3 '471.2' 33.64 Universe 31

Tags: Commands time languages systems dates formats support Chinese operations methods scripts usage regular meetings integers files floating points articles precision validity unexpected Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi vpn Shulou Technology Linux Huawei