13 ms·
Atuin replaces your existing shell history with a SQLite database
- user- 4y agoPeople may be interested in RESH, I use it and love it. https://github.com/curusarn/resh https://github.com/curusarn/resh
- arthurcolle 4y agoBut at what cost?
- klibertp 4y agoWhat kind of cost? Obviously, backups on the author's server are not something I'd ever do, but the "offline only mode" is there, apparently. TBH I was thinking about doing this for a while now. History of my shell, which now is 3.8MB in size, is one of my competitive advantages as a developer (and a very nice thing to have as a power user). It accumulated steadily since ~2005, and with fzf searching the history is much faster than having to google, as long as I did what I want to do now even once in the distant past. I even wrote a utility to merge history files across multiple hosts[1], so I don't have to think "where did I last use that command", as I have everything on every host. The problem with this, however, is shell startup time. It started being noticeable a few years ago and is slowly getting irritating. The idea of converting the histfile into sqlite db crossed my mind more than once due to this. [1] https://github.com/piotrklibert/zsh-merge-hist https://github.com/piotrklibert/zsh-merge-hist
- conradludgate 4y agoOne such cost could be database size. I currently have 45k history entries in my database and it sits at roughly 15MB in size due to database indices along with the additional data we store
- klibertp 4y agoBut it's a cost shared by all open shells, right? Well, even if it was 15MB per shell session, it should still be worth it if the startup and searching is faster. For comparison: I use extended ZSH history format, which records a timestamp and duration of the call (and nothing else), and I have ~65k entries there, with history file size, as mentioned, 3.8MB. It could be an order of magnitude larger and I still wouldn't care, as long as it loads faster than it takes ZSH to parse its history file.
- conradludgate 4y agoYes, this is 15MB on disk size for your whole machine. We agree that the trade off is worth it for the utility and speed improvements
- arthurcolle 4y agoThis is interesting, thanks I'm checking it out. I was thinking this could be a flash in the pan thing that would then be annoying to maintain, but obviously global history of everything you've done is definitely a super boon to productivity. How do you handle maintaining this as you transition through jobs, machines, etc? 3.8MB is obviouslly trivially small in size so you could store it on a potato, but like what is your workflow around maintaining these one off ad hoc "developer boost" type tools?
- klibertp 4y ago> How do you handle maintaining this as you transition through jobs, machines, etc? Currently, the tool reads ~/.mergerc, which is a JSON file with a list of SSH hosts to SCP history to and from. As long as the history file is in the same place (it tends to be on hosts that I setup, and otherwise I check in default locations) and the host has an entry in ~/.ssh/config, the tool will work. It's really just a wrapper for a few SCP invocations plus a history file (extended) format parser. Changing servers is just a change in the config file, but it's also helpful for changing jobs, because I can quickly add a bit of filtering before the merging happens. I had to erase some API keys and such a few times, adding `filter` call here: https://github.com/piotrklibert/zsh-merge-hist/blob/master/src/scala/Main.scala#L34 https://github.com/piotrklibert/zsh-merge-hist/blob/master/s... took care of it. > what is your workflow around maintaining these one off ad hoc "developer boost" type tools? Good question. I don't have such workflow, at all. When I commit to write something like this, I try to make sure that it has a scope limited enough so that it can be "completed" or "done". In this case, the tool builds on SSH/SCP and a file format that hasn't changed in the last 20 years (at least). So, once I had it working, there was nothing much to do with it after that. The only change I had to do recently was changing `+` to `*` in the parser, because somehow (not sure how, actually) an empty command made it into the file. But that's all I had to do in 5 years time. I'm not as extreme, but suckless.org philosophy appears to work well here. Here's another example: https://github.com/piotrklibert/nimlock https://github.com/piotrklibert/nimlock - it's a port, done because I wanted to do something in Nim, but it worked for me for years and I suspect it still works now (after going full remote I stopped needing it). There's nothing much that could break (well, Wayland would break it, but I don't use it), and so there's not much you need to do in terms of maintenance. As for language choices - these are basically random. I made the zsh-merge-hist in Scala simply because I was interested in Scala back then. I have little tools written in Nim, OCaml, Racket, Elisp, Raku - and even AWK (pretty nice language actually) and shell. That's another reason why making the tools any more complex than what's absolutely necessary would be a problem: the churn in the ecosystems tends to be too high for me to keep track of, especially since I'd need to track 10 of them. EDIT: I forgot, but obviously the most important "trick" is not giving a shit if these things work for anyone else but me :D > I'm checking it out If you have Java installed, `./gradlew installDist` should give you `./build/install/bin/zsh-merge-hist` executable to run. The ~/.mergerc (on the host the tool runs) should look like this: { "hosts": ["host1"], "tempDir": "/tmp/zsh-merge-hist", "sourcePath": "mgmnt/zsh_history" } where `sourcePath` is a path to history file relative to the home directory.
- cmm 4y agothere's this little gotcha you might want to be aware of: https://github.com/ellie/atuin/issues/752#issuecomment-1451865985 https://github.com/ellie/atuin/issues/752#issuecomment-14518...
- justinclift 4y agoIt sounds serious, but there's not much info in that issue of what's going wrong, why it's going wrong, etc. (?)
- pcthrowaway 4y agoCan you tell me if my understanding of this issue is correct? Let's say I run a command where I've pasted in a credential from my password manager: ` some-cli login username my-secret-password` (note space at beginning) Normally this would prevent the command from getting saved in any meaningful way in my bash history, so that if I later run a malicious script, it can't collect secrets from my bash history. With the bug here, it sounds like atuin would prevent that entry from being stored in the sqlite store, but it would still be in my shell history? If so, this is really significant, and would stop me from using Atuin. Not letting users know about this behaviour is incredibly negligent, and honestly erodes my trust in Atuin to consider user security in general.
- cmm 4y agocorrect
- shawabawa3 4y agoIt's FOSS, with optional free service to host your history (encrypted with local key), I think there's a paid option above a free tier You can also host your own backend
- conradludgate 4y agoThere's currently no paid option. Obviously one should assume such a free service can't be sustainable so you'd be correct to think we should have one. Currently we rely on Github sponsors as well as our own additional funding
- justinclift 4y agoWith the server, is it primarily a gateway to the hosted SQLite databases? eg receives incoming shell history to store in the backend, and maybe do some searches/retrievals of shell history to pass back? eg for shell completion, etc If that's the case, then I'm wondering if it could work in with online data stores (eg https://api.dbhub.io https://api.dbhub.io <-- my project) that do remote SQLite storage, remote querying, etc.
- conradludgate 4y agoWe currently use postgres. The server is very dumb, verifies user authentication and allows paging through the encrypted entries. There's a PoC that allows it to work with SQLite too for single user setups - and we are thinking of switching to a distributed object store for our public server since we don't need any relational behaviour.
- justinclift 4y agoInteresting. Yeah, we use PostgreSQL as our main data store too. The SQLite databases are just objects that get stored / opened / updated / queried (etc) as their own individual things. :) One of our developer members mentioned they're learning Rust. I'll point them at your project and see if they want to have a go at trying to integrate stuff. At the very least, it might result in a Rust based library for our API getting created. :D
- amadeuspagel 4y agoI think Magical shell history is a better title.
- WJW 4y agoWhile sqlite is pretty cool technology, it doesn't quite deserve the title of "magic".
- ChrisMarshallNY 4y agoThe joke was because of the Terry Pratchett reference. https://discworld.fandom.com/wiki/Great_A%27Tuin https://discworld.fandom.com/wiki/Great_A%27Tuin
- vidarh 4y agoIt took me way too long to realise that's where the name was from...
- ranting-moth 4y agoThis is the feature I've been looking for: "log exit code, cwd, hostname, session, command duration, etc"
- pletnes 4y agoXonsh has this. It’s super cool after using it for a while.
- conradludgate 4y agoThere's a PR opened (that I still need to review...) that adds even more fields such as shell type and opt-in environment variables to this list. One day, you could search for that AWS cli command run specifically on AWS_ACCOUNT_ID=foo
- okasaki 4y agoyou can mostly do that in bash: export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/stuff/logs/bash-history-$(date "+%Y-%m-%d").log; fi' makes files like stuff/logs/bash-history-2023-05-06.log that contain 2023-05-06.11:42:38 /home/dv 3737 2023-05-06 11:42:38 cat .bashrc then you can make some commands to grep through this
- brasic 4y agoOr use the excellent bash-preexec plugin that atuin itself relies on to achieve this in a cleaner way: https://github.com/rcaloras/bash-preexec https://github.com/rcaloras/bash-preexec
- IanCal 4y agoWhat's it like with many shells/panes in multiplexers open? I often find my history from one or another either lost or not available across different ones.
- shawabawa3 4y agoSyncs instantly between them You can optionally filter by the current window session, current machine, or commands across all machines you have atuin installed on
- wodenokoto 4y agoI believe it’s a setting. You can choose to save history and either merge history on session exit or immediately. At least it is a setting for zsh
- conradludgate 4y agoWith atuin, it's available immediately on other local session (panes, windows, tabs etc). There's also remote sync, so after some configurable amount of time, it's even available on other devices.
- ellieh 4y ago+ if you don’t like this, you can have it filter by session by default!
- kazinator 4y ago> Atuin replaces your existing shell history with a SQLite database How can that work. Nobody is going to pay any ransom for just a shell history, and there are ways to get it out of a SQLite database. Wouldn't it be simpler just to encrypt the original .bash_history?
- atoav 4y agoI think the advantage of the sqlite database is that you retain more context for any given command (e.g. what the current working directory was, ...) in a structured way (it is a database after all). That stored context can then be used to query the database (e.g. filter the history to only show commands that were executed in the cwd). These queries are the point of using sqlite, not anything security as far as I can tell.
- kazinator 4y agoI just don't see how sqlite is up to this; the problem clearly requires PostgreSQL.
- lost_tourist 4y agosqlite is fine for this usage.
- deleted 4y ago[deleted]
- atoav 4y agoNo you know what it requires? A 100 person company with 20 microservices and a ceph cluster. /s I am not sure how many writes per second you have on your shell history, but sqlite is not only up to the task, everything else is overkill. Additionally not having to run a database, but having your history in a file has advantages for that usecase as well.
- bayesianbot 4y agoI made a script that uses atuin to get previous commands related to your current command line - latest commands ran in the same session, in the same directory, in other sessions, latest commands for the same executable etc. then feeds it into GPT and streams the replies to fzf so you can choose the best autocompletion (or it can fix problems in the line you've written already as well). On Wezterm and Kitty it can also get the terminal screen contents error messages and so. Because of the streaming reply the first autocomplete line is ready quite soon after the keyboard shortcut is pressed. Have been putting off pushing it to Github, think I'm gonna do that today.
- mkurz 4y agoPlease link, thanks!
- conradludgate 4y agoThat sounds awesome! We've been meaning to set up a "community showcase" section. I'd love to feature this! If you ever publish it, post a discussion!
- bayesianbot 4y agoThanks! I'll do that after I've had more time to finish some features and clean the code up in few days. But I've released a crude version at https://github.com/TIAcode/LLMShellAutoComplete https://github.com/TIAcode/LLMShellAutoComplete
- literalAardvark 4y agoThat sounds awesome, if somewhat overengineered. Though the idea of mistakenly putting credentials in the cli and it ending up in GPT is bothering me a bit.
- doubled112 4y agoProbably paranoia, but I’d be uncomfortable feeding it a bunch of domain and server names, along with any other more interesting params that might sneak in.
- mrAssHat 4y agoNo one ever addresses the most important problem: how to separate commands that one would like to retain (preferably indefinitely) vs garbage commands (like cd, ls, cat, etc.) that should better be wiped in a few days.
- conradludgate 4y agoDuring search, we do remove duplicates. It's not a bad idea though and I'll see how we can support it
- mathfailure 4y agoThis is also sub-optimal, as it causes another problem: some of the commands are part of a bigger sequence (the most import property here is that items inside sequences are ordered, the order of commands matters!), so by blindly deleting duplicates - you break sequences. In SQL there are sessions and transactions. In shell history - we don't have such entities and this sucks. One could configure their bash/zsh to save history into separate files, but you can't teach them later to source them properly (retaining session awareness).
- conradludgate 4y agoOh, we don't actually delete anything - just deduplicate for search. Sequential context is something we're building very soon. The idea: you search for "cd /project/dir", press TAB and it opens up a new pane in the tui. This will show the command +/- 10 commands. You can then navigate back in time. This could indeed be useful for managing that one setup command you always have to run in this project dir but never remember the name of
- mathfailure 4y ago> Oh, we don't actually delete anything - just deduplicate for search. Good to hear, but the point stands: so you deduplicate only for the view, not in the source, and thus the source remains contaminated with duplicates (at very least they cost some disk space and increase seek time). As for the view: so, since you deduplicate the commands - you can't lookup the context (commands executed before & after)! Because each time the now deduplicated command was executed in the past - it had its own context!
- iib 4y agoHas anybody seen any huge performance regressions using atuin? I installed it and simple commands take noticeably longer. Is there any way to make it faster?
- conradludgate 4y agoWe've heard some users using hard drives or networked FS and having performance issues. sqlite relies on mmap and random access of pages, which can suffer on higher latency drives
- ThouYS 4y agoeither I'm getting old, or there is a lot of energy being spent on quasi-useless "improvements" these days
- conradludgate 4y agoIt's always fair to be critical of these things. However the energy we spend on this is our concern. At the end of the day, Ellie and I work on this because these features actually improve our workflows. The directory search feature is probably my favourite, and the sync feature is the key feature Ellie wanted to begin with.
- grammarxcore 4y agoHave you considered that you might not be the target audience? Atuin’s ability to sync across computers while being able to separate the context the command was used in has been incredibly useful to my team.
- alehlopeh 4y agoYou must be getting old because you're unable to see the irony in spending the time and energy to make a comment decrying the quasi-usefulness of how others choose to spend their energy.
- makeitdouble 4y agoOn the getting old part, there's definitely a point where someone has enough bagage thay most additional tools are solving a problem they already worked around or solved a different way. For someone new to the field, this tool is on the same footing as the rest and could fit them better. As an aside, the part I like the most about our field is the ability for a single or two devs to build themselves the tools they exactly need, and potentially share it to the community with low friction.
- datadeft 4y ago> being spent on quasi-useless "improvements" i am not a new kid on the block either but I was looking for such a tool for a very long time. I think distributed shell history across all of my servers is a big win.
- IshKebab 4y agoThere's also McFly which does the same thing. https://github.com/cantino/mcfly https://github.com/cantino/mcfly I've only used McFly and found it to be pretty great. My only complaint is the default search mode is SQL strings, so you have to use `%` for wildcards. I wish it was a more forgiving, less exact search. Has anyone used both and could compare them?
- netherwolfe 4y agoI want this logo on a sticker.
- conradludgate 4y agoWe do have some stickers available! https://notionforms.io/forms/user-stickers https://notionforms.io/forms/user-stickers
- inconceivable 4y agocool tool. i think improvement in this area for non-shell-specific solutions is always good. one thing i haven't seen yet (correct me if i'm wrong...) is an easy way to get all this stuff to magically appear on a new machine you've ssh'd into for the first time. i've hacked up my own in the past but that's got issues with tunneling and multi-hops. anyone know a solution to this? maybe a feature request?
- ellieh 4y agoNot 100% sure how that could work, but definitely very interested in making it happen! I don’t think there’s an issue for it yet, so feel free to open
- outcoldman 4y agoI have been using sqlite database since 2017 [1], has over 100,000 items in the database at this point. The database is almost 0.5GB, but I also use Full-Text-Search capabilities of sqlite. 2 years ago I have built a mac application [2], that syncs items via iCloud, and it only works on the macOS. I would highly recommend anyone who spend a lot of time in terminal to improve their shell history by using atuin or similar tools, cannot tell how many times it actually helped me to find some important information there, about how I did one thing or another. - - [1] https://www.outcoldman.com/en/archive/2017/07/19/dbhist/ https://www.outcoldman.com/en/archive/2017/07/19/dbhist/ - [2] https://loshadki.app/shellhistory/ https://loshadki.app/shellhistory/
- jefftk 4y agoAt 0.5GB that's 5k per entry -- what are you storing for each? For comparison, my (non-work) history since 2012 (plain text) is 181k entries, and takes 25MB. I store the command along with when and where you ran it. (https://www.jefftk.com/p/logging-shell-history-in-zsh https://www.jefftk.com/p/logging-shell-history-in-zsh)
- tomxor 4y agoNot defending the idea of a db history but no db schema is going to beat plain text's 1 byte 0x0A per line delimiter.
- justinclift 4y ago*cough* compressed row data *cough*
- tomxor 4y ago*cough* log rotate and gzip *cough* :D
- justinclift 4y agoTouché. :)
- Dowwie 4y agoI found atuin introduced friction where there wasn't any before, so I stopped using it and reverted to ripgrepping zsh_history.
- conradludgate 4y agoDo you remember what that friction point was?
- jyxent 4y agoI'm not the parent commenter, but the friction point for me is the slowness when typing the first few characters in an interactive search (I have a large history). I think the searches are synchronous with each keystroke, right? It would feel a lot faster if each keystroke could cancel an in progress search instead of waiting for it to finish. In fzf, there is no noticeable lag when typing.
- Dowwie 4y agoThere is a noticeable delay experienced from when I press the up arrow and the list appears. This was the largest friction point. Then, once the list appears, it needs to be filtered to reach a desired pattern. Narrowing down the selection and experiencing real-time shifting in results distracts from the goal of history finding. I found these hurdles lead the results that still were not as accurate as simply ripgrepping against zsh_history.
- vrglvrglvrgl 4y ago[dead]
- trurl 4y agoExcellent! I had been thinking of building something along the same lines when I switched from `zsh` to `fish`, as I had been missing `zsh_stats`. Now I don't have to and can focus on my other side project!
- oftenwrong 4y agoI have been using this, which is similar, for a few years: https://github.com/larkery/zsh-histdb https://github.com/larkery/zsh-histdb
- submeta 4y agoAre there ways to migrate existing shell histories with timestamps into atuin?
- shawabawa3 4y agoyep they have docs on importing https://atuin.sh/docs/commands/import https://atuin.sh/docs/commands/import
- ellieh 4y agoYep! We support a whole bunch more too (fish, resh, zsh-histdb, etc), need to update the docs
- klibertp 4y agohttps://github.com/ellie/atuin/blob/main/atuin-client/src/import/zsh.rs#L68 https://github.com/ellie/atuin/blob/main/atuin-client/src/im... > // we can skip past things like invalid utf8 No, you can't! Thanks to some bizarre escaping that happens when ZSH (and BASH, I think) dumps commands to the history file, any command with non-latin1 characters will break here and won't be read, moreover - silently! The other possibility is that you'll import wrong characters. Grep the ZSH source for "unmetafy", you'll see; I have it extracted here: https://github.com/piotrklibert/zsh-merge-hist/blob/master/unmetafy/unmetafy.c https://github.com/piotrklibert/zsh-merge-hist/blob/master/u...
- sureglymop 4y agoThe problem I see is that if I ssh into 5 different remote hosts in a day, most of the commands are not executed on my host and thus not part of the local (or shared, distributed) history. I suppose this could be solved with either: - Some kind of modified ssh that sends back the commands to my host - Some kind of smart terminal that can analyze commands to build up the history Any ideas on how to practically solve this problem?
- mrelectric 4y agoEvery terminal has text input, but keylogger might be the simplest solution.
- kevin_thibedeau 4y agoA keylogger doesn't see the results of tab completion.
- shawabawa3 4y agoYou could install atuin on all your remote hosts, but that's not always practical
- doubled112 4y agoI guess we need a PostgreSQL backend.
- elendee 4y agosame concern. I will probably use atuin local because it seems so cool. but the beauty of the shell is that it is by default so universal and portable and small, so I don't like the idea of dependencies for my use of it on remote machines. mentally I've gotten used to the idea that my local shell env is a very different beast than "normal " shell.
- tus666 4y ago> English | 简体中文 > You may use either the server I host Right. And isn't this what home dirs are for?
- ellieh 4y agoYeah you could totally sync your shell history if you’re using a NFS share or something, but that’s going to affect way more than just your .bash_history Why is our localisation relevant/quoted?
- shawabawa3 4y agoI think the implication is that you're controlled by the Chinese government because your software was translated to Chinese?
- conradludgate 4y agoWell, all the client side code is open source and compilable, and all history is fully encrypted before being uploaded. So even if we were being controlled, you still can be confident that we can't do anything with your data - all we can see is how active you are, that is until someone finds a way to quickly break xsalsa20poly1305.
- submeta 4y agoIs there a way to highlight matches? Also, does someone know how to change the date format to full? Instead of „5 days ago“. Finally, an observation: I cannot use my Emacs keybindings to kill the line or a word (backwards), when I am in search.
- notresidenter 4y agoI stopped using Atuin because you need one additional click to go up the history, and the configuration didn't provide an easy way to change that behavior. Edit: apparently, they made it possible to disable that behavior and the documentation is much better
- shawabawa3 4y agoI use atuin to replace cmd+r history but not up arrow history, wasn't hard at all to configure
- maleldil 4y agoIt looks like it's not possible to export the history to a format the shell can import[0], so if I wanted to try this out, my commands would be locked there. It looks interesting, so if I'm overlooking a way to do this with fish, I'd experiment with it. [0]: https://github.com/ellie/atuin/issues/816 https://github.com/ellie/atuin/issues/816
- codetrotter 4y agoIf you just want to experiement with it for say a couple of weeks, does it really matter that the commands from those few weeks disappear if you decide not to continue using it? Presumably you already have a long history of commands from past years in the original format. And if your command line usage is similar to mine, then most of the commands you will use in the future will be covered by your existing history. So if a few weeks of experimenting with atuin ends with you deciding not to use atuin, then probably you will be fine going back to the old history files that do not include those weeks of activity.
- jamespwilliams 4y agoIt’d be pretty trivial to do this yourself though, shell history files are very simple
- getpost 4y agoYou can use sqlite[0] to export the database, or if you want a ui, use datasette[1]. On my mac, the database is stored at ~/.local/share/atuin/history.db [0] https://sqlite.org/cli.html#export_to_csv https://sqlite.org/cli.html#export_to_csv [1] https://docs.datasette.io/en/stable/csv_export.html https://docs.datasette.io/en/stable/csv_export.html
- ellieh 4y agoWe’d like to be able to also export history, but atuin doesn’t actually stop your old shell history from functioning either So you could uninstall it, and you won’t have lost a thing
- maleldil 4y ago
- agumonkey 4y agoI always wondered if one could feed history into some abstract parser (or nowadays, maybe a LLM) to extract the most frequent "idioms": ls <dir> | grep <pat> | less vs ls ~ | grep .bak | less ls .config | grep *rc | less you get the idea
- elendee 4y agothis might be a way to improve the default nix toolset in a way worth globalizing, it seems like it has the same philosophy. Discovering missing tools... it's like discovering new primes :)
- electromech 4y agoIt sounds like it might not work as well for bash. https://github.com/ellie/atuin/issues/909 https://github.com/ellie/atuin/issues/909
- jamesgill 4y agoI like it, if for no other reason than the Terry Pratchett reference.
- swyx 4y agothe turtle moves!
- tonymet 4y agoGreat idea I’d like to see more full text indexing of the home directory. Shell commands, configs, code files all deserve to be indexed. Compared to Windows & MacOS – lack of cli and gui full text indexing is a real setback for linux/unix apropos , locatedb and this are solid domain-specific attempts. Hopefully this expands to indexing a lot more content.
- jbellis 4y agoFor people who have tried this, how good is the latency from when I press ctrl-r [first letter] to when I start seeing results? If it's not instant it's just going to frustrate me.
- conradludgate 4y agoI notice 0 latency (except when using the opt-in skim feature - we haven't properly optimised that yet). Latency is very important for us too. Granted, if you don't use an SSD, then you might encounter some startup lag
- quaintdev 4y agoMaybe ctrl+r stress uses history command.
- zomglings 4y agoFirst of all, great name. Second, I am in awe of how good your documentation is and how well you communicate about atuin to the world at large. Does Atuin offer any features to toggle the capture of commands into its DB? Being able to opt-in or opt-out of Atuin history on a per-command basis would be pretty useful, especially because there is also the atuin sync feature. I usually work with sensitive information inside a tmux session because, in the default bash configuration, most commands run in tmux never make it into bash history (I believe the last pane to exit is the only one that does make it). It seems I would have to manually go in and drop rows from the DB if I set up Atuin. One of my products, bugout, has a command called "bugout trap". Not trying to push bugout here, but thought Atuin might benefit from some of the lessons we learned: 1. Because bugout trap is opt-in (you have to explicitly prefix your command with "bugout trap --", it also allows users to specify tags to make classifying commands easy. This is really useful for search - e.g. you can use queries like "!#exit:0 #db #migration #prod" to find all unsuccessful database migrations you attempted in your production environment. 2. bugout trap has a --env flag which gives users the option of pushing their environment variables into their history. This is really useful for programs that use a lot of environment variables. The safest way to use this is to first trap commands into your personal knowledge base with --env, then remove or redact any sensitive information, and only then share (in case you want to share with a team). 3. We thought that sharing would be useful for teams to build documentation on top of. Even we ourselves have very little adoption of that use case internally. We use it to keep a record of programs we run in our production environment (especially database migrations). 4. bugout trap also stores data that a program returns from stdout and stderr - this has been INCREDIBLY useful. I do want to add a mode that makes the capture of output optional, though, as currently bugout trap is unusable with things like server start commands which run continuously. 5. In general, I have found that command line history is very personal and private for developers so collaborative features are going to rightly be seen with skepticism. Hope that helps anyone building similar tools. $ bugout trap --help Wraps a command, waits for it to complete, and then adds the result to a Bugout journal. Specify the wrapped command using "--" followed by the command: bugout trap [flags] -- <command> Usage: bugout trap [flags] Flags: -e, --env Set this flag to dump the values of your current environment variables -h, --help help for trap -j, --journal string ID of journal --tags strings Tags to apply to the new entry (as a comma-separated list of strings) -T, --title string Title of new entry -t, --token string Bugout access token to use for the request
- deleted 4y ago[deleted]
- whitepaint 4y agoHow can I import my previous history into atuin?
- ellieh 4y agoYou can use “atuin import” The docs need updating as we support far more data sources now! https://atuin.sh/docs/commands/import https://atuin.sh/docs/commands/import
- adg33 4y agoI'm interested in this - I've just installed. Is there a way to import all my existing history from `.zsh_history`? It's a real pain to have to start from scratch.
- pmarreck 4y agoHow does this compare to McFly? https://github.com/cantino/mcfly https://github.com/cantino/mcfly
- datadeft 4y agoI see two major differences: - how active the development is[1] - having a distributed option (McFly does not have one) 1. Seeking co-maintainers: I don't have much time to maintain this project these days. If someone would like to jump in and become a co-maintainer, it would be appreciated!
- pmarreck 4y agoAre you the dev of mcfly or atuin? (I keep wanting to call it Alduin. Gamer here.)
- scotty79 4y agoAt this point databases and filesystems should just merge to offer complete functionality as a standard.
- bradleybuda 4y agohttps://en.wikipedia.org/wiki/WinFS https://en.wikipedia.org/wiki/WinFS
- scotty79 4y agoProbably came too early.
- didip 4y agoI always wondered why Linux devs didn’t embrace SQLite wholesale for every single tools. Except maybe the kernel because I don’t know anything about the kernel.
- v3ss0n 4y agoThis one is much more simple and to the point , without needing sqlite. https://github.com/curusarn/resh https://github.com/curusarn/resh
- cjbprime 4y agoSince we're setting up a database, has anyone seen a project to store stdout/stderr in tables too? Seems more useful in the GPT age, when it could provide an opportunity for conversations about the whole task you worked on. (As well as finding commands based on their output.)
- chmaynard 4y agoI decided to implement this using bash. I have a working prototype running on one machine. If anyone wants to help me refine it, let me know and I'll post what I've done on GitHub.
- freeCandy 4y agoPlease do post. I'd love to have a smaller bash alternative to this tool.
- chmaynard 4y ago- Save a copy of your current .bash_history file. You can import its contents into the sqlite "commands" table later. - Add both files in this gist to $BASH_HOME. https://gist.github.com/chmaynard/dbcaed11534dc54bdc90856d1885b983 https://gist.github.com/chmaynard/dbcaed11534dc54bdc90856d18... - Install .bash-preexec.sh in $HOME (see https://github.com/rcaloras/bash-preexec https://github.com/rcaloras/bash-preexec). - Append this command to your shell startup file (e.g. $BASH_HOME/.bashrc): source $BASH_HOME/bash_history.sh - Open a new bash window. You should see the message "bash-preexec is loaded." Enjoy! Please share your feedback in the gist comments section. (Memo to self: Package this up in a repo with a proper README.)
- Waterluvian 4y agoI have a problem where my shell history seems to be… inconsistent or different if I have multiple terminal tabs open. Is there a way to say, “I don’t care about which terminal a command is written to, just log them all chronologically in the same file”? Would this SQLite approach work that way?
- nidnogg 4y agoIs there a Windows/Powershell port coming anytime soon? Honestly this is the one tool missing from my macOS workflow that I can't cross plat yet.
- conradludgate 4y agoI think it actually works on Windows/powershell for now. We can't guarantee it because we can't test it, but we have a windows user who is always submitting fixes for windows
- nidnogg 4y agoI tried it out and I couldn't really figure a way to `atuin init` on Powershell, as it requires one of the supported shells as a parameter. I've also seen a couple of PRs such as [1] that consider Windows support a dead-end as of 2021, so I assumed it to be a dead-end as well. Maybe this user is on WSL? That'd seemingly work as it can get bash/zsh or anything running there. [1] https://github.com/ellie/atuin/issues/135 https://github.com/ellie/atuin/issues/135
- darkteflon 4y agoThis is so, so good. Can't believe I hadn't heard of it. Got the same instant "Eureka!" moment I did with ripgrep, fzf and z.
- earthboundkid 4y agoWhy would you want syncing? Different machines have different file layouts and different installed executables. Any common commands are either coincidental or part of some fleet operation better managed through an actual remote management system.
- haileys 4y agoWell, my laptop and my desktop are set up pretty similarly to each other. Syncing is useful for me :shrug:
- conradludgate 4y agoI'm a software engineer, not a sysadmin. My use of the shell is to run my software and git, not setup systems. YMMV
- rektide 4y agoIf this can help with history across many shell instances that would be so great. I've never figured out what to expect, what happens when you have multiple zsh windows across many session, what to expect for how I can navigate that or those histories well. Random side point, it frustrates me so much I cant get the pre-substitution command taht I actually type, at least in zsh. I really want to see the history of what I type! Not just what the outcome was, but learn & adjust with what I type. A while back I hacked around writing vim commands that would run my current line (or selection) in a terminal, and then copy the command, paste it after the current line, & go to the next line (and another command to do the same but not re-copy the output). That let me better see the work I had done, and I really liked that, but it was a pretty drastic hack born of desperation. Shell histories! Yay! Anyone have other good tools they use?