Sunday 6 March 2016

Linux Hacks 1.2 Leave no Trace on the Terminal

Linux-Terminal-Hacks
Linux Hacks
While the earlier article showed you some ways to accomplish this task. I've got a even better way. Do read the earlier article as this will help you in understanding about bash history under Linux.

For those in a hurry, here's ur way...


 
set +o history

This command works like a charm. This command will leave no history for the current terminal session. This command is like a on/off switch for history.
The above command is actually the off switch. Wondering what's the on switch.


Well if you are familiar with the Linux terminal. You can make an logical guess.
Its "set -o history".

Here are some examples.


Example 1:


I Opened a new terminal with a clean bash history file.

user@pc:~$ set +o history
user@pc:~$ i am now doing my secret work
The program 'i' is currently not installed. You can install it by typing:
sudo apt-get install iprint

user@pc:~$

Then i exited normally by pressing ALT+F4 or Ctrl+D or cross button.
Then opened a new terminal window and typed the following

user@pc:~$ history
    1  history
user@pc:~$

Example 2:


Opened a new terminal window and executed the following commands, one after the other without closing the terminal even once.
 
user@pc:~$ history
    1  history
user@pc:~$ thiswillbeshow
thiswillbeshow: command not found
user@pc:~$ set +o history
user@pc:~$ thiswillnotbeshown
thiswillnotbeshown: command not found
user@pc:~$ history
    1  history
    2  thiswillbeshow
    3  set +o history
user@pc:~$ 

Now I closed the terminal and opened a new terminal window.
 
user@pc:~$ history
    1  history
user@pc:~$ 


I hope these examples will teach you how to avoid leaving any trace on the terminal. I will be updating this series with a even better way. Don't forget to  test the set -o history option also.

 * Warning     
  Messing with history(if caught) will land you up in trouble with the system admin. This method will not work if your key log is stored and your keystrokes were being monitored. This article is strictly written for educational purposes. I take no responsibility for your actions or any damage that you cause to the system. I do not in any way promote malicious or unauthorized activity. Let me repeat:- STRICTLY FOR EDUCATIONAL PURPOSE

No comments:

Post a Comment