Archive for September, 2010

Linux set date and time on command line

Linux Set Date and Time From a Command Prompt.

How can I set the system date and time from the command prompt (bash shell)? I don’t have GUI installed and I am login over ssh session. How can I set date under Linux operating systems?

Use the date command to display the current date and time or set the system date / time over ssh session. You can also run the date command from X terminal as root user.

This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from the shell prompt.

You must login as root user to use date command.

Linux Set Date

Use the following syntax to set new data and time:

date --set="STRING"

For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:

# date -s "2 OCT 2006 18:00:00"

OR

# date --set="2 OCT 2006 18:00:00"

You can also simplify format using following syntax:

# date +%Y%m%d -s "20081128"

Linux Set Time

To set time use the following syntax:

# date +%T -s "10:13:13"

Where,

  • 10: Hour (hh)
  • 13: Minute (mm)
  • 30: Second (ss)

Use %p locale’s equivalent of either AM or PM, enter:

# date +%T%p -s "6:10:30AM"
# date +%T%p -s "12:10:30PM"

Command line: convert strings to lowercase

From time to time it can be important to convert uppercase strings to lowercase, in sh / perl scripts.

I found a very simple way to do so, using the ‘tr – translate or delete characters’ command.

echo 'UPPERCASE'  | tr '[A-Z]' '[a-z]'

Paravirtualization – Wikipedia, the free encyclopedia

Paravirtualization – Wikipedia, the free encyclopedia.

image:xen_hypervisor.jpg

In computing, paravirtualization is a virtualization technique that presents a software interface to virtual machines that is similar but not identical to that of the underlying hardware.

The intent of the modified interface is to reduce the portion of the guest’s execution time spent performing operations which are substantially more difficult to run in a virtual environment compared to a non-virtualized environment. The paravirtualization provides specially defined ‘hooks’ to allow the guest(s) and host to request and acknowledge these tasks, which would otherwise be executed in the virtual domain (where execution performance is worse.) Hence, a successful paravirtualized platform may allow the virtual machine monitor (VMM) to be simpler (by relocating execution of critical tasks from the virtual domain to the host domain), and/or reduce the overall performance degradation of machine-execution inside the virtual-guest.

Paravirtualization requires the guest operating system to be explicitly ported for the para-API — a conventional O/S distribution which is not paravirtualization-aware cannot be run on top of a paravirtualized VMM. However, even in cases where the operating system cannot be modified, components may be available which confer many of the significant performance advantages of paravirtualization; for example, the XenWindowsGplPv project provides a kit of paravirtualization-aware device drivers, licensed under GPL, that are intended to be installed into a Microsoft Windows virtual-guest running on the Xen hypervisor.