The terminal backlog is just sitting in memory as well. Just don’t leave passwords there, remove them immediately.
You also have an option not to save the command in history, e.g. whitespace prefix in bash.
Half of my bash commands that are longer than 20 symbols start with ^R to look up a similar command and edit it, not having history would make that much slower.