This section describes commands that print or change system-wide information.
date: Print or set system date and time
date with no arguments prints the current time and date, in
the format of the `%c' directive (described below).
Synopses:
date [ option ]... [ +format ] date [ -u|--utc|--universal ] [ MMDDhhmm[[CC]YY][.ss] ]
If given an argument that starts with a `+', date prints the
current time and date (or the time and date specified by the
--date option, see below) in the format defined by that argument,
which is the same as in the strftime function. Except for
directives, which start with `%', characters in the format string
are printed unchanged. The directives are described below.
By default, date pads numeric fields with zeroes.
GNU date recognizes the following numeric modifiers
between the `%' and the directive. These are GNU extensions.
date directives related to times.
date directives related to dates.
date directives that produce literal strings.
If given an argument that does not start with `+', date sets
the system clock to the time and date specified by that argument (as
described below). You must have appropriate privileges to set the
system clock. The `--date' and `--set' options may not be
used with such an argument. The `--universal' option may be used
with such an argument to indicate that the specified time and date are
relative to Coordinated Universal Time rather than to the local time
zone.
The argument must consist entirely of digits, which have the following meaning:
The `--set' option also sets the system clock; see the next section.
dateThe program accepts the following options. Also see section Common options.
date executable many times can
be considerable.
dateHere are a few examples. Also see the documentation for the `-d' option in the previous section.
date --date='2 days ago'
date --date='3 months 1 day'
date --date='25 Dec' +%j
date '+%B %d'But this may not be what you want because for the first nine days of the month, the `%d' expands to a zero-padded two-digit field, for example `date -d 1may '+%B %d'' will print `May 01'.
- modifier to suppress
the padding altogether.
date -d=1may '+%B %-d'
date when setting the system clock:
date +%m%d%H%M%Y.%S
date --set='+2 minutes'
uname: Print system information
uname prints information about the machine and operating system
it is run on. If no options are given, uname acts as if the
-s option were given.
Synopsis:
uname [ option ]...
If multiple options or -a are given, the selected information is
printed in this order:
sysname nodename release osversion machine
The osversion, at least, may well be multiple words. For example:
bash$ uname -a => Linux hayley 1.0.4 #3 Thu May 12 18:06:34 1994 i486
The program accepts the following options. Also see section Common options.
hostname: Print or set system name
With no arguments, hostname prints the name of the current host
system. With one argument, it sets the current host name to the
specified string. You must have appropriate privileges to set the host
name.
Synopsis:
hostname [ name ]
The only options are `--help' and `--version'. See section Common options.
Go to the first, previous, next, last section, table of contents.