From Omnia
Jump to: navigation, search

Time Zones

See current timezone setting:

sudo zdump /etc/localtime   # /etc/localtime  Wed Mar 14 09:46:46 2012 MDT
strings /etc/localtime      # MST7MDT,M3.2.0,M11.1.0  (and other garbage)

Set timezone for all users:

mv /etc/localtime /etc/localtime.original
# cp /usr/share/zoneinfo/America/Boise /etc/localtime
ln -sfn /usr/share/zoneinfo/America/Denver /etc/localtime

Set time zone for current user:

export TZ=America/Denver

In Linux, most timezone information is controlled by GLIBC, which relies on the file /etc/localtime. Different distributions do different things with this file; some have it as a symbolic link to the proper timezone definition file (usually in /usr/share/zoneinfo), but most have it as an actual, explicit file.

Verifying the Timezone File [1]

zdump is a small program that is part of GLIBC. It dumps the information about a given timezone file. If you want to verify what the Daylight Savings times are for a given year with a given file, you can do something like this:

$ zdump -v /etc/localtime | grep 2007

The -v tells zdump to display timezone information for all transitions rather than just the current date.


  Sun May  2 15:49:55 MDT 2010

Time Zone:

  TZ  Specifies the timezone, unless overridden by command line parameters.
      If neither is specified, the setting from /etc/localtime is used.

Time zones are kept here:




File Time

Files have access, modify and change times.

  • access time (atime): time the file was last accessed
  • modify time (mtime): file modification times
  • change time (ctime): status change times
$ stat test/
  File: `test/'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 900h/2304d      Inode: 20987905    Links: 2
Access: (0700/drwx------)  Uid: ( 1068/ kenneth)   Gid: ( 1068/ kenneth)
Access: 2010-09-20 11:30:01.000000000 -0600
Modify: 2010-09-20 11:14:45.000000000 -0600
Change: 2010-09-20 11:14:45.000000000 -0600

List file times:

$ ls -lt
$ ls -ltr  # reverse


-t mtime - modification time
-u atime - access time
-c ctime - change time


Linux date time timezone