IPython: How to wipe IPython's history selectively & securely?

后端 未结 6 1234
北海茫月
北海茫月 2020-12-29 02:52

I have been learning how to use the paramiko package only to discover that all I stored passwords in plain text in IPython\'s %hist. Not so good.

6条回答
  •  情歌与酒
    2020-12-29 03:20

    If you want to delete history from a particular session, run:

    sqlite ~/.ipython/profile_default/history.sqlite
    

    Note that on some systems, you will need to run sqlite3 rather than sqlite.

    Inside SQLite:

    select * from history;
    # session is the first column in history
    delete from history where session=XXX;
    

    Also, here is a SQLite query that will give you the id of your last session:

    select session from history order by -session limit 1;
    

提交回复
热议问题