In Linux, there’s a last command that lists successful login/logout history with user-name, date, ip, and so forth. There’s also a lastb command that shows failed login attempts information.

The successful login/logout history was stored in “/var/log/wtmp“, and the failed login attempts were stored in /var/log/btmp“. To clear the login history, just clear the two directories.

Open a command console (Applications -> Accessories -> Terminal), and run this command to get root privilege:

sudo -i

Use echo to clear the directories:

echo >/var/log/wtmp
echo > /var/log/btmp

Now, try last and lastb again.

To clear command history, just run history command with -c parameter. Or clear ./.bash_history

history -c


echo > ./.bash_history