3

Right now, I'm aware that for all commands typed into the console, the Ubuntu system logs it somewhere.

How can I disable logging of unix commands for all users?

2
  • 1
    It would be helpful for future readers to understand why someone might wish to remove command histories. By way of counterpoint, users frequently retype the same or similar commands and can avail themselves of the ctrl-r, up arrow, or bang mechanisms. – dmourati Oct 3 '12 at 18:09
  • As a tip if you put a space before command (start the command with a space) it will not be recorded in your history, and up/down arrow keys will not show it either. – Mahdi Jul 3 '17 at 16:20
5

Try putting this in your /etc/profile:

unset HISTFILE

This only works for shells which evaluate the systemwide profile like bash and sh, see bash manual. Not sure about other shells. Also, users need to logout and login again to make it work.

2
  • @Shi unfortunately I can't approve your suggested edit, so I have to do it manually. – Alexander Janssen Oct 3 '12 at 17:38
  • Funny. I couldn't approve it in the notifications, because I don't have enough points, but I was able to do it when I clicked on edit. – Alexander Janssen Oct 3 '12 at 17:40
2

You can also disable history using command

set +o history

This would be per shell. To make it permanent put it in /etc/profile

More details.

1

You can easely erase your current user command history using

history -c

useful if you typed a password as a commnad parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.