Package: rash
Links:Documentation(at Read the Docs)CommandsConfigurationTipsRepository(at GitHub)Issue tracker(at GitHub)PyPITravis CIWhat is this?Shell history is useful.  But it can be more useful if it logs more
data points.  For example, if you forget whichmaketarget to run
for certain project, you’d want to search shell commands that are
run in particular directory.  Wouldn’t it be nice if you can do this?:rash search --cwd . "make*"RASH records many data points and they are stored in SQLite database.
Here is a list of recorded information[1].Current directory ($PWD).Exit code ($?)Exit code of pipes ($PIPESTATUS/$pipestatus)The time command is started and terminated.Environment variable ($PATH,$SHELL,$TERM,$HOST, etc.)Real terminal.$TERMis used to fake programs.
RASH can detect if you are in tmux, byobu, screen, gnome-terminal, etc.Session information.  If you go back and forth in some terminals,
RASH does not loose in which sequence you ran the commands in which
terminal.[1]If you are curious, checkoutrash record--help.RASH also has interactive search interface.  You can see the search
result as you type.  If you are using zsh, you can execute the result
instantaneously.InstallRASH is written in Python.  The easiest way to install is to usepip(oreasy_install, if you wish).  You may needsudofor installing
it in a system directory.:pip install rash
pip install percol  # if you want interactive search featureIf you use virtualenv to install RASH, you may have trouble when
switching environment.  In that case, it is safe to make an alias
to full path of the rash executable.:alias rash="PATH/TO/VIRTUALENV/bin/rash"If you want to use developmental version, just clone the git repository
and add the following in your RC file.:alias rash="PATH/TO/RASH/rash_cli.py"SetupAdd this to your.zshrcor.bashrc.  That’s all.:eval "$(rash init)"For more information, seerash init--help.UsageSearching history –rash searchAfter your shell history is accumulated by RASH, it’s the time to
make use of the history!  Seerash search--helpfor detailed
information.  Here is some examples.Forget how to run automated test for the current project?:rash search --cwd . --include-pattern "*test*" --include-pattern "tox*"All git commands you ran in one week.:rash search --time-after "1 week ago" "git*"Some intensive task you ran in the current project that succeeded and
took longer than 30 minutes.:rash search --cwd-under . --include-exit-code 0 --duration-longer-than 30mWhat did I do aftercd-ing to some directory?:rash search --after-context 5 "cd SOME-DIRECTORY"All failed commands you ran at this directory.:rash search --cwd . --exclude-exit-code 0Count number of commands you ran in one day:rash search --limit -1 --no-unique --time-after "1 day ago" | wc -lShowing detailed information –rash showIf you give--with-command-idtorash searchcommand, it prints out
ID number for each command history.:% rash search --with-command-id --limit 5 "*git*"
 359  git log
1253  git help clone
1677  git help diff
1678  git diff --word-diff
1780  git mergeYou can see all information associated with a command withrash showcommand:rash show 1677Interactive search –rash isearchSearching history using command line is not fast.
You can userash isearchcommand to interactively search
history and see the result immediately as you type.You needpercolto use this feature.Zsh user can setup a keybind like this:# Type `Ctrl-x r` to start isearch
bindkey "^Xr" rash-zle-isearchDefining this function in your rc file can be handy and it is
usable for bash users.:rash-isearch(){
  eval "$(rash isearch)"
}DependencyRASH tested against Python 2.6, 2.7 and 3.2.  However, as some
dependencies are not Python 3 compatible, some functionality is
missing when used with Python 3.Python modules:watchdog[2]parsedatetime[2][2](1,2)These modules do not support Python 3.
They are not installed in if you use Python 3
and related functionality is disabled.PlatformsUNIX-like systemsRASH is tested in Linux and I am using in Linux.
It should work in other UNIX-like systems like BSD.Mac OSI guess it works.  Not tested.MS WindowsProbably no one wants to use a shell tool in windows, but I
try to avoid stuff that is platform specific.  Only the
daemon launcher will not work on Windows but there is several
ways to avoid using it.  Seerash init--help.ShellsRASH currently supports zsh and bash.Design principleRASH’s design is focused on sparseness.  There are several stages
of data transformation until you see the search result, and they
are done by separated processes.First,rash recordcommand dumps shell history in raw JSON record.
This part of program does not touches to DB to make process very fast.
As there is no complex transformation in this command, probably in the
future version it is better to rewrite it entirely in shell function.Second,rash daemonruns in background and watches the directory to
store JSON record.  When JSON record arrives, it insert the data into
database.rash recordandrash daemonare setup by simple shell snippeteval $(rash init).Finally, you can search through command history using search interface
such asrash search.  This search is very fast as you don’t read
all JSON records in separated files.+-------+         +--------+         +--------+         +--------+
| Shell |         | Raw    |         | SQLite |         | Search |
| hooks |-------->| JSON   |-------->|   DB   |-------->| result |
+-------+         | record |         +--------+         +--------+
                  +--------+

        `rash record`      `rash daemon`      `rash search`
                                               `rash show`

        \------------------------------/      \------------/
           `rash init` setups them           search interfaceLicenseRASH is licensed under GPL v3.
See COPYING for details.