Display the time at the LINUX command prompt and CMD command prompt

Source: Internet
Author: User
Tags add time
One of the purposes of displaying time in the LINUX command prompt and CMD command prompt is to view the execution time of a command or program. 1. the time setting parameter description is displayed in CMD: $ P: current path $ G: & gt; (greater than the number) $ T: current time. The result is accurate to the following: C: one of the purposes that the Usersg4-1016tx shows in LINUX's command and command prompts is to view the execution time of a command or program. 1. the time setting parameter description is displayed in CMD: $ P: current path $ G:> (greater than the number) $ T: current time, accurate to 0.01s. the experiment is as follows: C: \ Users \ g4-1016tx> prompt $ P $ S $ T $ g c: \ Users \ g4-1016tx 13:19:53. 92> arp-a interface: 192.168.0.189 --- 0xb Internet address physical address type 192.168.0.1 c8-3a-35-5a-f1-10 dynamic C: \ Users \ g4-1016tx 13:19:56. 46> 2. modify the shell command prompt in LINUX to display 1. modify the prompt of a single user and add this item to the user environment variable. in this way, only the prompt of the current user is modified. Note that after modification, you need to reload the user's environment variable source. bash_profile or exit and log on again. [Oracle @ dg2 :~ Sat Aug 03-13:09:57 $] tail-n 1. bash_profile export PS1 = '[\ u @ \ h: \ w \ d-\ t \ $]' 2. modify the global user prompt. if you need to modify the entire system, you need to modify the prompt. [Root @ dg2 ~] # Tail-n 1/etc/profileexport PS1 = '[\ u @ \ h: \ w \ d-\ t \ $]' [root @ dg2 ~] # Su-oracle [oracle @ dg2 :~ Sat Aug 03-13:16:59 $] Detailed explanation of each display parameter in the command prompt:, where/u shows the current user account,/h shows the current host name,/W shows the current path, /$ Display the '$' symbol/W instead of/w to convert the absolute path to the relative path/d: represents the date, in the format of weekday month date, for example: "Mon Aug 1 usd/h: complete host name. For example, if the name of my machine is fc4.linux, the name is fc4.linux/h: only the first name of the host. in the preceding example, the name is fc4 ,. linux is omitted/t: The display time is in the 24-hour format, for example, HH: MM: SS/T: The display time is in the 12-hour format/A: The display time is in the 24-hour format: HH: MM/u: account name of the current user/v: BASH version/w: complete working directory name. In the home directory ~ Replace/W: use basename to get the name of the working directory. Therefore, only the last directory/# is listed. the Command/$ is the prompt character. if it is root, the prompt is: #, for common users: $3. directly use the TIME command in UNIX-like to count the running time of a command. the usage method is to add TIME before the command to be executed, for example: [oracle @ bys001 ~] $ Time dateMon Sep 16 17:00:31 CST 2013 real 0m0. 015 suser 0m0. 001 ssys 0m0. 013 s [oracle @ bys001 ~] $ Time echo hellohello real 0m0. 000 suser 0m0. 000 ssys 0m0. 001 s

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.