Show More
@@ -2435,7 +2435,7 b' A history function %hist allows you to see any part of your input' | |||||
2435 | history by printing a range of the _i variables. |
|
2435 | history by printing a range of the _i variables. | |
2436 |
|
2436 | |||
2437 | You can also search ('grep') through your history by typing |
|
2437 | You can also search ('grep') through your history by typing | |
2438 |
'%hist -g somestring'. This also searches through the so called |
|
2438 | '%hist -g somestring'. This also searches through the so called *shadow history*, | |
2439 | which remembers all the commands (apart from multiline code blocks) |
|
2439 | which remembers all the commands (apart from multiline code blocks) | |
2440 | you have ever entered. Handy for searching for svn/bzr URL's, IP adrresses |
|
2440 | you have ever entered. Handy for searching for svn/bzr URL's, IP adrresses | |
2441 | etc. You can bring shadow history entries listed by '%hist -g' up for editing |
|
2441 | etc. You can bring shadow history entries listed by '%hist -g' up for editing | |
@@ -2444,6 +2444,32 b' entries are not available as _iNUMBER variables, and they are identified by' | |||||
2444 | the '0' prefix in %hist -g output. That is, history entry 12 is a normal |
|
2444 | the '0' prefix in %hist -g output. That is, history entry 12 is a normal | |
2445 | history entry, but 0231 is a shadow history entry. |
|
2445 | history entry, but 0231 is a shadow history entry. | |
2446 |
|
2446 | |||
|
2447 | Shadow history was added because the readline history is inherently very | |||
|
2448 | unsafe - if you have multiple IPython sessions open, the last session | |||
|
2449 | to close will overwrite the history of previountly closed session. Likewise, | |||
|
2450 | if a crash occurs, history is never saved, whereas shadow history entries | |||
|
2451 | are added after entering every command (so a command executed | |||
|
2452 | in another IPython session is immediately available in other IPython | |||
|
2453 | sessions that are open). | |||
|
2454 | ||||
|
2455 | To conserve space, a command can exist in shadow history only once - it doesn't | |||
|
2456 | make sense to store a common line like "cd .." a thousand times. The idea is | |||
|
2457 | mainly to provide a reliable place where valuable, hard-to-remember commands can | |||
|
2458 | always be retrieved, as opposed to providing an exact sequence of commands | |||
|
2459 | you have entered in actual order. | |||
|
2460 | ||||
|
2461 | Because shadow history has all the commands you have ever executed, | |||
|
2462 | time taken by %hist -g will increase oven time. If it ever starts to take | |||
|
2463 | too long (or it ends up containing sensitive information like passwords), | |||
|
2464 | clear the shadow history by `%clear shadow_nuke`. | |||
|
2465 | ||||
|
2466 | Time taken to add entries to shadow history should be negligible, but | |||
|
2467 | in any case, if you start noticing performance degradation after using | |||
|
2468 | IPython for a long time (or running a script that floods the shadow history!), | |||
|
2469 | you can 'compress' the shadow history by executing | |||
|
2470 | `%clear shadow_compress`. In practice, this should never be necessary | |||
|
2471 | in normal use. | |||
|
2472 | ||||
2447 | .. _output_caching: |
|
2473 | .. _output_caching: | |
2448 |
|
2474 | |||
2449 | Output caching system |
|
2475 | Output caching system |
General Comments 0
You need to be logged in to leave comments.
Login now