RedHat Linux操作系统修改时区的方法

Most

modern Linux distributions have user-friendly programs to set the

timezone, often accesible through the program menus or right-clicking

the clock in a desktop environment such as KDE or GNOME. Failing that

it’s possible to manually change the system timezone in Linux in a few

short steps.

It’s possible to change the system timezone in Linux in a few short steps.

Steps

1.Logged

in as root, check which timezone your machine is currently using by

executing `date`. You’ll see something like “Mon 17 Jan 2005 12:15:08

PM PST -0.461203 seconds”, PST in this case is the current timezone.

2.Change

to the directory to /usr/share/zoneinfo, here you will find a list of

time zone regions. Choose the most appropriate region, if you live in

Canada or the US this directory is the “Americas” directory.

3.If

you wish, backup the previous timezone configuration by copying it to a

different location. Such as `mv /etc/localtime /etc/localtime-old`.

4.Create

a symbolic link from the appropiate timezone to /etc/localtime.

Example: `ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime`.

5.If

you have the utility rdate, update the current system time by executing

`/usr/bin/rdate -s time.nist.gov`. (This step can be skip!)

6.Set the ZONE entry in the file /etc/sysconfig/clock file (e.g. “America/Los_Angeles”)

7.Set the hardware clock by executing: ` /sbin/hwclock –systohc`

Tips

·On

some versions of RedHat Linux, Slackware, Gentoo, SuSE, Debian, Ubuntu,

and anything else that is “normal”, the command to display and change

the time is ‘date’, not ‘clock’

·On

RedHat Linux there is a utility called “Setup” that allows one to

select the timezone from a list, but you must have installed the

‘redhat-config-date’ package.

Warnings

·Some applications (such as PHP) have separate timezone settings from the system timezone.

·On

some systems, /etc/localtime is actually a symlink to the appropriate

file under the /usr/share/zoneinfo directory (rather than a copy of

that file).

·On

some systems, there is a system utility provided that will prompt for

the correct timezone and make the proper changes to the system

configuration. For example,Debianprovides the “tzsetup” utility.

Here is an example of changing the timezone:(Logged in as root)

In order to manually change the timezone, you can edit the /etc/sysconfig/clockfile and then make a new soft link to /etc/localtime. Here is an example of changing the timezone manually to “America/Denver”:

1. Select the appropriate time zone from the /usr/share/zoneinfo directory. Time zone names are relative to that directory. In this case, we will select “America/Denver”

2. Edit the /etc/sysconfig/clocktext file so that it looks like this:

ZONE=”America/Denver”

UTC=true

ARC=false

Of course, this assumes that your hardware clock is running UTC time…

3. Delete the following file: /etc/localtime (backup it when you need it !)

4. Create a new soft link for /etc/localtime. Here is an example of step 3 and step 4:

# cd /etc

# ls -al localtime

lrwxrwxrwx 1 root root 39 Mar 28 07:00 localtime -> /usr/share/zoneinfo/America/Los_Angeles

# rm /etc/localtime

# ln -s /usr/share/zoneinfo/America/Denver /etc/localtime

# ls -al localtime

lrwxrwxrwx 1 root root 34 Mar 28 08:59 localtime -> /usr/share/zoneinfo/America/Denver

# date

Fri Mar 28 09:00:04 MST 2003

针对中国时区,修改操作如下

1.   修改文件 /etc/sysconfig/clock内容:

ZONE=Asia/Shanghai

UTC=false

ARC=false

2.     rm /etc/localtime

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

还有其他方法修改时区,不过是基于图形化界面的命令: tzselect 、 timeconfig

linux红帽7修改时间,RedHat Linux 修改时区相关推荐

  1. linux红帽分区安装教程,RedHat Linux 9.0 硬盘安装教程手把手全部详细教程

    RedHat Linux 9.0的三个文件 ①shrike-i386-disc1.iso: ②shrike-i386-disc2.iso: ③shrike-i386-disc3.iso. 用RAR工具 ...

  2. linux系统怎么看时间,查看和修改linux系统时间

    一.查看和修改Linux的时区1. 查看当前时区 命令 : "date -R" 2. 修改设置Linux服务器时区方法 A 命令 : "tzselect" 方法 ...

  3. linux系统记录修改时间,查看和修改linux系统时间

    一.查看和修改Linux的时区1. 查看当前时区 命令 : "date -R" 2. 修改设置Linux服务器时区方法 A 命令 : "tzselect" 方法 ...

  4. 【linux】linux命令如何查看文件、文件夹的属性,包括大小、修改时间、谁修改的...

    [linux命令如何查看文件.文件夹的属性,包括大小.修改时间.谁修改的] 1.查看文件大小: #du -sh filename 2.查看文件,文件夹属性: #ls -l filename #ls - ...

  5. 如何修改文件的 “创建时间” 和 “修改时间” (macOS, Linux, Windows) 2023 修正版

    如何修改文件的 "创建时间" 和 "修改时间" (macOS, Linux, Windows) 2023 修正版 请访问原文链接:https://sysin.o ...

  6. linux读取文件修改时间函数,Linux服务器编程之utime()函数修改文件存取时间

    Linux服务器编程之utime()函数修改文件存取时间 C语言utime()函数:修改文件的存取时间和更改时间 头文件: #include #include 定义函数: int utime(cons ...

  7. oracle修改时间命令,linux 修改系统时间 oracle查询当前时间命令

    1.Linux 操作系统 下查看和修改系统时间 [root@as4forora ~]# date -s 07/01/2008 二 7月 1 00:00:00 CST 2008 [root@as4for ...

  8. linux通过修改时间排序,linux按修改时间排序

    1.按文件大小查看文件 a.降序:ls -lsh moudaen@morton:~$ ls -lsh total 20M 20M -rw-r--r-- 1 moudaen 65536  20M Nov ...

  9. 红帽系统服务器格式化,Redhat Linux默认的文件系统是什么格式?

    满意答案 现在Redhat Linux默认的文件系统格式是ext4.可以通过如下多种方法查询文件系统类型 1. mount :~$ mount /dev/sda1 on / type ext4 (rw ...

最新文章

  1. 2010 .NET面试题整理之基础篇
  2. 三星台积电大笑 LG弃自研CPU英特尔代工遭重创
  3. 16.unix网络编程一卷 unp.h
  4. 利用java实现excel转pdf文件
  5. leetcode —— 863. 二叉树中所有距离为 K 的结点
  6. 初学者python笔记(模块篇)
  7. 《Python程序设计开发宝典》全面上架(新书超低价优惠+转发积攒送书)
  8. 从苹果 M1 看芯片技术发展趋势
  9. html特殊字符p如何屏蔽 asp,利用asp去除html标记的四种方法
  10. 2022年最新最全软件测试面试题大全
  11. python123第九周测验答案2020_2020知到答案 大数据分析的python基础 最新智慧树满分章节测试答案...
  12. python因子分析_python中的因子分析简介
  13. 【PyTorch深度学习项目实战100例】—— 基于UNet实现血管瘤超声图像分割 | 第30例
  14. goproxy代理软件 v10.3 轻量级高性能代理软件+链式代理+正向代理+反向代理
  15. Linux使用nvida-smi查看GPU类型
  16. Zabbix 如何实现邮件报警通知以及免费短信报警通知
  17. 挂件巡检机器人_最近DIY的室内巡检机器人
  18. linux系统可以用autocad吗,在Linux操作系统下最佳的五款CAD软件
  19. getReader()/getInputStream() has already been called for this request
  20. 福昕阅读器无法添加书签

热门文章

  1. 小笔记:表 - 各种语言的 CommonMark Markdown解析器 实现
  2. java wrapper作用_Java Service Wrapper 浅谈
  3. IOS 老项目升级报错
  4. 离散型随机变量,二项分布,泊松分布,几何分布(概统2.知识)
  5. VS2019界面外观美化
  6. 优思学院|3M 案例 - 六西格玛和可持续发展
  7. 字典的静态方法(读、写、)
  8. “太香了”,NB烟感还有这么多隐藏功能!
  9. 1.了解Redis与其应用场景(理解)
  10. 《程序员的自我修养--链接、装载与库》笔记