Home > System Tutorial > LINUX > 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
Release: 2024-01-13 21:24:12
forward
1558 people have browsed it

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!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template