{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3 :: Only", "Topic :: System :: Logging", "Topic :: System :: Shells", "Topic :: Utilities" ], "description": "# Recent\n\nRecent is a more structured way to log your bash history.\n\nThe standard `~/.bash_history` file is inadequate in many ways, its\nworst fault is to by default log only 500 history entries, with no timestamp.\nYou can alter your bash `HISTFILESIZE` and `HISTTIMEFORMAT` variables but it\nis still a unstructured format with limited querying ability.\n\nRecent does the following.\n\n1. Logs current localtime, command text, current pid, command return value,\n working directory to an sqlite database in `~/.recent.db`.\n2. Logs history immediately, rather than at the close of the session.\n3. Provides a command called `recent` for searching bash history.\n\n## NOTE about [trengrj/recent](https://github.com/trengrj/recent)\n\n`recent2` is a clone of [trengrj/recent](https://github.com/trengrj/recent). I\nused [trengrj](https://github.com/trengrj)'s util for about a month and I really\nliked it. However I saw some short comings in the tool. I made a clone because\ntrengrj has not been very responsive.\n\nMost of the code is written by [trengrj](https://github.com/trengrj). I only added\na few incremental patches; but I intend to actively maintain this as I see more\ninteresting use cases.\n\n## Installation instructions\n\nYou need will need sqlite installed.\n\nInstall the recent pip package.\n\n`pip install recent2`\n\nAdd the following to your `.bashrc` or `.bash_profile`.\n\n`export PROMPT_COMMAND='log-recent -r $? -c \"$(HISTTIMEFORMAT= history 1)\" -p $$'`\n\nAnd start a new shell.\n\n## Usage\n\nSee example usage at https://asciinema.org/a/271533\n\n### Help Text\n\n```sh\n> recent -h\nusage: recent [-h] [-n 20] [--status_num 0] [--successes_only]\n [--failures_only] [-w /folder] [-d 2016-10-01] [--return_self]\n [--hide_time] [-re] [-sql]\n [pattern]\n\nrecent is a convinient way to query bash history. Visit\nhttps://github.com/dotslash/recent2 for more examples or to ask\nquestions or to report issues\n\npositional arguments:\n pattern optional pattern to search\n\noptional arguments:\n -h, --help show this help message and exit\n -n 20 max results to return\n --status_num 0, -stn 0\n int exit status of the commands to return. -1 =>\n return all.\n --successes_only, -so\n only return commands that exited with success\n --failures_only, -fo only return commands that exited with failure\n -w /folder working directory\n -d 2016-10-01 date in YYYY-MM-DD, YYYY-MM, or YYYY format\n --return_self Return `recent` commands also in the output\n --hide_time, -ht dont display time in command output\n -re enable regex search pattern\n -sql enable sqlite search pattern\n\nTo import bash history into recent db run recent-import-bash-history\n```\n\nLook at your current history using recent. Here are some examples on how to use recent.\n\n### Basic examples\n\n```sh\n# Look for all git commands\nrecent git\n# Look for git commit commands. Query via regexp mode.\nrecent -re git.*commit\n```\n\n### Less basic usage\n\n- Filter commands by exit status\n 1. `recent git --successes_only` or `recent git -so`\n 2. `recent git --failures_only` or `recent git -fo`\n 3. `recent git --status_num 1` or `recent git -stn 1` returns only the git commands that have exit status 1.\n- `recent git --return_self`. By default `recent` commands are not displayed in the output. Pass the `return_self` to change that.\n- `recent git -w ~/code`. This returns only the commands that were executed with `~/code` as current working directory.\n- Filter the commands by execution date by doing `recent git -d 2019` or `recent git -d 2019-10` or `recent git -d 2019-10-04`\n- By default recent prints command timestamp and the command in the output. Use `recent git --hide_time` or `recent git -ht` to hide the command timestamp. This is useful when copy-pasting commands from output.\n\n### Usage via sqlite\n\nIt is possible directly interact with sqlite if all the above options have failed you. See the table schema below.\n\n```sql\nCREATE TABLE commands(\n command_dt timestamp,\n command text,\n pid int,\n return_val int,\n pwd text,\n session text);\nCREATE INDEX command_dt_ind on commands (command_dt);\n```\n\n- option1: `recent -sql 'command like \"%git%\" and command not like \"%commit%\"'`\n- option2: You can directly play around with sqlite `sqlite3 ~/.recent.db \"select * from commands limit 10\"`\n\n## Dev installation instructions\n\n```sh\ngit clone https://github.com/dotslash/recent2 && cd recent2\npip install -e .\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dotslash/recent2", "keywords": "logging bash history database sqlite", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "recent2", "package_url": "https://pypi.org/project/recent2/", "platform": "", "project_url": "https://pypi.org/project/recent2/", "project_urls": { "Homepage": "https://github.com/dotslash/recent2" }, "release_url": "https://pypi.org/project/recent2/0.2.3/", "requires_dist": null, "requires_python": "", "summary": "Logs bash history to an sqlite database", "version": "0.2.3" }, "last_serial": 5987442, "releases": { "0.1.6": [ { "comment_text": "", "digests": { "md5": "ebd1e3d24000991185a26d81687e0237", "sha256": "51e7fc190aef6a5ed3be07118ef741fa2c8129187ead279baf41f704b2398076" }, "downloads": -1, "filename": "recent2-0.1.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ebd1e3d24000991185a26d81687e0237", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6223, "upload_time": "2019-09-29T22:26:22", "url": "https://files.pythonhosted.org/packages/89/1f/0093ea9f7394ab9b534deb575b3ce35efd303dc12c33889b8f6fe2c0bec0/recent2-0.1.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "66a85f60b6c654a9a5db6f6e5e860ff4", "sha256": "48a0fb623f0f0170722916711eda2ec7b98e492ddea8dfd5794586dba4a2c98c" }, "downloads": -1, "filename": "recent2-0.1.6.tar.gz", "has_sig": false, "md5_digest": "66a85f60b6c654a9a5db6f6e5e860ff4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5127, "upload_time": "2019-09-29T22:26:24", "url": "https://files.pythonhosted.org/packages/29/67/e1d8d79c9c56cc0f63c0fcefa34a0b9fe230bb7003f553c45b0e735a7f6b/recent2-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "11a6fafb7720b54f9b3dc1b6726f157d", "sha256": "2b8e1ea16e39260b990572150d8700001b044cd7c74718452e1f118d9bee9b03" }, "downloads": -1, "filename": "recent2-0.1.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "11a6fafb7720b54f9b3dc1b6726f157d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6352, "upload_time": "2019-10-02T04:27:10", "url": "https://files.pythonhosted.org/packages/5d/73/6324d0be6e0fccc2e37a82817eae4b4da62faccdc61818e438561c178b3f/recent2-0.1.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "393fbf1861fe37634de1243c4b1a0e4f", "sha256": "be7a0136a734a9b84acbbf3c541c2938a70c4ebec2120a051a9b7e6156efae13" }, "downloads": -1, "filename": "recent2-0.1.7.tar.gz", "has_sig": false, "md5_digest": "393fbf1861fe37634de1243c4b1a0e4f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5297, "upload_time": "2019-10-02T04:27:11", "url": "https://files.pythonhosted.org/packages/64/53/86b2ac518aa8a9ba4d7e7a35774f4e756edf02d745ce6d74270a78bbaac0/recent2-0.1.7.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "51fe80da434afdf4e18a37673abc036c", "sha256": "d2312fd054840ebf5e35f99e3a02021a868422eaf38f97d2776ee449b022c633" }, "downloads": -1, "filename": "recent2-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "51fe80da434afdf4e18a37673abc036c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7832, "upload_time": "2019-10-12T20:52:13", "url": "https://files.pythonhosted.org/packages/e9/64/d274d87ca677663c2fd7512516d0da5ace7ac9074159036b8af4a2d94d5a/recent2-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f8306f245dac2c092afd9a6a8335925c", "sha256": "50a4f839626889d1b7082d82125555f7d0870565a0824d954108b4f172ee0ba7" }, "downloads": -1, "filename": "recent2-0.2.1.tar.gz", "has_sig": false, "md5_digest": "f8306f245dac2c092afd9a6a8335925c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6718, "upload_time": "2019-10-12T20:52:15", "url": "https://files.pythonhosted.org/packages/b9/a7/82657fa82fbd842a26412176ad9e771bfd34c746ea81ca4a691babd68181/recent2-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "e58c4134c80fb2efa4f4446c37ea0ce9", "sha256": "6b38b698f87604a3102f5133b82a9351c23c3eb6257d948663c9cba8fe574ffe" }, "downloads": -1, "filename": "recent2-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e58c4134c80fb2efa4f4446c37ea0ce9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8816, "upload_time": "2019-10-14T05:16:26", "url": "https://files.pythonhosted.org/packages/5f/bb/a1e6d5ad1144cf5e57df7f7c69a334348be4993cc92478980feed92b18bf/recent2-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "059662fb2d9f961a66e300ad3dee4d47", "sha256": "e59d9f263aede19326bea6af67ac91bb45952070cdfa4aec9416302ba2daaa74" }, "downloads": -1, "filename": "recent2-0.2.2.tar.gz", "has_sig": false, "md5_digest": "059662fb2d9f961a66e300ad3dee4d47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7679, "upload_time": "2019-10-14T05:16:28", "url": "https://files.pythonhosted.org/packages/b4/83/c27aca1907029d89814b6aa8f7de49cfc3d3d51f6c570ab6454c45022bcb/recent2-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "212f232f35a9b559bb70be05636ce685", "sha256": "f6f184a35cc383a98e25e8e5a8bd96534797d85cf5bd3fc851a42242ecca6f0b" }, "downloads": -1, "filename": "recent2-0.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "212f232f35a9b559bb70be05636ce685", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8828, "upload_time": "2019-10-17T04:11:26", "url": "https://files.pythonhosted.org/packages/19/d3/fa308849630dacdb18dc62a482c26b092e1a799a62f106346b2ac8bc0ea6/recent2-0.2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "97ee9b8a1e3fd6e5f704f93bdfdbbc47", "sha256": "8a542bdb91a84cdfaf83045a632d3219d2b667a24959c650d6445c651fa71509" }, "downloads": -1, "filename": "recent2-0.2.3.tar.gz", "has_sig": false, "md5_digest": "97ee9b8a1e3fd6e5f704f93bdfdbbc47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7697, "upload_time": "2019-10-17T04:11:29", "url": "https://files.pythonhosted.org/packages/4c/9d/8153ff5bff6a4adf37730466220a30c9a4349f14afae7f9a5d024bbe9811/recent2-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "212f232f35a9b559bb70be05636ce685", "sha256": "f6f184a35cc383a98e25e8e5a8bd96534797d85cf5bd3fc851a42242ecca6f0b" }, "downloads": -1, "filename": "recent2-0.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "212f232f35a9b559bb70be05636ce685", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8828, "upload_time": "2019-10-17T04:11:26", "url": "https://files.pythonhosted.org/packages/19/d3/fa308849630dacdb18dc62a482c26b092e1a799a62f106346b2ac8bc0ea6/recent2-0.2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "97ee9b8a1e3fd6e5f704f93bdfdbbc47", "sha256": "8a542bdb91a84cdfaf83045a632d3219d2b667a24959c650d6445c651fa71509" }, "downloads": -1, "filename": "recent2-0.2.3.tar.gz", "has_sig": false, "md5_digest": "97ee9b8a1e3fd6e5f704f93bdfdbbc47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7697, "upload_time": "2019-10-17T04:11:29", "url": "https://files.pythonhosted.org/packages/4c/9d/8153ff5bff6a4adf37730466220a30c9a4349f14afae7f9a5d024bbe9811/recent2-0.2.3.tar.gz" } ] }