From 44cf47b65c680a8b2fb5b0499ef97d185d802249 Mon Sep 17 00:00:00 2001 From: xiongqing10 <1091987178@qq.com> Date: Fri, 22 May 2020 17:00:50 +0800 Subject: [PATCH 1/7] =?UTF-8?q?update=20content/zh/docs/Administration/?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E7=B3=BB=E7=BB=9F=E4=BF=A1=E6=81=AF.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...347\263\273\347\273\237\344\277\241\346\201\257.md" | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git "a/content/zh/docs/Administration/\346\237\245\347\234\213\347\263\273\347\273\237\344\277\241\346\201\257.md" "b/content/zh/docs/Administration/\346\237\245\347\234\213\347\263\273\347\273\237\344\277\241\346\201\257.md" index 4075906f8..ff057a1cd 100644 --- "a/content/zh/docs/Administration/\346\237\245\347\234\213\347\263\273\347\273\237\344\277\241\346\201\257.md" +++ "b/content/zh/docs/Administration/\346\237\245\347\234\213\347\263\273\347\273\237\344\277\241\346\201\257.md" @@ -3,13 +3,13 @@ - 查看系统信息,命令如下: ``` - cat /etc/os-release + $ cat /etc/os-release ``` 例如,命令和输出如下: ``` - # cat /etc/os-release + $ cat /etc/os-release NAME="openEuler" VERSION="20.03 (LTS)" ID="openEuler" @@ -24,19 +24,19 @@ 查看CPU信息,命令如下: ``` - lscpu + $ lscpu ``` 查看内存信息,命令如下: ``` - free + $ free ``` 查看磁盘信息,命令如下: ``` - fdisk -l + $ fdisk -l ``` -- Gitee From 04dca098a21694bff1914c282c9f4b2f5e51fcbb Mon Sep 17 00:00:00 2001 From: xiongqing10 <1091987178@qq.com> Date: Fri, 22 May 2020 17:03:30 +0800 Subject: [PATCH 2/7] update content/en/docs/Administration/viewing-system-information.md. --- .../docs/Administration/viewing-system-information.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/en/docs/Administration/viewing-system-information.md b/content/en/docs/Administration/viewing-system-information.md index b979f4c49..322c28ac8 100644 --- a/content/en/docs/Administration/viewing-system-information.md +++ b/content/en/docs/Administration/viewing-system-information.md @@ -3,13 +3,13 @@ - Run the following command to view the system information: ``` - cat /etc/os-release + $ cat /etc/os-release ``` For example, the command and output are as follows: ``` - # cat /etc/os-release + $ cat /etc/os-release NAME="openEuler" VERSION="20.03 (LTS)" ID="openEuler" @@ -24,19 +24,19 @@ Run the following command to view the CPU information: ``` - lscpu + $ lscpu ``` Run the following command to view the memory information: ``` - free + $ free ``` Run the following command to view the disk information: ``` - fdisk -l + $ fdisk -l ``` -- Gitee From 738b20f04f2b2170259473ba1eb5b277358bf981 Mon Sep 17 00:00:00 2001 From: xiongqing10 <1091987178@qq.com> Date: Fri, 22 May 2020 17:55:29 +0800 Subject: [PATCH 3/7] =?UTF-8?q?update=20content/zh/docs/Administration/?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E9=85=8D=E7=BD=AE.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...72\347\241\200\351\205\215\347\275\256.md" | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git "a/content/zh/docs/Administration/\345\237\272\347\241\200\351\205\215\347\275\256.md" "b/content/zh/docs/Administration/\345\237\272\347\241\200\351\205\215\347\275\256.md" index 78771c36b..537227dd4 100644 --- "a/content/zh/docs/Administration/\345\237\272\347\241\200\351\205\215\347\275\256.md" +++ "b/content/zh/docs/Administration/\345\237\272\347\241\200\351\205\215\347\275\256.md" @@ -27,7 +27,7 @@ 显示当前语言环境,命令如下: ``` -localectl status +$ localectl status ``` 例如显示系统当前的设置,命令和输出如下: @@ -44,7 +44,7 @@ $ localectl status 显示当前可用的语言环境,命令如下: ``` -localectl list-locales +$ localectl list-locales ``` 例如显示当前系统中所有可用的中文环境,命令和输出如下: @@ -59,7 +59,7 @@ zh_CN.UTF-8 要设置语言环境,在root权限下执行如下命令,其中 _locale_ 是您要设置的语言类型,取值范围可通过**localectl list-locales**获取,请根据实际情况修改。 ``` -localectl set-locale LANG=locale +# localectl set-locale LANG=locale ``` 例如设置为简体中文语言环境,在root权限下执行如下命令: @@ -71,7 +71,7 @@ localectl set-locale LANG=locale >![](public_sys-resources/icon-note.gif) **说明:** >修改后需要重新登录或者执行如下命令刷新配置文件,使修改生效。 >``` ->source /etc/locale.conf +> # source /etc/locale.conf >``` ## 设置键盘 @@ -83,7 +83,7 @@ localectl set-locale LANG=locale 显示当前键盘设置,命令如下: ``` -localectl status +$ localectl status ``` 例如显示系统当前的设置,命令和输出如下: @@ -100,7 +100,7 @@ $ localectl status 显示当前可用的键盘布局,命令如下: ``` -localectl list-keymaps +$ localectl list-keymaps ``` 例如显示系统当前的中文键盘布局,命令和输出如下: @@ -115,7 +115,7 @@ cn 设置键盘布局,在root权限下执行如下命令,其中 _map_ 是您想要设置的键盘类型,取值范围可通过**localectl list-keymaps**获取,请根据实际情况修改: ``` -localectl set-keymap map +# localectl set-keymap map ``` 此时设置的键盘布局同样也会应用到图形界面中。 @@ -142,7 +142,7 @@ $ localectl status 显示当前的日期和时间,命令如下: ``` -timedatectl +$ timedatectl ``` 例如显示系统当前的日期和时间,命令和输出如下: @@ -166,7 +166,7 @@ System clock synchronized: no >若启用了NTP远程服务器进行系统时钟自动同步,则不能手动修改日期和时间。若需要手动修改日期或时间,则需确保已经关闭NTP系统时钟自动同步。可执行**timedatectl set-ntp** no命令进行关闭。 ``` -timedatectl set-ntp boolean +# timedatectl set-ntp boolean ``` 例如开启自动远程时间同步,命令如下: @@ -183,7 +183,7 @@ timedatectl set-ntp boolean 修改当前的日期,在root权限下执行如下命令,其中 _YYYY_ 代表年份,_MM_ 代表月份,_DD_ 代表某天,请根据实际情况修改: ``` -timedatectl set-time YYYY-MM-DD +# timedatectl set-time YYYY-MM-DD ``` 例如修改当前的日期为2019年8月14号,命令如下: @@ -200,7 +200,7 @@ timedatectl set-time YYYY-MM-DD 修改当前的时间,在root权限下执行如下命令,其中 _HH_ 代表小时,_MM_ 代表分钟,_SS_ 代表秒,请根据实际情况修改: ``` -timedatectl set-time HH:MM:SS +# timedatectl set-time HH:MM:SS ``` 例如修改当前的时间为15点57分24秒,命令如下: @@ -214,13 +214,13 @@ timedatectl set-time HH:MM:SS 显示当前可用时区,命令如下: ``` -timedatectl list-timezones +$ timedatectl list-timezones ``` 要修改当前的时区,在root权限下执行如下命令,其中 _time\_zone_ 是您想要设置的时区,请根据实际情况修改: ``` -timedatectl set-timezone time_zone +# timedatectl set-timezone time_zone ``` 例如修改当前的时区,首先查询所在地域的可用时区,此处以Asia为例: @@ -263,19 +263,19 @@ Asia/Tokyo 显示当前的日期和时间,命令如下: ``` -date +$ date ``` 默认情况下,date命令显示本地时间。要显示UTC时间,添加\-\-utc或-u参数: ``` -date --utc +$ date --utc ``` 要自定义对应的输出信息格式,添加 +"format" 参数: ``` -date +"format" +$ date +"format" ``` **表 1** 参数说明 @@ -364,13 +364,13 @@ date +"format" 要修改当前的时间,添加\-\-set或者-s参数。在root权限下执行如下命令,其中 _HH_ 代表小时,_MM_ 代表分钟,_SS_ 代表秒,请根据实际情况修改: ``` -date --set HH:MM:SS +# date --set HH:MM:SS ``` 默认情况下, date命令设置本地时间。要设置UTC时间,添加\-\-utc或-u参数: ``` -date --set HH:MM:SS --utc +# date --set HH:MM:SS --utc ``` 例如修改当前的时间为23点26分00秒,在root权限下执行如下命令: @@ -384,7 +384,7 @@ date --set HH:MM:SS --utc 修改当前的日期,添加\-\-set或者-s参数。在root权限下执行如下命令,其中 _YYYY_ 代表年份,_MM_ 代表月份,_DD_ 代表某天,请根据实际情况修改: ``` -date --set YYYY-MM-DD +# date --set YYYY-MM-DD ``` 例如修改当前的日期为2019年11月2日,命令如下: @@ -411,7 +411,7 @@ Linux 将时钟分为: 显示当前硬件的日期和时间,在root权限下执行如下命令: ``` -hwclock +# hwclock ``` 例如显示当前硬件的日期和时间,命令和输出如下: @@ -426,7 +426,7 @@ hwclock 修改当前硬件的日期和时间,在root权限下执行如下命令,其中 _dd_ 表示日,_mm_ 表示月份,_yyyy_ 表示年份,_HH_ 表示小时,_MM_ 表示分钟,请根据实际情况修改: ``` -hwclock --set --date "dd mm yyyy HH:MM" +# hwclock --set --date "dd mm yyyy HH:MM" ``` 例如修改当前的时间为2019年10月21日21点17分,命令如下: -- Gitee From f6b49e331f3b08d93ed0ebb55bf096a078b8722f Mon Sep 17 00:00:00 2001 From: xiongqing10 <1091987178@qq.com> Date: Fri, 22 May 2020 18:11:31 +0800 Subject: [PATCH 4/7] update content/en/docs/Administration/basic-configuration.md. --- .../Administration/basic-configuration.md | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/content/en/docs/Administration/basic-configuration.md b/content/en/docs/Administration/basic-configuration.md index 3adb15547..a5fbc1506 100644 --- a/content/en/docs/Administration/basic-configuration.md +++ b/content/en/docs/Administration/basic-configuration.md @@ -26,7 +26,7 @@ System locale settings are stored in the /etc/locale.conf file and can be modifi To display the current locale status, run the following command: ``` -localectl status +$ localectl status ``` Example command output: @@ -42,7 +42,7 @@ $ localectl status To display available locales, run the following command: ``` -localectl list-locales +$ localectl list-locales ``` You can check that by listing all Chinese locales with the following command: @@ -56,7 +56,7 @@ zh_CN.UTF-8 To set the language environment, run the following command as the user **root**. In the command, _locale_ indicates the language type to be set. Run the **localectl list-locales** command to obtain the value range. Change the value based on the site requirements. ``` -localectl set-locale LANG=locale +# localectl set-locale LANG=locale ``` For example, if you want to use Simplified Chinese as the locale, run the following command as the user **root**: @@ -68,7 +68,7 @@ For example, if you want to use Simplified Chinese as the locale, run the follow >![](public_sys-resources/icon-note.gif) **NOTE:** >After the modification, log in again or run the following command to update the configuration file for the modification to take effect: >``` ->source /etc/locale.conf +># source /etc/locale.conf >``` ## Setting the Keyboard Layout @@ -79,7 +79,7 @@ Keyboard layout settings are stored in the /etc/locale.conf file and can be modi To display the current keyboard layout settings, run the following command: ``` -localectl status +$ localectl status ``` Example command output: @@ -95,7 +95,7 @@ $ localectl status To list all available keyboard layouts that can be configured on openEuler, run the following command: ``` -localectl list-keymaps +$ localectl list-keymaps ``` For example, the command output of the Chinese keyboard layout is as follows: @@ -109,7 +109,7 @@ cn To set the keyboard layout, run the following command as the user **root**. In the command, _map_ indicates the keyboard layout to be set. Run the **localectl list-keymaps** command to obtain the value range. Change it based on the site requirements. ``` -localectl set-keymap map +$ localectl set-keymap map ``` The keyboard layout will be equally applied to graphical user interfaces. @@ -135,7 +135,7 @@ This topic describes how to set the system date, time, and time zone by using ti To display the current date and time, run the following command: ``` -timedatectl +$ timedatectl ``` Example command output: @@ -158,7 +158,7 @@ Your system clock can be automatically synchronized with a remote server using t >If the remote NTP server is enabled to automatically synchronize the system clock, you cannot manually change the date and time. If you need to manually change the date or time, ensure that automatic NTP system clock synchronization is disabled. You can run the **timedatectl set-ntp no** command to disable the NTP service. ``` -timedatectl set-ntp boolean +# timedatectl set-ntp boolean ``` For example, to enable automatic remote time synchronization, run the following command: @@ -174,7 +174,7 @@ For example, to enable automatic remote time synchronization, run the following Run the following command as the user **root** to change the current date. In the command, _YYYY_ indicates the year, _MM_ indicates the month, and _DD_ indicates the day. Change them based on the site requirements. ``` -timedatectl set-time YYYY-MM-DD +# timedatectl set-time YYYY-MM-DD ``` For example, to change the current date to August 14, 2019, run the following command as the user **root**: @@ -190,7 +190,7 @@ For example, to change the current date to August 14, 2019, run the following co To change the current time, run the following command as the user **root**. In the command, _HH_ indicates the hour, _MM_ indicates the minute, and _SS_ indicates the second. Change them based on the site requirements. ``` -timedatectl set-time HH:MM:SS +# timedatectl set-time HH:MM:SS ``` For example, to change the current time to 15:57:24, run the following command: @@ -203,13 +203,13 @@ For example, to change the current time to 15:57:24, run the following command: To list all available time zones, run the following command: ``` -timedatectl list-timezones +$ timedatectl list-timezones ``` To change the current time zone, run the following command as the user **root**. In the command, _time\_zone_ indicates the time zone to be set. Change it based on the site requirements. ``` -timedatectl set-timezone time_zone +# timedatectl set-timezone time_zone ``` Imagine you want to identify which time zone is closest to your present location while you are in Asia. You can check that by listing all available time zones in Asia with the following command: @@ -251,19 +251,19 @@ To change the time zone to Asia/Shanghai, run the following command: To display the current date and time, run the following command: ``` -date +$ date ``` By default, the **date** command displays the local time. To display the time in Coordinated Universal Time \(UTC\), run the command with the \-\-utc or -u command line option: ``` -date --utc +$ date --utc ``` You can also customize the format of the displayed information by providing the + "format" option on the command line: ``` -date +"format" +$ date +"format" ``` **Table 1** Formatting options @@ -351,13 +351,13 @@ Example commands and outputs: To change the current time, run the date command with the \-\-set or -s option as the root user: Run the following command as the user **root**. In the command, _HH_ indicates the hour, _MM_ indicates the minute, and _SS_ indicates the second. Change them based on the site requirements. ``` -date --set HH:MM:SS +# date --set HH:MM:SS ``` By default, the date command sets the local time. To set the system clock in UTC instead, run the command with the \-\-utc or -u command line option: ``` -date --set HH:MM:SS --utc +# date --set HH:MM:SS --utc ``` For example, to change the current time to 23:26:00, run the following command as the user **root**: @@ -370,7 +370,7 @@ For example, to change the current time to 23:26:00, run the following command a To change the current date, run the command with the \-\-set or -s command line option. Run the following command as the user **root**. In the command, _YYYY_ indicates the year, _MM_ indicates the month, and _DD_ indicates the day. Change them based on the site requirements. ``` -date --set YYYY-MM-DD +# date --set YYYY-MM-DD ``` For example, to change the current date to November 2, 2019, run the following command as the user **root**: @@ -395,7 +395,7 @@ When Linux starts, it reads the RTC and sets the system clock time based on the To display the current RTC date and time, run the following command as the user **root**: ``` -hwclock +# hwclock ``` Example command output: @@ -409,7 +409,7 @@ Example command output: Run the following command as the user **root** to change the date and time of the current hardware. In the command, _dd_ indicates the day, _mm_ indicates the month, _yyyy_ indicates the year, _HH_ indicates the hour, and _MM_ indicates the minute. Change them based on the site requirements. ``` -hwclock --set --date "dd mm yyyy HH:MM" +# hwclock --set --date "dd mm yyyy HH:MM" ``` For example, to change the current time to 21:17 on October 21, 2019, run the following command: -- Gitee From 2040dda79ea2df803cf3a9228ebc7f356b6650f2 Mon Sep 17 00:00:00 2001 From: xiongqing10 <1091987178@qq.com> Date: Fri, 22 May 2020 17:00:50 +0800 Subject: [PATCH 5/7] =?UTF-8?q?update=20content/zh/docs/Administration/?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E7=B3=BB=E7=BB=9F=E4=BF=A1=E6=81=AF.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...347\263\273\347\273\237\344\277\241\346\201\257.md" | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git "a/content/zh/docs/Administration/\346\237\245\347\234\213\347\263\273\347\273\237\344\277\241\346\201\257.md" "b/content/zh/docs/Administration/\346\237\245\347\234\213\347\263\273\347\273\237\344\277\241\346\201\257.md" index 4075906f8..ff057a1cd 100644 --- "a/content/zh/docs/Administration/\346\237\245\347\234\213\347\263\273\347\273\237\344\277\241\346\201\257.md" +++ "b/content/zh/docs/Administration/\346\237\245\347\234\213\347\263\273\347\273\237\344\277\241\346\201\257.md" @@ -3,13 +3,13 @@ - 查看系统信息,命令如下: ``` - cat /etc/os-release + $ cat /etc/os-release ``` 例如,命令和输出如下: ``` - # cat /etc/os-release + $ cat /etc/os-release NAME="openEuler" VERSION="20.03 (LTS)" ID="openEuler" @@ -24,19 +24,19 @@ 查看CPU信息,命令如下: ``` - lscpu + $ lscpu ``` 查看内存信息,命令如下: ``` - free + $ free ``` 查看磁盘信息,命令如下: ``` - fdisk -l + $ fdisk -l ``` -- Gitee From 8367cca27745e6ceca3211c23aac4b7144d9a5c4 Mon Sep 17 00:00:00 2001 From: xiongqing10 <1091987178@qq.com> Date: Fri, 22 May 2020 17:03:30 +0800 Subject: [PATCH 6/7] update content/en/docs/Administration/viewing-system-information.md. --- .../docs/Administration/viewing-system-information.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/en/docs/Administration/viewing-system-information.md b/content/en/docs/Administration/viewing-system-information.md index b979f4c49..322c28ac8 100644 --- a/content/en/docs/Administration/viewing-system-information.md +++ b/content/en/docs/Administration/viewing-system-information.md @@ -3,13 +3,13 @@ - Run the following command to view the system information: ``` - cat /etc/os-release + $ cat /etc/os-release ``` For example, the command and output are as follows: ``` - # cat /etc/os-release + $ cat /etc/os-release NAME="openEuler" VERSION="20.03 (LTS)" ID="openEuler" @@ -24,19 +24,19 @@ Run the following command to view the CPU information: ``` - lscpu + $ lscpu ``` Run the following command to view the memory information: ``` - free + $ free ``` Run the following command to view the disk information: ``` - fdisk -l + $ fdisk -l ``` -- Gitee From 4a72a00e0a28d9907a402327410589fed95c87b7 Mon Sep 17 00:00:00 2001 From: xiong05 <1091987178@qq.com> Date: Mon, 25 May 2020 14:42:02 +0800 Subject: [PATCH 7/7] =?UTF-8?q?update=20content/zh/docs/Administration/?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E7=B3=BB=E7=BB=9F=E4=BF=A1=E6=81=AF.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...72\347\241\200\351\205\215\347\275\256.md" | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git "a/content/zh/docs/Administration/\345\237\272\347\241\200\351\205\215\347\275\256.md" "b/content/zh/docs/Administration/\345\237\272\347\241\200\351\205\215\347\275\256.md" index e453d4f45..6720aa74a 100644 --- "a/content/zh/docs/Administration/\345\237\272\347\241\200\351\205\215\347\275\256.md" +++ "b/content/zh/docs/Administration/\345\237\272\347\241\200\351\205\215\347\275\256.md" @@ -27,7 +27,7 @@ 显示当前语言环境,命令如下: ``` -localectl status +$ localectl status ``` 例如显示系统当前的设置,命令和输出如下: @@ -44,7 +44,7 @@ $ localectl status 显示当前可用的语言环境,命令如下: ``` -localectl list-locales +$ localectl list-locales ``` 例如显示当前系统中所有可用的中文环境,命令和输出如下: @@ -59,7 +59,7 @@ zh_CN.UTF-8 要设置语言环境,在root权限下执行如下命令,其中 _locale_ 是您要设置的语言类型,取值范围可通过**localectl list-locales**获取,请根据实际情况修改。 ``` -localectl set-locale LANG=locale +# localectl set-locale LANG=locale ``` 例如设置为简体中文语言环境,在root权限下执行如下命令: @@ -70,10 +70,16 @@ localectl set-locale LANG=locale >![](public_sys-resources/icon-note.gif) **说明:** >修改后需要重新登录或者执行如下命令刷新配置文件,使修改生效。 +<<<<<<< HEAD ``` source /etc/locale.conf ``` +======= +>``` +> # source /etc/locale.conf +>``` +>>>>>>> 738b20f... update content/zh/docs/Administration/基础配置.md. ## 设置键盘 @@ -84,7 +90,7 @@ source /etc/locale.conf 显示当前键盘设置,命令如下: ``` -localectl status +$ localectl status ``` 例如显示系统当前的设置,命令和输出如下: @@ -101,7 +107,7 @@ $ localectl status 显示当前可用的键盘布局,命令如下: ``` -localectl list-keymaps +$ localectl list-keymaps ``` 例如显示系统当前的中文键盘布局,命令和输出如下: @@ -116,7 +122,7 @@ cn 设置键盘布局,在root权限下执行如下命令,其中 _map_ 是您想要设置的键盘类型,取值范围可通过**localectl list-keymaps**获取,请根据实际情况修改: ``` -localectl set-keymap map +# localectl set-keymap map ``` 此时设置的键盘布局同样也会应用到图形界面中。 @@ -143,7 +149,7 @@ $ localectl status 显示当前的日期和时间,命令如下: ``` -timedatectl +$ timedatectl ``` 例如显示系统当前的日期和时间,命令和输出如下: @@ -167,7 +173,7 @@ System clock synchronized: no >若启用了NTP远程服务器进行系统时钟自动同步,则不能手动修改日期和时间。若需要手动修改日期或时间,则需确保已经关闭NTP系统时钟自动同步。可执行**timedatectl set-ntp** no命令进行关闭。 ``` -timedatectl set-ntp boolean +# timedatectl set-ntp boolean ``` 例如开启自动远程时间同步,命令如下: @@ -184,7 +190,7 @@ timedatectl set-ntp boolean 修改当前的日期,在root权限下执行如下命令,其中 _YYYY_ 代表年份,_MM_ 代表月份,_DD_ 代表某天,请根据实际情况修改: ``` -timedatectl set-time YYYY-MM-DD +# timedatectl set-time YYYY-MM-DD ``` 例如修改当前的日期为2019年8月14号,命令如下: @@ -201,7 +207,7 @@ timedatectl set-time YYYY-MM-DD 修改当前的时间,在root权限下执行如下命令,其中 _HH_ 代表小时,_MM_ 代表分钟,_SS_ 代表秒,请根据实际情况修改: ``` -timedatectl set-time HH:MM:SS +# timedatectl set-time HH:MM:SS ``` 例如修改当前的时间为15点57分24秒,命令如下: @@ -215,13 +221,13 @@ timedatectl set-time HH:MM:SS 显示当前可用时区,命令如下: ``` -timedatectl list-timezones +$ timedatectl list-timezones ``` 要修改当前的时区,在root权限下执行如下命令,其中 _time\_zone_ 是您想要设置的时区,请根据实际情况修改: ``` -timedatectl set-timezone time_zone +# timedatectl set-timezone time_zone ``` 例如修改当前的时区,首先查询所在地域的可用时区,此处以Asia为例: @@ -264,19 +270,19 @@ Asia/Tokyo 显示当前的日期和时间,命令如下: ``` -date +$ date ``` 默认情况下,date命令显示本地时间。要显示UTC时间,添加\-\-utc或-u参数: ``` -date --utc +$ date --utc ``` 要自定义对应的输出信息格式,添加 +"format" 参数: ``` -date +"format" +$ date +"format" ``` **表 1** 参数说明 @@ -365,13 +371,13 @@ date +"format" 要修改当前的时间,添加\-\-set或者-s参数。在root权限下执行如下命令,其中 _HH_ 代表小时,_MM_ 代表分钟,_SS_ 代表秒,请根据实际情况修改: ``` -date --set HH:MM:SS +# date --set HH:MM:SS ``` 默认情况下, date命令设置本地时间。要设置UTC时间,添加\-\-utc或-u参数: ``` -date --set HH:MM:SS --utc +# date --set HH:MM:SS --utc ``` 例如修改当前的时间为23点26分00秒,在root权限下执行如下命令: @@ -385,7 +391,7 @@ date --set HH:MM:SS --utc 修改当前的日期,添加\-\-set或者-s参数。在root权限下执行如下命令,其中 _YYYY_ 代表年份,_MM_ 代表月份,_DD_ 代表某天,请根据实际情况修改: ``` -date --set YYYY-MM-DD +# date --set YYYY-MM-DD ``` 例如修改当前的日期为2019年11月2日,命令如下: @@ -412,7 +418,7 @@ Linux 将时钟分为: 显示当前硬件的日期和时间,在root权限下执行如下命令: ``` -hwclock +# hwclock ``` 例如显示当前硬件的日期和时间,命令和输出如下: @@ -427,7 +433,7 @@ hwclock 修改当前硬件的日期和时间,在root权限下执行如下命令,其中 _dd_ 表示日,_mm_ 表示月份,_yyyy_ 表示年份,_HH_ 表示小时,_MM_ 表示分钟,请根据实际情况修改: ``` -hwclock --set --date "dd mm yyyy HH:MM" +# hwclock --set --date "dd mm yyyy HH:MM" ``` 例如修改当前的时间为2019年10月21日21点17分,命令如下: -- Gitee