Terminal "history" command brings back different results In OSX's terminal, I run the history command to find my recent commands. Often I notice recent commands will not show up, seemingly randomly. For example, I will log on one-day and notice my commands from the previous day are not showing in history (though they did they day before) but rather last week's commands are there.
How do you troubleshoot this? Is it an error or I am understanding something incorrectly?
In other words, Terminal.app connects you to a certain shell, allowing you to access all sorts of them concurrently.
Run cat /etc/shells to see what shells are on your system.
I’m sure you’ve got Bash, ZSH, and a few others.
Then read up on configuring the history for your chosen shell, and try to make it a habit to always know which shell you’re using.
The fish shell, for instance, has an extensive and user friendly history browser, allowing you to see all commands you’ve run using fish.
With bash it’s a bit different.
Also Mac specific:
If you have apps that run maintenance and require administrative privileges, they likely run some of their tasks as simple shell scripts, and almost always using sh.
Think: Catalina Cache Cleaner, Cocktail and Onyx, to name a few.