简体   繁体   中英

How to find history of shell commands since machine was created?

I created an Ubuntu virtualbox machine a couple weeks ago and have been working on projects off and on in it since then.

Now I would like to find the syntax of some commands I typed in the terminal a week ago, but I have opened and closed the terminal window and restarted the machine numerous times.

How can I get the history command to go back to the first command I typed after I created the machine, or is there another place that all the commands are stored in Ubuntu?

1) The size of the history file is governed by the environment variable HISTSIZE. The default is 500 lines on most systems.

2) You can set $HISTSIZE in your ~/.bashrc (or other) initialization file.

3) You can check your current history simply by typing "history".

4) You can learn more about the command and various options by typing "man history".

Here's a good article on the subject:

In the general case, there is no facility that permanently records all commands in all shells. Bash has a limited history, but once your commands rolled off the history list, they're gone. If your command involved sudo , the system logs may contain all or parts of the command lines you would like to retrieve. The virtual machine you are using may offer a facility for going backwards in time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM