Home  >  Article  >  System Tutorial  >  How to make the Linux history command display the date in front?

How to make the Linux history command display the date in front?

WBOY
WBOYforward
2024-01-13 21:24:121491browse

In the Linux system, if you want to display the date in front of the history, how to set it up? We can configure it in the user's .bashrc file. After the application takes effect, the date can be displayed in front of the history command. Please see the detailed introduction below.

How to make the Linux history command display the date in front?

1. For systems using Ubuntu Linux, you can right-click on the desktop and "

Open Terminal".

How to make the Linux history command display the date in front?

2. Use the following command to open the .

bashrc file.

$sudo gedit ~/.bashrc

How to make the Linux history command display the date in front?

3. We will open such a bashrc file window.

How to make the Linux history command display the date in front?

4. At the end we add

export HISTTIMEFORMAT=" %F %T "Or you can also use export HISTTIMEFORMAT=" [%Y.%m.%d %H:%M:%S] ”

How to make the Linux history command display the date in front?

5. Then we use the

source command to take effect, or you can also reopen the terminal window.

$source ~/.bashrc

How to make the Linux history command display the date in front?

6. Now we can use the history command in the terminal to display the date in front.

How to make the Linux history command display the date in front?

Note: is the date calculated from the time of configuration.

The above is the detailed content of How to make the Linux history command display the date in front?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete