12 ms·
Atuin – Magical shell history
- veganjay 3y agoPrevious announcement by the author: https://news.ycombinator.com/item?id=35839470 https://news.ycombinator.com/item?id=35839470
- wswope 3y agoAtuin has been the absolute best CLI tool I’ve found in years. I use it every single day that I’m at a computer. It's very easy to learn (2 or 3 essential hotkeys), and makes finding old shell commands a breeze. I was able to self-host the sync server in well under an hour, start to finish. (@ellie - if you see this thread, thanks for all the elbow grease you put in! You’ve built something really special.)
- mac-attack 3y agoAny links in the self-hosting options? I had some saved but lost them.
- Astraco 3y agohttps://docs.atuin.sh/self-hosting/server-setup/ https://docs.atuin.sh/self-hosting/server-setup/
- dphuang2 3y agoRecently installed Atuin and found it to be overall net positive. A couple of habitual keystroke combos had to be reprogrammed from my brain but the persistence of shell history + better searching is pretty awesome. Also the stats are a neat add-on. Overall would recommend to almost any developer.
- magospietato 3y agoReally impressed with the self-host setup. I've found these are usually a bit of an afterthought, involving a bunch of service dependencies and an arcane config process. Postgres 14 and a few tweaks to a TOML file and you're running. Not wild about the password-only Postgres connection though.
- e12e 3y ago> Not wild about the password-only Postgres connection though. >> A valid PostgreSQL URI, for saving history (default: false) Looks like you are free to specify socket or ssl if you prefer? I was recently shocked to learn that the postgres standard "sslmode=require" only check host name vs cert - not if the cert is trusted (ie meaningless). https://www.postgresql.org/docs/current/libpq-ssl.html#LIBQ-SSL-CERTIFICATES https://www.postgresql.org/docs/current/libpq-ssl.html#LIBQ-...
- kstrauser 3y agoWhy is this better than a shell's built-in history, possibly paired with fzf? I'm not asking sarcastically, either. Is this something awesome I should be using? What about it is going to blow my mind?
- probotect0r 3y agoThe features listed on the site already tell you what it has that regular shell history + fzf doesn't have. You can decide if that makes it better.
- kstrauser 3y agoAll that jumps out to me from that page is sync, which is nice, but not life-changing. I guess I’m looking for more of a personal experience anecdote, where someone could explain how its other features made it worth signing up for another sync service and learning a new thing. It may be the best thing since sliced bread but that page doesn’t say why I should try it.
- joh6nn 3y ago- all the data is stored in a sqlite db, so it's actually structured, as opposed to just being in an adhoc text format - this matters because it's capturing not just what commands were run, but metadata about the commands as well. Of particular interest to me is that ot captures the start and end time for every history entry so you can get timing data even if you forget to use `time` - it provides much more fine-grained control over what makes it into the database than shells provide for controlling what makes it into their built-in history. For example, it has built-in support for filtering out common kinds of secrets/tokens/etc. It's also in active development with a friendly and helpful creator/project lead, an active community, and an ever growing feature set. I'd recommend giving it a try; as far as I'm concerned, it's best-in-class for managing shell history
- alchemist1e9 3y ago> Of particular interest to me is that ot captures the start and end time for every history entry so you can get timing data even if you forget to use `time` That’s potentially an incredible useful feature to integrate with all that metadata! Very very interesting.
- Hugsun 3y agoI just started using this tool locally and it's pretty nice. The default UI doesn't highlight the matching substring like fzf does which isn't as nice.
- jeppesen-io 3y agoI switched a year or two ago It wasn't until I switched that I realized how poor bash and zsh are in comparison, even with fzf 10 min install, never looked back Not to mention the safety. Never could figure it out, but once every 15 months or so, zsh would disappear my history. Certainly a mistake on my end, but still too easy to blow away history
- zimbu668 3y agoI would occasionally manage to start a bash shell without executing my profile, which means HISTFILESIZE is not set and bash would truncate my history on the first command I ran. zsh history may have a similar problem.
- eviks 3y agoYes, bad defaults strike again!
- meribold 3y agoI think that's it! I've been wondering why Bash sometimes deletes most of my history for ages. My .bashrc sets up an EXIT trap that git-commits my history, so I just looked at the commits that remove lines and found that 7 out of 8 of those commits change the size of the history file to about 1000 lines. Since my history file contains timestamps, that matches the 500-command default of HISTSIZE, so the truncation mechanism you described seems to be what's happening. A few days ago I actually made my history file append-only to prevent truncation.
- meribold 3y agoSetting HISTFILE to a non-default value in the same place as HISTSIZE/HISTFILESIZE seems like it would solve this problem nicely.
- joobus 3y agoThis is exactly why I'm considering using atuin also. My zsh history on my mac will sometimes just completely disappear and then I have to go lookup what I was trying to do again. It is driving me crazy.
- tnorthcutt 3y agoAtuin is simply fantastic. Ellie keeps adding interesting new features. Just an all around fantastically useful tool. Bravo.
- jauntywundrkind 3y agoPlease oh please, can someone hack a way to get shell history expansion!? The most objectionable thing about shell history to me is that it's not what I typed! Mainly a zsh user & I've looked up & down & all around, but I cannot find a way to keep track of what I actually typed, versus what got ran! I really want to better be able to identify patterns, look at what I was typing. Show me !-1$, the last word of the last command! I need this to learn & improve my expansion capabilities better. I need this to see how my history evolved, to backtrack & see where else any given line was pointing at. Shell history feels devoid of the most important context I craft; I summon birds from hats and my shell history just says: there was a bird here. Hiss boo.
- mirashii 3y agoI mostly really like atuin, but it has been causing some random other breakage in my shell that has me on the verge of replacing it with something simpler. A quick search comes up with https://github.com/atuinsh/atuin/issues/1696 https://github.com/atuinsh/atuin/issues/1696 , which indicates I'm not alone.
- airstrike 3y agoThat bug report is 12 days old...
- arcanemachiner 3y agoAnd some bug reports are 20 years old. A broken workflow is a broken workflow.
- airstrike 3y agoI mean, that literally does not logically follow. Yes, some bug reports are 20 years old. My point is precisely that this one hasn't become a 20-year-old bug and the way the parent comment read made it sound like it's a glaring, long-lasting issue when it's not. "A broken workflow is a broken workflow" is just a tautology. I guess you're implying "any kind of broken workflow is bad" but yeah, I don't agree with that especially with regards to free tools. The project literally has weekly commits, devs are open and engaged and... patches are welcome
- mirashii 3y agoI mean, it is a glaring issue for me, but often it causes the most frustration in another task, so I didn’t personally report it much sooner, but it has been broken for a while.
- mirashii 3y ago> "A broken workflow is a broken workflow" is just a tautology. I guess you're implying "any kind of broken workflow is bad" but yeah, I don't agree with that especially with regards to free tools. The project literally has weekly commits, devs are open and engaged and... patches are welcome I just wanted to respond to this a bit more. My moving away from a project is my choice. Just because it has active devs and regular commits doesn’t mean that I’m in any way obligated to continue to use it, or contribute to it. It doesn’t fit my workflow, and the issues are longstanding and glaring. Might they be fixed in the future? Sure. Am I interested in sending patches in or tracking that effort? Actually it really doesn’t even matter, a broken workflow is a broken workflow, even when the tool is free. It doesn’t work for me as is and I will find something else if I want. This seems to be some sort of defensive response as if I was attacking the project. On the contrary, and like I said before, I generally like it, but the issues I have, which are to be both glaring and longstanding, means that it doesn’t fit my workflow and I’m considering moving. Not all tools need to suit everyone’s workflows, and “patches are welcome” is very beside the point.
- hiddencost 3y agoA'tuin the world turtle, from disc world: https://discworld.fandom.com/wiki/Great_A%27Tuin https://discworld.fandom.com/wiki/Great_A%27Tuin
- berkes 3y agoI love how it looks and I love some of the fancy features. But above all, it's a solution to two real problems I had. I work in several terminals. Sometimes tabs or Windows in my emulator, sometimes screen or tmux. And all those sessions would overwrite eachothers history. I lost many actual important history entries that way. And I (almost) ran many wrong commands, expecting another one to be my last entry. Arrow-up enter. Woops. Atuin solved this. I had my history as large as possible. Ctrl-r is my friend to search for "that old thing I did to pgsql piping something from zcat a year ago". But it's ever slower, zsh and bash history clearly not designed to handle (tens of) thousands of entries. Atuin solved this.
- gitinit 3y agoAgreed! This is my exact use case for Atuin and it works great, except it replaces the default, minimal control-r interface.
- n8henrie 3y agoInteresting -- I have histappend (? I think) enabled and no problems with 20+ simultaneous tmux panes + tabs. Just checked yesterday* and have well over 100k lines in bash history and it loads / searches instantly in skim. * Was trying to check out mcfly vs atuin for the third time and again didn't understand why the extra complexity was worthwhile.
- tupolef 3y ago- For your 1st issue, you can setup bash to append commands rather than overwrite them. Here the part of my .bashrc about history: # append rather than overwrite shopt -s histappend # attempts to save all lines of a multiple-line command in the same history entry shopt -s cmdhist # with cmdhist, saved with embedded newlines rather than semicolon separators shopt -s lithist HISTCONTROL=ignoreboth HISTSIZE=10000 HISTFILESIZE=20000 HISTTIMEFORMAT="%y/%m/%d %T " HISTIGNORE="history:ls:l:pwd:exit:" if [[ ${BASH_VERSION:0:1} -gt 5 || ${BASH_VERSION:0:1} -ge 5 && ${BASH_VERSION:2:1} -ge 1 ]]; then PROMPT_COMMAND=("history -a" "history -c" "history -r") else PROMPT_COMMAND="history -a; history -c; history -r" fi - And about the 2nd issue, you should use fzf or skim (probably faster) to replace the ctrl-r binding. fzf includes such a script that you just need to call from .bashrc. # Enable key bindings for fzf if command -v fzf 1> /dev/null && [[ -f "/usr/share/doc/fzf/examples/key-bindings.bash" ]]; then source /usr/share/doc/fzf/examples/key-bindings.bash fi
- chanbam 3y agojust commenting for my discworld homies
- viksit 3y agoi came here for this
- renewiltord 3y agoI used to have histdb set up really well with r-i-search etc. but recently I can't get it to really do that any more. It's a pity. Does anyone have a histdb + fzf r-i-search solution that works well for them?
- givemeethekeys 3y agoAnyone try this and fish shell? How do they compare? Thanks!
- Starlevel004 3y agoI use it with Fish. It's basically a nice UI around doing history | rg pipes.
- metadaemon 3y agoAgreed, I use this in conjunction with Starship [1], both initialized specifically for Fish in the config. I love this shell so much. [1] - https://starship.rs/ https://starship.rs/
- spindle 3y agoI've tried it with fish and found that, for me, it didn't add much and wasn't worth the switch, but it is arguably slightly better than fish's built-in history; so I'd say only bother if you particularly love learning new things of this type.
- Arcuru 3y agoThe only downside is that fish has no way to allow atuin to override the autosuggestions as you type. We can get that in zsh but fish doesn't expose that.
- theshrike79 3y agoFish + Atuin (with up arrow disabled) + Starship is what I use on every platform I can
- jes 3y agoLooks neat and I'd like to try it. I wonder how well it would work from within a GNU Emacs shell buffer (comint based, I think) running bash. Has anyone given this a shot?
- theshrike79 3y agoBash in general is problematic for Atuin, since it plugs into the prompt and Bash prompt is a bit crap =) But it should still work
- Jakesbenn 3y ago[flagged]
- eigenvalue 3y agoI've been using this for a couple months after using McFly in zsh for over a year. I think I can say that I like it better, but the only thing I sometimes don't like is how it completely takes over your screen when you press the up arrow. I usually just want to get the previous command I entered instead of the whole searchable history (which I use Control-R to bring up), and it's really jarring to have the entire screen change. Aside from that, it's really awesome to have everything synced across a bunch of machines.
- jiehong 3y agoSame here, but you can disable that behaviour, and then it’s nicer [0]. I also find that I prefer the default Ctrl-R to start with history from the current directory instead of the global history, but that is also changeable. So I’m pretty happy. [0]: https://docs.atuin.sh/configuration/key-binding/#disable-up-arrow https://docs.atuin.sh/configuration/key-binding/#disable-up-...
- eigenvalue 3y agoAwesome, thanks for the tip, I’ll try that.
- Arcuru 3y agoIf you're comfortable with shell scripting, you can get that today. There's code for a number of shells in this issue https://github.com/atuinsh/atuin/issues/798 https://github.com/atuinsh/atuin/issues/798 Adding it to Atuin will take a bit of work to keep it from being too brittle, so it hasn't yet been done.
- mwpmaybe 3y agoYou can adjust the size of the "window". I have my inline_height set to 20 and it's a bit less jarring when it pops up.
- theshrike79 3y agoThis is why I have atuin init fish --disable-up-arrow | source in my fish.config. C-r with Atuin is great. It taking up the whole screen when I want to run the previous command again? Not grat.
- metadaemon 3y agoUsed as a daily driver for a couple years now. Love it!!
- javrin 3y agoBeen using atuin for a couple months now on Windows in bash. Its a very nice tool however I've been experiencing a huge lag sometimes after typing just one character. Intuition says there could be the database performance is lacking or Im missing some configuration. Anyone else experiencing something similar?
- from-nibly 3y agoCould be a disk Io issue. I know git used to use a nieve approach on windows and it make git incredibly slow. Something you wouldn't notice just using git but when you made it part of your prompt it would lag for a good second and a half just pressing enter.
- vladvasiliu 3y agoYup, I'm getting this sometimes on Linux. There's been a recent update (not sure which version, I don't have my Linux box on hand to check) where it now started logging some timeout waiting for a lock on the database. I don't type commands in multiple shells at the same time, so not sure what's locking the db. I also don't use remote sync (explicitly disabled in the config).
- happens 3y agoAre you on ZFS by any chance? There's a bug with SQLite which can lock the thread for a few seconds, I had the same problem. Here's the issue I created, with several workarounds included. My current workaround is to have a separate dataset without sync for the atuin directory. https://github.com/atuinsh/atuin/issues/952 https://github.com/atuinsh/atuin/issues/952
- hiAndrewQuinn 3y agoAtuin is great! Considering including it in my little stack of scripts to turn a new Ubuntu VM into a capable devbox from scratch [1]. We currently install `fzf` with the proper keybindings, so Ctrl-R is already quite nice. But we also already include one interactive "pick your $EDITOR" moment - there's no reason we couldn't provide a "pick your $HISTORIAN" with atuin vs fzf as well. It would be fun and might turn people onto new tools, which is a big aim of this project. [1]: https://github.com/hiAndrewQuinn/shell-bling-ubuntu https://github.com/hiAndrewQuinn/shell-bling-ubuntu
- eviks 3y agoCan it do the magic of deduplication, cleaning failed commands with typos so your history isn't cluttered, and use frecency for autocompletions?
- Ringz 3y agoDeduplication as an option or shortcut would be nice. But I think Atuin should and maybe must save all commands in the database.
- eviks 3y agoWhy should it store garbage in the database?
- Ringz 3y agoWhy do you enter garbage in the terminal? But seriously from the next answer: „ The reason it saves every command is so that it can produce statistics, for example exit code distribution and runs per day etc“
- eviks 3y agoBecause I'm a human and err??? And what value do GIGO statistics have? The next answer doesn't defend you weird take that it must store garbage, that's still on you
- eproxus 3y agoIt does de-duplicate. It saves every command (even duplicates), but as soon as you search it only ever shows the last version you ran. The reason it saves every command is so that it can produce statistics, for example exit code distribution and runs per day etc.
- eviks 3y agoOh, the screencast had dupe lvim at 10s and then there are issues like this https://github.com/atuinsh/atuin/issues/409 https://github.com/atuinsh/atuin/issues/409. The runs/code can be stored as list to get the distribution, though for typo I don't want any distribution, I just want them gone, and for identical commands with different comments I'd want a single run stat These are the cleaning type of things that would be closer to magical
- v3ss0n 3y agoResh is a lot faster and lightweight. https://github.com/curusarn/resh https://github.com/curusarn/resh
- Razengan 3y ago+1 for the name
- heavyset_go 3y agoIn the docs it says: Atuin works best in bash when using ble.sh. However, whenever I try to use it with ble.sh, it doesn't bind to the up key like it does with plain Bash.
- deleted 3y ago[deleted]
- deng 3y agoThe page claims this is "trusted by engineers" at Google, MS, Apple, Amazon, you name it. Could maybe some engineer at these companies enlighten me how you could convince your security team that it is fine that all your shell commands are streamed to an outside server? Yes, I know it's E2E, but still, without a proper audit, my security department here would laugh me out of the room if I'd ask for this. Do you all self-host the server in-house? If so, did you do a code review of the server code?
- cschmatzler 3y agoThe server is optional and opt-in, stuff is saved to a local SQLite database by default.
- deng 3y agoIn "What you get with Atuin" the first(!) point is "Sync your shell history to all of your machines, wherever they are". That obviously cannot work with a local SQLite. Without syncing, this is a better ctrl+r, which I won't disagree is nice, but not the real point of this software. If the page says this is "trusted" by pretty much all major software companies, I would assume this includes syncing, which is the main feature. Also, even the possibility that the software would send this to the outside would make this impossible to use at my company, and I don't think we are overly strict in that sense here.
- sealeck 3y ago> Without syncing, this is a better ctrl+r, which I won't disagree is nice, but not the real point of this software. Why not? I use it without syncing just for the search functionality which is really useful to me and saves me quite a bit of time. I'm sure the syncing is useful but I don't care about my shell commands enough to want them synced across all the machines I use.
- deng 3y agoI can only repeat myself: the syncing is advertised as the main feature, it's the USP. There are plenty of other tools that improve ctrl+r.
- dang 3y agoRelated: Atuin replaces your existing shell history with a SQLite database - https://news.ycombinator.com/item?id=38936102 https://news.ycombinator.com/item?id=38936102 - Jan 2024 (10 comments) I quit my job to work full time on my open source project - https://news.ycombinator.com/item?id=38935205 https://news.ycombinator.com/item?id=38935205 - Jan 2024 (176 comments) Atuin replaces your existing shell history with a SQLite database - https://news.ycombinator.com/item?id=35839470 https://news.ycombinator.com/item?id=35839470 - May 2023 (193 comments) Atuin replaces your existing shell history with a SQLite database - https://news.ycombinator.com/item?id=35688117 https://news.ycombinator.com/item?id=35688117 - April 2023 (1 comment) Atuin for zsh shell history in SQLite - https://news.ycombinator.com/item?id=31177943 https://news.ycombinator.com/item?id=31177943 - April 2022 (1 comment) Show HN: Atuin, improved shell history with multi-machine sync - https://news.ycombinator.com/item?id=27079862 https://news.ycombinator.com/item?id=27079862 - May 2021 (9 comments)
- vander_elst 3y agoatuin is nice, but the search functionality is not on par with fzf, I found myself several times going `cat ~/.zsh_history | fzf`
- ThinkBeat 3y agoI see good value in the sync. But since I use different flavors of UNIX and Linux some of the commands are different. I think it could get confusing. Obviously you could just not synch between platofrms
- wswope 3y agoYou’re filtered for commands used on the current machine by default, though there is an easy toggle to search remote-host commands too.
- weinzierl 3y agoI treat my shell histories like documents. When I start a new shell, it starts a new history with a generated meaningful name. That is good for one-off things and experiments. History is still always preserved. Nothing gets lost. Most of my work is done in (usually long-lived) manually named sessions, that write their history to a file named like the session. I can restart old sessions any time. Everything is in plain text files in ~/.history, which has pros and cons. One advantage is that I can archive older history files very easily. I often ripgrep through my whole history as well, though I occasionally long for it being in a proper database and content being more structured. I can share my history sessions and use them from multiple shells simultaneously, but practically never do that, so it is not an important use case for me. Would Atuin bring any benefit for me?
- xnx 3y agoPreviously 10 months ago. 183 comments. https://news.ycombinator.com/item?id=35839470 https://news.ycombinator.com/item?id=35839470
- brianzelip 3y agoGood recent podcast with the Atuin author! https://changelog.com/podcast/579 https://changelog.com/podcast/579
- moyix 3y agoAtuin is lovely, although I found some of its defaults pretty annoying until I changed them: - It turns out I basically never want fuzzy search through my command history, and certainly not by default. I gave it a try for a couple weeks but it was very frustrating to be searching for a particular command, type in the exact prefix, and have the thing I was looking for hidden among hundreds of irrelevant entries. Solution: search_mode = "fulltext" in Atuin's config.toml - Having a full screen pop-up appear whenever I hit up was really jarring, especially since I have a habit of hitting up a few times when I'm at the command line thinking of what I need to do next, to sort of refresh my memory on what I was just doing; the popup very effectively destroyed that chain of thought. Solution: eval "$(atuin init bash --disable-up-arrow)" in .bashrc These are pretty minor issues and it's possible my preferences are just different from most! Atuin now works really nicely for me. My only outstanding issues are: - Under mosh the UI ends up corrupting the screen; apparently this is really more of a mosh bug (no alternate screen support) and you can work around it by having tmux/screen running: https://github.com/atuinsh/atuin/issues/1324 https://github.com/atuinsh/atuin/issues/1324 - I still don't have a great model in my head of how sync works and find myself occasionally force-syncing across a few systems until I convince myself everything is in the same state. - It would be nice to have some kind of settings sync so I don't have to make the config changes mentioned above on 10 different systems. Surprisingly I don't see a feature request for this yet so maybe I'll go open one... Anyway I don't want these issues to stop people from trying Atuin – it's a really nice piece of software. I almost never make changes to the default environment so I consider it a testament to how useful it is that I've added it to all the systems I use regularly!
- mynameisvlad 3y agoI ended up using its compact mode and limiting to a few lines, so instead of taking up my full screen it only takes up a few lines below the prompt. Much more reasonable.
- gaws 3y agoThis has been discussed ad nauseam: https://news.ycombinator.com/item?id=35839470 https://news.ycombinator.com/item?id=35839470 https://news.ycombinator.com/item?id=38936102 https://news.ycombinator.com/item?id=38936102 https://news.ycombinator.com/item?id=27079862 https://news.ycombinator.com/item?id=27079862 https://news.ycombinator.com/item?id=32491840 https://news.ycombinator.com/item?id=32491840 https://news.ycombinator.com/item?id=31177943 https://news.ycombinator.com/item?id=31177943 https://news.ycombinator.com/item?id=35688117 https://news.ycombinator.com/item?id=35688117 https://news.ycombinator.com/item?id=38969077 https://news.ycombinator.com/item?id=38969077 https://news.ycombinator.com/item?id=37127909 https://news.ycombinator.com/item?id=37127909 https://news.ycombinator.com/item?id=35876290 https://news.ycombinator.com/item?id=35876290 https://news.ycombinator.com/item?id=34972384 https://news.ycombinator.com/item?id=34972384 https://news.ycombinator.com/item?id=33786580 https://news.ycombinator.com/item?id=33786580 https://news.ycombinator.com/item?id=38797713 https://news.ycombinator.com/item?id=38797713 https://news.ycombinator.com/item?id=39457875 https://news.ycombinator.com/item?id=39457875
- qmsdfjkc 3y agoI've been using a combination of git (append only when merging) and systemd for that for a long time now, my history file is 70k lines now and still works like a charm. I wonder however how people can spend a lot of time in the shell and have no sync process at all in their shell history.
- lobocinza 3y agoIt looks cool and are good to have features but I don't think it justifies the tinkering, syncing to server and eventual problems. Would it slow down my shell? Ctrl-r + FZF is already good.