old-www/LDP/GNU-Linux-Tools-Summary/html/c4268.htm

1449 lines
19 KiB
HTML

<HTML
><HEAD
><TITLE
>Finding information about the system</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="GNU/Linux Command-Line Tools Summary"
HREF="book1.htm"><LINK
REL="PREVIOUS"
TITLE="Mass Rename/copy/link Tools"
HREF="x4055.htm"><LINK
REL="NEXT"
TITLE="Finding information about partitions"
HREF="x4892.htm"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>GNU/Linux Command-Line Tools Summary</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x4055.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x4892.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="FINDING-INFORMATION"
></A
>Chapter 8. Finding information about the system</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="c4268.htm#DATE-TIME-CALENDARS"
>Date/Time/Calendars</A
></DT
><DT
><A
HREF="x4892.htm"
>Finding information about partitions</A
></DT
></DL
></DIV
><P
></P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>time</DT
><DD
><P
>If you are looking <A
NAME="AEN4276"
></A
>for how to change <A
NAME="AEN4278"
></A
>the time please refer <A
NAME="AEN4280"
></A
>to <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>date</I
></SPAN
> here: <A
HREF="c4268.htm#DATE-TIME-CALENDARS"
>the Section called <I
>Date/Time/Calendars</I
></A
>. </P
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>time </I
></SPAN
>is a utility <A
NAME="AEN4286"
></A
>to measure <A
NAME="AEN4288"
></A
>the amount <A
NAME="AEN4290"
></A
>of time it takes a program <A
NAME="AEN4292"
></A
>to execute.<A
NAME="AEN4294"
></A
> It also measures <A
NAME="AEN4296"
></A
>CPU <A
NAME="AEN4298"
></A
>usage and displays statistics.<A
NAME="AEN4300"
></A
></P
><P
>Use<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> time -v<A
NAME="AEN4304"
></A
> </I
></SPAN
>(verbose mode) to display <A
NAME="AEN4306"
></A
>even more detailed <A
NAME="AEN4308"
></A
>statistics about the particular<A
NAME="AEN4310"
></A
> program.</P
><P
>Example usage:</P
><PRE
CLASS="SCREEN"
>time program_name options</PRE
></DD
><DT
>/proc</DT
><DD
><P
>The files under the /proc<A
NAME="AEN4318"
></A
> (process information pseudo file-system)<A
NAME="AEN4320"
></A
> show <A
NAME="AEN4322"
></A
>various information about the system. Consider it a window <A
NAME="AEN4324"
></A
>to the information that the kernel <A
NAME="AEN4326"
></A
>uses. </P
><P
>For example:</P
><PRE
CLASS="SCREEN"
>cat /proc/cpuinfo</PRE
><P
>Displays information about the <SPAN
CLASS="ACRONYM"
>CPU</SPAN
>.<A
NAME="AEN4332"
></A
> </P
><PRE
CLASS="SCREEN"
>less /proc/modules<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> </I
></SPAN
></PRE
><P
>Use the above command to view <A
NAME="AEN4337"
></A
>information about what kernel-modules <A
NAME="AEN4339"
></A
>are loaded <A
NAME="AEN4341"
></A
>on your system.</P
></DD
><DT
>dmesg</DT
><DD
><P
><A
NAME="AEN4347"
></A
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>dmesg</I
></SPAN
> can be used to print <A
NAME="AEN4350"
></A
>(or control) the &ldquo; kernel ring buffer<A
NAME="AEN4352"
></A
>&rdquo;. <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>dmesg</I
></SPAN
> is generally used to print the contents <A
NAME="AEN4355"
></A
>of your bootup <A
NAME="AEN4357"
></A
>messages displayed by the kernel.<A
NAME="AEN4359"
></A
> This is often useful when debugging <A
NAME="AEN4361"
></A
>problems.<A
NAME="AEN4363"
></A
></P
><P
>Simply type:</P
><PRE
CLASS="SCREEN"
>dmesg</PRE
></DD
><DT
>df</DT
><DD
><P
><A
NAME="AEN4371"
></A
>Displays information about the space <A
NAME="AEN4373"
></A
>on mounted <A
NAME="AEN4375"
></A
>file-systems. Use the<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> -h <A
NAME="AEN4378"
></A
></I
></SPAN
> option <A
NAME="AEN4380"
></A
>to have <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>df</I
></SPAN
> list <A
NAME="AEN4383"
></A
>the space in a 'human readable' format.<A
NAME="AEN4385"
></A
> ie. if there are 1024 kilobytes <A
NAME="AEN4387"
></A
>left (approximately) then <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>df</I
></SPAN
> will say there is 1MB <A
NAME="AEN4390"
></A
>left.</P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>df -options /dev/hdx</PRE
><P
>The latter part <A
NAME="AEN4395"
></A
>is optional,<A
NAME="AEN4397"
></A
> you can simply use <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>df</I
></SPAN
> with or without options <A
NAME="AEN4400"
></A
>to list space on all file-systems.<A
NAME="AEN4402"
></A
></P
><P
></P
></DD
><DT
>who</DT
><DD
><P
><A
NAME="AEN4409"
></A
>Displays information on which users are logged <A
NAME="AEN4411"
></A
>into the system including the time they logged in. </P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>who</PRE
></DD
><DT
>w</DT
><DD
><P
><A
NAME="AEN4419"
></A
>Displays information on who <A
NAME="AEN4421"
></A
>is logged into the system and what they are doing (ie. the processes <A
NAME="AEN4423"
></A
>they are running). It's similar to <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>who</I
></SPAN
> but displays slightly different information.</P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>w</PRE
></DD
><DT
>users</DT
><DD
><P
>Very similar to <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>who</I
></SPAN
> except it only prints <A
NAME="AEN4433"
></A
>out the user names who <A
NAME="AEN4435"
></A
>are currently logged in. (Doesn't need or take any options).</P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>users </PRE
></DD
><DT
>last</DT
><DD
><P
><A
NAME="AEN4443"
></A
>Displays records <A
NAME="AEN4445"
></A
>of when various users have logged in or out. This includes <A
NAME="AEN4447"
></A
>information on when the computer <A
NAME="AEN4449"
></A
>was rebooted.<A
NAME="AEN4451"
></A
></P
><P
>To execute this simply type:</P
><PRE
CLASS="SCREEN"
>last</PRE
></DD
><DT
>lastlog</DT
><DD
><P
><A
NAME="AEN4459"
></A
>Displays a list of users and what day/time they logged <A
NAME="AEN4461"
></A
>into the system. </P
><P
>Simply type:</P
><PRE
CLASS="SCREEN"
>lastlog</PRE
></DD
><DT
>whoami</DT
><DD
><P
><A
NAME="AEN4469"
></A
>Tells the user who they are currently logged in as, this is normally the usename they logged in with but can be changed with commands like su).<A
NAME="AEN4471"
></A
> <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>whoami</I
></SPAN
> does not need or take any options. </P
><P
>Simply type:</P
><PRE
CLASS="SCREEN"
>whoami</PRE
></DD
><DT
>free</DT
><DD
><P
><A
NAME="AEN4480"
></A
>Displays memory <A
NAME="AEN4482"
></A
>statistics <A
NAME="AEN4484"
></A
>(total, free, used, cached,<A
NAME="AEN4486"
></A
> swap). Use the<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> -t <A
NAME="AEN4489"
></A
></I
></SPAN
> option to display totals <A
NAME="AEN4491"
></A
>of everything <A
NAME="AEN4493"
></A
>and use the<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> -m <A
NAME="AEN4496"
></A
></I
></SPAN
>to display memory <A
NAME="AEN4498"
></A
>in megabytes.<A
NAME="AEN4500"
></A
> </P
><P
>Example:</P
><PRE
CLASS="SCREEN"
>free -tm</PRE
><P
>This will display the memory <A
NAME="AEN4505"
></A
>usage including <A
NAME="AEN4507"
></A
>totals <A
NAME="AEN4509"
></A
>in megabytes.<A
NAME="AEN4511"
></A
></P
></DD
><DT
>uptime</DT
><DD
><P
><A
NAME="AEN4517"
></A
>Print how long <A
NAME="AEN4519"
></A
>the computer has been &ldquo;up&rdquo;, how long <A
NAME="AEN4521"
></A
>the computer has been running.<A
NAME="AEN4523"
></A
> It also displays the number <A
NAME="AEN4525"
></A
>of users and the processor <A
NAME="AEN4527"
></A
>load (how hard the <SPAN
CLASS="ACRONYM"
>CPU</SPAN
> has been working...). </P
><DIV
CLASS="TIP"
><BLOCKQUOTE
CLASS="TIP"
><P
><B
>The w command: </B
>The <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>w</I
></SPAN
> command displays the output <A
NAME="AEN4534"
></A
>of the uptime command when you run this command. You could use the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>w</I
></SPAN
> command instead of uptime.</P
></BLOCKQUOTE
></DIV
></DD
><DT
>uname<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
></I
></SPAN
></DT
><DD
><P
>uname<A
NAME="AEN4542"
></A
> is used to print information <A
NAME="AEN4544"
></A
>on the system such as OS <A
NAME="AEN4546"
></A
>type, kernel version<A
NAME="AEN4548"
></A
> et cetera.</P
><P
>Some <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>uname</I
></SPAN
> options:</P
><P
></P
><UL
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-a<A
NAME="AEN4556"
></A
></I
></SPAN
> --- print all the available <A
NAME="AEN4558"
></A
>information.</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-m<A
NAME="AEN4563"
></A
></I
></SPAN
> --- print only information related to the machine <A
NAME="AEN4565"
></A
>itself. </P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-n<A
NAME="AEN4570"
></A
></I
></SPAN
> --- print only the machine hostname. </P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-r<A
NAME="AEN4575"
></A
></I
></SPAN
> --- print the release number<A
NAME="AEN4577"
></A
> of the current <A
NAME="AEN4579"
></A
>kernel.<A
NAME="AEN4581"
></A
> </P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-s<A
NAME="AEN4586"
></A
></I
></SPAN
> --- print the operating <A
NAME="AEN4588"
></A
>system name </P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-p<A
NAME="AEN4593"
></A
></I
></SPAN
> --- print the processor <A
NAME="AEN4595"
></A
>type. </P
></LI
></UL
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>uname -options</PRE
></DD
><DT
>xargs</DT
><DD
><P
><A
NAME="AEN4603"
></A
>Note that <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>xargs</I
></SPAN
> is an advanced,<A
NAME="AEN4606"
></A
> confusing,<A
NAME="AEN4608"
></A
> yet powerful <A
NAME="AEN4610"
></A
>command. <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>xargs</I
></SPAN
> is a command used to run other commands as many times <A
NAME="AEN4613"
></A
>as necessary, this way it prevents any kind of overload... When you run a command then add a<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> &ldquo;| xargs <A
NAME="AEN4616"
></A
>command2<A
NAME="AEN4618"
></A
></I
></SPAN
>&rdquo;. The results <A
NAME="AEN4620"
></A
>of command1 <A
NAME="AEN4622"
></A
>will be passed <A
NAME="AEN4624"
></A
>to command2, possibly on a line-by-line basis or something similar.<A
NAME="AEN4626"
></A
> </P
><P
>Understanding <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>xargs</I
></SPAN
> tends <A
NAME="AEN4630"
></A
>to be very difficult and my explanation <A
NAME="AEN4632"
></A
>is not the best. Refer <A
NAME="AEN4634"
></A
>to the examples <A
NAME="AEN4636"
></A
>below or try [6] of the <A
HREF="b12722.htm"
><I
>Bibliography</I
></A
> for another <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>xargs</I
></SPAN
> tutorial.<A
NAME="AEN4640"
></A
></P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Alternatives to using xargs: </B
>Please note that the below explanation of <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>xargs</I
></SPAN
> is not the strongest (at the time of writing I could not find anything better :()).</P
><P
>Alternatives may include writing a simple bash script to do the job which is not the most difficult task in the world.</P
></BLOCKQUOTE
></DIV
><P
>Examples:</P
><PRE
CLASS="SCREEN"
>ls | xargs grep work</PRE
><P
>The first command is obvious, it will list <A
NAME="AEN4650"
></A
>the files in the current directory. For each line <A
NAME="AEN4652"
></A
>of output of <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>ls</I
></SPAN
>, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>xargs</I
></SPAN
> will run <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>grep</I
></SPAN
> on that particular line and look <A
NAME="AEN4657"
></A
>for the string &ldquo;work&rdquo;. The output have the each time <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>grep</I
></SPAN
> is executed on a new <A
NAME="AEN4660"
></A
>line, the output would look like:</P
><PRE
CLASS="SCREEN"
>file_name: results_of_grep </PRE
><P
>If <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>grep</I
></SPAN
> didn't find <A
NAME="AEN4665"
></A
>the word then there would be no output if it had an error <A
NAME="AEN4667"
></A
>then it will output the error.<A
NAME="AEN4669"
></A
> Obviously this isn't very useful (you could just do:</P
><PRE
CLASS="SCREEN"
>grep 'word' *</PRE
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
><A
NAME="AEN4674"
></A
></I
></SPAN
> This is just a simple example...</P
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>xargs <A
NAME="AEN4678"
></A
></I
></SPAN
>also takes various options:</P
><P
></P
><UL
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-nx<A
NAME="AEN4684"
></A
></I
></SPAN
> --- will group <A
NAME="AEN4686"
></A
>the first x commands together</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-lx<A
NAME="AEN4691"
></A
></I
></SPAN
> --- xargs <A
NAME="AEN4693"
></A
>will execute <A
NAME="AEN4695"
></A
>the command for every x number of lines <A
NAME="AEN4697"
></A
>of input<A
NAME="AEN4699"
></A
></P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-p<A
NAME="AEN4704"
></A
></I
></SPAN
> --- prompt <A
NAME="AEN4706"
></A
>whether or not to execute this particular string</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-t<A
NAME="AEN4711"
></A
></I
></SPAN
> --- (tell) be verbose,<A
NAME="AEN4713"
></A
> echo <A
NAME="AEN4715"
></A
>each command before performing <A
NAME="AEN4717"
></A
>it</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-i<A
NAME="AEN4722"
></A
></I
></SPAN
> --- will use substitution <A
NAME="AEN4724"
></A
>similar to find's -exec <A
NAME="AEN4726"
></A
>option, it will execute certain commands on something.</P
></LI
></UL
><P
>Example:</P
><PRE
CLASS="SCREEN"
>ls dir1 | xargs -i mv dir1/'{}' dir2/'{}'</PRE
><P
>The {} would be substituted <A
NAME="AEN4731"
></A
>for the current input (in this example the current file/directory) listed <A
NAME="AEN4733"
></A
>within the directory.<A
NAME="AEN4735"
></A
> The above command would move <A
NAME="AEN4737"
></A
>every file listed in dir1 <A
NAME="AEN4739"
></A
>to dir2.<A
NAME="AEN4741"
></A
> Obviously this command won't be too useful, it would be easier to go to dir1 <A
NAME="AEN4743"
></A
>and type <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> mv * ../dir2</I
></SPAN
></P
><P
>Here is a more <A
NAME="AEN4747"
></A
>useful example: </P
><PRE
CLASS="SCREEN"
>\ls *.wav | xargs -i lame -h '{}' '{}'.mp3</PRE
><P
>This would find all wave <A
NAME="AEN4751"
></A
>files within the current directory and convert<A
NAME="AEN4753"
></A
> them to mp3 <A
NAME="AEN4755"
></A
>files (encoded with lame) and append <A
NAME="AEN4757"
></A
>a &ldquo;.mp3&rdquo; to the end of the filename, unfortunately it doesn't remove the .wav and so its not too useful...but it works.</P
></DD
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="DATE-TIME-CALENDARS"
></A
>Date/Time/Calendars</H1
><P
>There is one command to change <A
NAME="AEN4762"
></A
>both the date <A
NAME="AEN4764"
></A
>and time on a <SPAN
CLASS="PRODUCTNAME"
>UNIX</SPAN
> <A
NAME="AEN4767"
></A
>like system, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>date</I
></SPAN
>, there is also a simple calendar <A
NAME="AEN4770"
></A
>utility, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>cal</I
></SPAN
>. If you are looking <A
NAME="AEN4773"
></A
>to change <A
NAME="AEN4775"
></A
>the timestamps <A
NAME="AEN4777"
></A
>on files please see <A
HREF="c4268.htm"
>Chapter 8</A
></P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>date</DT
><DD
><P
>Tells you the date (and the time<A
NAME="AEN4785"
></A
>) and is also used to set <A
NAME="AEN4787"
></A
>the date/time.</P
><P
>To set the date, type<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> date MM:DD:YYYY </I
></SPAN
>(American style date) where MM is month,<A
NAME="AEN4791"
></A
> DD <A
NAME="AEN4793"
></A
>is the number of days <A
NAME="AEN4795"
></A
>within the month <A
NAME="AEN4797"
></A
>and YYYY <A
NAME="AEN4799"
></A
>is the year.<A
NAME="AEN4801"
></A
></P
><P
>For example to set the date to the 1st January 2000 you would type:</P
><PRE
CLASS="SCREEN"
>date 01:01:2000</PRE
><P
>To set the time (where the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-s<A
NAME="AEN4807"
></A
></I
></SPAN
> option is to set a new <A
NAME="AEN4809"
></A
>time), type:</P
><PRE
CLASS="SCREEN"
>date<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> </I
></SPAN
>-s hh:mm:ss</PRE
><P
>Another useful option you can use is <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>--date=&ldquo;string&rdquo;</I
></SPAN
> <A
NAME="AEN4815"
></A
>(or <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-d<A
NAME="AEN4818"
></A
></I
></SPAN
> <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>&ldquo;string&rdquo;</I
></SPAN
>) option to display <A
NAME="AEN4821"
></A
>a date from x days <A
NAME="AEN4823"
></A
>ago or in x days <A
NAME="AEN4825"
></A
>(or x weeks, months,<A
NAME="AEN4827"
></A
> years <A
NAME="AEN4829"
></A
>et cetera). See the examples below. </P
><P
>Examples:</P
><PRE
CLASS="SCREEN"
>date --date="3 months 1 day ago"</PRE
><P
>Will print the date 3 months <A
NAME="AEN4834"
></A
>and 1 day <A
NAME="AEN4836"
></A
>ago from the current date. Note that <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>--date=&rdquo;x month x day ago&rdquo;</I
></SPAN
> and<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> -d <A
NAME="AEN4840"
></A
>&ldquo;x month x day ago&rdquo;</I
></SPAN
> are equivalent.<A
NAME="AEN4842"
></A
></P
><PRE
CLASS="SCREEN"
>date -d "3 days"</PRE
><P
>The above command will print the date 3 days <A
NAME="AEN4846"
></A
> in the future from now.</P
></DD
><DT
>cal</DT
><DD
><P
><A
NAME="AEN4852"
></A
>Typing <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>cal</I
></SPAN
> will give you the calendar <A
NAME="AEN4855"
></A
>of the present <A
NAME="AEN4857"
></A
>month on your screen,<A
NAME="AEN4859"
></A
> in the nice <A
NAME="AEN4861"
></A
>standard calendar <A
NAME="AEN4863"
></A
>format. There are various options <A
NAME="AEN4865"
></A
>to customise <A
NAME="AEN4867"
></A
>the calendar,<A
NAME="AEN4869"
></A
> refer <A
NAME="AEN4871"
></A
>to the info/man page.<A
NAME="AEN4873"
></A
></P
><P
>Example:</P
><PRE
CLASS="SCREEN"
>cal -y year</PRE
><P
><A
NAME="AEN4878"
></A
>Will display a calendar <A
NAME="AEN4880"
></A
>for a specific <A
NAME="AEN4882"
></A
>year, simply use cal -y <A
NAME="AEN4884"
></A
>to print the calendar <A
NAME="AEN4886"
></A
>for the current year.</P
><PRE
CLASS="SCREEN"
>cal 2 2004</PRE
><P
>This will display the calendar <A
NAME="AEN4890"
></A
>for February 2004</P
></DD
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x4055.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.htm"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x4892.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Mass Rename/copy/link Tools</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Finding information about partitions</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>