Display the time in the history command

Source: Internet
Author: User
Display the time-general Linux technology-Linux technology and application information in the history command. The following is a detailed description. Csh on FreeBSD 6.1 is enabled by default.

BASH on Linux does not enable this function by default. The enable method is to set the environment variable HISTTIMEFORMAT. For the device method, see the strftime format (man 3 strftime to view details ). However, this function can only be used in Versions later than BASH3.0. The original text is written as follows:

New HISTTIMEFORMAT variable; value is a format string to pass to strftime (3 ). if set and not null, the 'History 'builtin prints out timestamp information according to the specified format when displaying history entries. if set, bash tells the history library to write out timestamp information when the history file is written.

For example ~ /. Add the following line in bash_profile:

Export HISTTIMEFORMAT = "% F % T"

Then, the time is displayed when history is used.
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.