Linux Classes
Linux Classes
Share This With a Friend
LINUX CLASSES - LINUX COMMANDS

How Can I Set the Date and Time on Linux?

What's Today's date?

Use the date command to print the current date and time. If you add the -u flag, the results will be for the Greenwich mean time zone. And if you log in as a superuser, you can even change the date or time with the -s flag. Now, that's power!

Here are some examples:

date Print the date and time.
Sat Nov 2 20:09:43 EST 1996
date -u Print the GMT date and time.
Sun Nov 3 01:09:45 GMT 1996
date -s 0503 Set the clock to 5:03 A.M.

For more information on the date command, see the date manual.

Previous Lesson: Who is Logged In?
Next Lesson: The Echo Command

[ RETURN TO INDEX ]



Comments - most recent first
(Please feel free to answer questions posted by others!)

GUPTHA (18 Oct 2012, 18:11)
hai sir to apply jobs best websites send to my mail in windows7 how to use vmware
sandeep kumar (05 Sep 2012, 09:22)
hi sir,
i m student of b.tech final .i want learn linux shell scripting .
so kindelly send me Linux tutorial who help me during learning
nikhil (18 Mar 2012, 06:23)
i want to know about the process of the booting nd ways of changing the process of booting ?
Majed (08 Aug 2011, 10:38)
@Mauro you probably have a problem with the time zone in gentoo i checked the file /etc/conf.d/clock and changed the time zone and something to do with the hardware clock
Majed (08 Aug 2011, 09:06)
this string should be included as example :
date -s "8 AUG 2011 16:06:00"
Majed (08 Aug 2011, 08:59)
i had my time wrong on gentoo so thanks for the tip on how to change time because i didn't find the time to lookup the command on the internet. However, you should include in the example of how to change date too and from +3 to +2, because the help doesn't provide information on how to write the string.
Mauro (01 Feb 2011, 12:18)
hi, when i installed linux (debian) i made a mistake setting the utc time. now even if set the utc time with date -u -s <time>, at the next reboot the time returns to the older. i also tried with hwclock but i get a time-out error and dpkg-reconfigure tzdata only reconfigure local time. therefore every time i boot i have to change manually the time. how i can definitely fix this problem with no linux reinstallation? thks
jim (24 Aug 2010, 02:37)
i want to learn do i need more software?
TooCool (01 Aug 2010, 02:43)
This is really great....thnx a ton
Thanakorn (05 May 2010, 02:49)
very good knowledge

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:




Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.

Popular Linux Topics

Linux Intro
Linux Files
Linux Commands
Change Password
Copy Files
Linux Shell Basics

Linux Tutorial

Who is Doctor Bob?
What is Linux?
History of Unix
Operating Systems
What's Next?

Linux Basics

Living in a Shell
Root and Other Users
Virtual Consoles
Logoff and Shutdown
Choosing a Shell
The Command Prompt
Wildcards
Command History
Aliases
Redirection
Pipelines
Processes
Stopping a Program
Environment Variables
Help!

Linux Files

The Linux File System
Linux File Names
Linux Directories
Directory Terminology
Navigating the File System
Listing Linux Files
Displaying Linux Files
Copying and Renaming Files
Creating Files and Directories
Deleting Files and Directories
Linux Files - Wildcards
The Nine Deadly Keystrokes
Linux File Permissions
Changing File Permissions

Linux Commands

Important Linux Commands
Changing Your Password
Switching Users
Who is Logged In?
Date and Time
The Echo Command
Spell Checking
Printing Linux Files
Joining Files
Searching for Files
Comparing Files
Task Scheduling
Linking Files

Linux Editors

The Vi Editor
The Emacs Editor
The Pico Editor

Linux Data Manipulation

Slicing & Dicing
Heads or Tails?
Sorting Data
Eliminating Duplicates
Selecting Columns
Selecting Records
Search & Replace
Crunching Data
Finding Files
Pipe Fitting

Linux Shell Programming

Linux Shell Scripts
Executing a Script
Shell Script Variables
Shell Script Logic
Shell Script Looping
Shell Script Debugging

Perl Programming

Perl Basics
Perl Variables
Perl Arguments
Perl Logic
Perl Looping
Perl and Files
Perl Pattern Matching

Linux and Email

Sending Email
Reading Email
Other Mail Commands
Using Pine for Email
The Pine Inbox
Pine Email Basics
Pine Email Folders
Pine for Power Users

Compression and Encoding

Linux File Compression
Archiving With Tar
Compression With Gzip
Compress and Zcat
Zmore and Zless
Zip and Unzip
Encoding and Decoding
Encryption

Linux Does DOS

Accesing DOS Files
Accesing DOS Partitions
Running DOS Programs

Managing Linux

Updating Your Linux System
Installing Packages with RPM
Uninstalling Packages w/ RPM
Upgrading Packages with RPM
Querying Packages with RPM

AltStyle によって変換されたページ (->オリジナル) /