By default do terminal commands get logged?
short: no
long: It depends:
- most shells have a history mechanism which records command-lines.
- shell-history usually is configurable (and may not be activated).
- But things like text-editors generally do not (your keystrokes are not logged—usually)
Also, even with shells, it is not common to be able to have multiple instances of shells running and record all of the commands from these instance.
Besides shell-history, there are other ways to record your commands, e.g., using low-level auditing programs (which record the resources which your commands use), or text-only things like script
(which can record all of the information sent from the computer to the terminal).
Even if your shell is not configured to record commands, you may work in an environment where auditing is configured. For those "by default", there is a record.
Further reading:
- How to disable Bash shell commands history on Linux
- How can you log every command typed
- How to track/log commands executed on a shell?
It depends what shell you're using. If you're not using Windows and you are using your system's default shell then you're probably using the Bash shell.
The Bash shell stores a list of most of the commands you've entered in a file defined by the HISTFILE
environment variable. By default this is ~/.histfile
. By changing HISTFILE
to something else you can store the history somewhere else. /dev/null
is popular for those who want to hide their history. Bash also stores your history in RAM, which is why you can still use the up and down arrow keys even when you set HISTFILE
to /dev/null
.
Now, you'll notice I said most of the commands you've entered. Commands prefaced with a space don't show up in your history.