'Viewing command history in Google Cloud shell

I am trying to view some commands I used several months ago for a course project. I used the history command but it only showed very recent lines. Is there a way to view older command history? thanks!



Solution 1:[1]

Your list of executed commands is stored in .bash_history. You can find this file in the home folder of Cloud Shell.

Cloud Shell's home folder is deleted after 120 days of inactivity. So, if you're looking for commands that you used several months ago and your Cloud Shell was inactive for more than 120 days, chances are that your disk was deleted.

Also, by default, bash stores the last 500 executed commands history.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rickyticotaco