There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

lattrommi ,

is there a way to save commands from history? i tried to figure this out when i was starting to use linux regularly, to help learn commands and to make a reference for myself as to what the commands do. i’m familiar with things like man, info, tldr and others but i wanted to put things in my own words since i remember better that way.

what i’m wanting but can’t seem to automate: -save commands from bash history to a file with only the command and arguments used, no line numbers or time stamps. -filenames can be kept, but if filenames are removable easily, that would be better. -file saved in should have the list sorted with any duplicates removed and happen after any terminal session ends. -i’ve read about changing the prompt but not done it correctly and not sure if possible or the safest way. -i’ve tried using .bash_logout but it doesn’t seem to do anything and i’m not sure why.

this isn’t too important anymore, as i’ve grown more comfortable with linux and bash but it bugs me that i never got it to work. i can copy and paste more detailed notes of what i tried but i’d need to redact a bunch of cursing and frustrated whining.

smeg ,

To use the last argument of the last ran command, use the Alt+. keys.

Sounds like a poor-man’s !$ to me!

urquell ,

Am I blind or is ctrl+R not in that document?

smeg ,

I think you are blind (or maybe your version of the website is being truncated?)

urquell ,

Yep, found it :)

markus ,

I'm using hstr since some years and it works perfect for me. https://github.com/dvorka/hstr

mbw ,

If you have fzf installed, it is easy to integrate it with your bash history. In my .bashrc, I have:


<span style="font-style:italic;color:#969896;"># Introduce fzf-driven functionality as described here: https://wiki.archlinux.org/title/fzf.
</span><span style="color:#62a35c;">source</span><span style="color:#323232;"> /usr/share/fzf/key-bindings.bash
</span><span style="color:#62a35c;">source</span><span style="color:#323232;"> /usr/share/fzf/completion.bash
</span>

Also, you may be interested in zoxide, which keeps track of paths you have navigated to. Also from my .bashrc:


<span style="font-style:italic;color:#969896;"># Enable an autojump-like 'j' command. Use 'ji M' to select paths starting with M using fzf.
</span><span style="font-style:italic;color:#969896;"># This needs to always come last.
</span><span style="color:#62a35c;">eval </span><span style="color:#183691;">"$(</span><span style="color:#323232;">zoxide</span><span style="color:#183691;"> init</span><span style="color:#323232;"> --cmd</span><span style="color:#183691;"> j bash)"
</span>
redbr64 ,
@redbr64@lemmy.world avatar

I just started using both recently and it’s great. For the fzf file search, there’s even some extension that can show a preview pane of text files and even images!

UnrefinedChihuahua ,

New to Linux as my daily driver. This is life changing. I was up/down arrowing like a madman!

aeno ,

Shout out to the very fine Atuin.sh. Give it a try, you won’t regret it.

drwho ,
@drwho@beehaw.org avatar

curl | sh…

aeno ,

Yep, I don’t like these “recommended” methods, too. Fortunately, you can just use your favourite package manager instead: docs.atuin.sh/guide/installation/-installa…

xlash123 ,
@xlash123@sh.itjust.works avatar

I’ve been using McFly to do my history searching. It’s pretty good. I recommend changing the default sort from rank to time though

kionite231 ,

I wonder what “neural networks” they are using in it and how is it improving the accuracy

xlash123 ,
@xlash123@sh.itjust.works avatar

No idea. I personally didn’t like it. I felt the time based sorting was more accurate for me

mlfh ,

Ctrl+r was a life-changer when I first learned it.

dan ,
@dan@upvote.au avatar

I think it’s the only shell shortcut I know haha

You can install fzf to make it fancier.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines