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:> (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

Related Article

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.