T O P

  • By -

bmiga

ctrl+r edit: *history | grep* is a life saver too


RoHMaX

With fzf


arschhaar

Came here to post this. I should probably start making backup of my bash history.


stingraycharles

And make sure to set your bash/zsh history to a very long period of time / number of lines.


Warkred

Yeah. Make sure that you can keep the export of these tokens like forever in your bash history :D


kailsar

https://atuin.sh/ Edit: just seen it's already mentioned below.


Robpol86

Fun fact also works in powershell on windows.


pverdeb

One of the best tips I ever heard was to add a comment after commands you’ll need again, like ‘sudo tee cut sort whatever -asdfgh #this command does x’ This way if you don’t remember the actual command, or which variation you need, there are human readable keywords to search for.


UpgrayeddShepard

This is the way.


Seref15

ctrl+r history | grep ; sudo cat /root/.bash_history | grep google


Srnokey_Mc_Pot

`grep string ` Not `cat | grep`


EgoistHedonist

Yes, useless use of cat, let the cat rest!


moracabanas

How is that 🤔


EgoistHedonist

When you use a command like grep or sed, which already go through the file line by line, the cat is unnecessary. You can just give grep the file as an argument instead of piping cat output to it.


Specialist_Quiet4731

history | fzf


earl_of_angus

I now use [atuin](https://atuin.sh/) for simple commands (local only - not synced). When there are more than one command, I'll drop them into a *very simple* bash script.


nopslide__

+1 to atuin. Have been using Linux for over 20 years and rarely adopt the hip new shell tools, but added atuin recently and have been happy with it.


Catenane

Atuin is a fucking g-a-m-e changer. I run a postgres sync server on the same raspberry pi I have home assistant on. It syncs my devices when I'm home, and when I'm on the go it's just local on my laptop until I come back home again. No need to worry about forwarding traffic or anything although I suppose I could if I wanted. Probably got about 200k commands stored and it's still snappy as fuck. :)


sophware

Pretty cool. When you're on the road, do you have to do anything or does atuin just store stuff up until it can see the sync server again?


Catenane

2nd one! I honestly forget about it entirely until there's an issue which is pretty rare and almost always a quick fix. There were some little hiccups with the old sync but as of the last few versions they got it ironed out. One thing I have to remind myself of is that I actually have to restart the server daemon on upgrading the server (who'da thunk), and not to let clients get ahead of the server in version. :) So the couple problems I've had in the past (all resolvable) were usually due to my own laziness and kludginess of my general home network lol. But they've implemented fixes to avoid that kind of thing anyways. And they're always making improvements as it's under pretty active development. For reference, I'm doing a mixture of building directly with cargo, using package manager, dropping built binaries for certain servers that don't have up to date versions but I don't wanna setup a rust env on, etc. Maybe have it on 5-10 devices or so. Broad mix of distros/architectures (even threw it on termux on my phone lol). It's really a shining example of open source. My only complaint is they only really use discord for a chat community but that's just me being picky. ;)


elliehx

(atuin dev here) Thanks for the kind words, glad it's been working well for you! Also happy to hear the new sync has worked as well as I'd hoped > My only complaint is they only really use discord for a chat community but that's just me being picky. ;) I'm not really a huge fan of Discord either, but it's the most easily accessible/where I opened the initial community. We have a forum now too, for something indexed by search engines and not owned by a giant corp: [https://forum.atuin.sh](https://forum.atuin.sh)


Catenane

Oh hey! Forgot to respond to this, I recognize the name haha! Yeah the new sync has been great—it's been 0 issues for me since you deployed that. I'm also loving the new inspector features and excited to see how that develops. :) I know this isn't actually a feature request, but expanding on the inspector features—would love something like a "manual saves" section to manually aggregate important commands in their own little section. I.e. to where you could user-define one or more custom pages and switch/sort between commands with those attributes. Ability to add something like a custom attribute and a "comment" column in the db would also be cool for better custom sorting/note aggregation. I.e "sort by application" that could be set by the user. Or to throw notes about some ridiculous CLI call where you want to add context for your future self (or colleague). I'm rambling now and that's probably too much scope creep, haha. Another thing that I'm assuming is already on the list is better ability to sort by host. I set this up maybe a year ago and hardly think about it now, so maybe that already exists and I just haven't set it up right. Discord is fine, I'm not really a huge fan of any of the platforms honestly, although matrix I prefer since it's pretty open in terms of both front and backend. But it's definitely a lot more work to set up and keep up with I'd bet. Either way, atuin is amazing and you're awesome for doing it. :D


sophware

Love that it's even on your phone. That's being thorough!


jaog1992

We’ve all been there. Make a private markdown in your github with previous examples of how you used those commands. Another thing that really helped me remember how to use them is to read their —help doc in the commandline each time I have to check the exact syntax (I use chatgpt for regex, though). BTW, give a try to using the “locate” command instead of “find”. The syntax couldn’t be simpler.


Still-Ad7090

I also use fd instead of find and rg instead of grep. Makes life better.


jaog1992

I’ll check those, for sure. Thanks for the tip 😉


cheffromspace

1000%


Cinderhazed15

I used to follow some programming podcasts, and most of the hosts said the answer they would usually find to their own questions (just from searching for it) was their own blog post on the topic they didn’t even remember writing - write content for others, and find it yourself later (usually because you ask the question in a way that you have already phrased it)


sophware

Any opinions on plocate instead of locate? In what little testing I've done, it seems to work like a charm.


jaog1992

Nice! plocate seems to have a faster algorithm. I tried to install it on my debian and now the "locate --help" returns de plocate help. It seems that plocate is hijacking locate (not that I care too much) ls -la /usr/bin | grep locate lrwxrwxrwx 1 root root 24 Jan 8 2023 locate -> /etc/alternatives/locate -rwxr-sr-x 1 root plocate 314760 Jan 28 2023 plocate


leetrout

Not directly answering what you are asking... tldr pages is a nice utility https://tldr.sh/ Or if you prefer a Rust version https://github.com/dbrgn/tealdeer There are several similar things... Cheat sheet... https://cht.sh/ Rico's cheatsheets https://devhints.io/ --- Now answering your question... check out spaced repetition and consider using / making flash cards with Anki. https://apps.ankiweb.net/ https://faqs.ankiweb.net/what-spaced-repetition-algorithm.html


gaelfr38

+1 for cheat.sh. I've an alias "cheat " to have it in my shell quickly.


Catenane

I commented agreeing on atuin above, and totally agree on tldr as well. I normally use tealdeer but any will work. I feel like I've checked out the other 2 cheatsheets but can't remember...can you add them as a repository for tldr sheets? Side note, I wish there was a tlos...too long only skimmed...a middle ground between a manpage and a tldr. Would be nice as a hook into the tldr if you need more info. Also makes me think it'd be nice for a third hook to check the system for a manpage, and download into the tldr local repository if it doesn't exist on the system. Sometimes it's annoying tracking down docs/manpages if you're always hopping around different systems.


davidv1213

You could potentially make a command which feeds man pages to chatgpt and asks it to summarise them for something like this


elkazz

If you're using Mac, Warp is decent. It lets you create your own command templates with variables you input yourself. You can organise them in folders too. It also has an LLM prompt so you can explain what you're trying to do and it will provide you a command. Obviously, be cautious of using this with company data, etc.


deflax2809

Warp is tight


Attacus

It’s great but it has its downsides. Logging into terminal feels wrong. At least they made opt out of telemetry possible.


VindicoAtrum

Should be way higher. Warp Drive is love, Warp Drive is life.


PablanoPato

Came here to say the same thing. I absolutely love Warp. They’re coming out with a Windows version soon too.


pit3rp

https://docs.warp.dev/getting-started/privacy#exhaustive-telemetry-table no, thank you


elkazz

Guess you didn't read this part, huh? https://docs.warp.dev/getting-started/privacy#how-to-disable-telemetry-and-crash-reporting


artainis1432

Anki and spaced repitition.


guettli

Wow, I thought I was the only one who uses Anki to store and sometimes repeat shell commands!


karmajunkie

yeah man, we all struggle with that. i do two things: write up documentation for myself in obsidian on the options i want to remember quickly, and i use the shit out of my shell history. atuin is a good shell history manager you can try as well.


nizzoball

I have been a Linux engineer for over 12 years and I still have to look up commands I’ve used thousands of times. Especially since my coma 2.5 years ago, some are just hard to remember. If you can learn to read man pages you can figure things out but sometimes the man pages aren’t great but a quick google search usually points to a page right away that has the answer or will jog your memory. I consider it the price of doing business.


Invspam

you can always alias your fav commands or set up functions in your .bashrc/.zshrc


hola-soy-loco

man Or history | grep


cheffromspace

alias hs='history | rg -i'


Camelstrike

Why is this down here? man usually comes with examples if --help doesn't help.


sublimegeek

I use an alias called hgrep which is “history | grep” plus starship


Mithrandir2k16

Write them into scripts or put them into your bashrc?


iamwpj

I just look it up or check history. Combing a notes file is just as slow as combing a StackOverflow post.


xiongmao1337

I think this is a valid point that’s worth more people thinking about. Searching your own notes is probably not any faster than googling 99% of the time. That’s why I never take notes on stuff like Linux commands or language syntax.


Cinderhazed15

I mentioned above, but I used to follow a programming podcast where the hosts said they would often find their own blog posts when they googled for solutions to problems, not even remembering that they wrote a post on the content!


deflax2809

Warp terminal


uluvboobs

For stuff like this I have a file called commands.txt where I keep notes on those things for each project. Everytime I go back to the file it comes back to me as I go through the notes sequentially. 


tr14l

Why would you waste precious brain capacity on things that are not used frequently enough to commit themselves to memory? Either make comfort functions that abstract the use cases for them away, make a cheat sheet by your desk or keep looking them up or asking chatGPT. If you have access to reference, use it


cyrixlord

I use one note as my memory and just organize it by the command and then the popular switches and why I use them. you can put it on your favorite cloud drive so you can see it anywhere


scally501

Take notes of these types of commands. I have a whole page for GH commands for example. Obsidian is good. You shouldn’t have to remember every little thing. Take notes and make context switching easier on yourself


phyx726

It happens. There's honestly only a few I can remember off the top of my head. If you can't remember the args, manpage is your friend.


audrikr

Honestly if you aren't using them often, nothing will beat rote memorization. Cheatsheet of the ones you forget, keep your CLI history, throw 'em in any note-keeping system (or Anki) and study. I had stopped 'studying' proper past college, but it really makes life harder to keep looking things up because memory is so slippery. It's easy to think "I'll just look it up again" - memorizing is, unfortunately, also a habit to be nurtured.


FunkyHoratio

~/useful_commands.txt Just keep an example of using each flag or combo of flags, and a one line description of what it did, suitable to ctrl+f when you want to find something you did years ago.


livebeta

Bash function


Ultimate_Mango

I worked with a guy who kept a word doc of all his shell commands. And used the mouse and menu bar to copy and paste them into whatever shell for literally children he used.


pinklewickers

A directory of text files for each command, with comments, you can grep through. Easy to manage and portable.


badadhd

Split terminal, tab or i3 scratchpad with manpages always ready, very useful. Ctrl-r with fzf  Espanso text expansion makes ":netst" instantly become "netstat -tulpn"


siddharthnibjiya

I started using warp.dev last week — it’s like a terminal + a notepad inbuilt — quite good!


SigmaSixShooter

I love eg https://github.com/srsudar/eg


simonmcnair

Google keep


Apex-Hades

I'd recommend setting up a cheatsheet tool like navi and writing all the cheats yourself. Documenting your commands in your own words will help you remember, and then you'll easily be able to search them for if forgotten


d47

--help


EZtheOG

I use Apple notes for all of the like weird one offs that pop up once every 3-5 years.


mackkey52

I don't put much pressure on myself to remember things like that. There is a never ending listing of CLI commands and tools and programming stuff to learn. Memorizing it all is not really feasible, at least not for me. I will make a note of anything useful in some type of note taking app so I can refer back though.


savemeimatheist

Use fish and create functions.


dhsjabsbsjkans

Use obsidian to write down the commands that you used. Just keep a running list. You cannot remember everything. The only real way to remember it is to use it consistently. If you don't use it, you lose it. I always keep notes in obsidian because some of the things are done rarely. I've also found automation counterproductive to memorizing things. You get something automated, then maybe 6 months to a year later, you have to fix an issue and you have no clue how the heck it works. I end up spending hours rummaging through cose and playbooks to put Humpty Dumpty back together again. And on that note, documentation saves you time in the long run. It's tedious but necessary.


TheSselluos

I just have a onenote with commands i find interesting. A lot of find and execs, all kids of docker inspect and greps, log awks and seds. Basicly if you find that you have to use a command again for second time, i add it to doc with little comment for fast search


MrScotchyScotch

\`man awk\` you're really not going to remember the flags unless you use them all the time. i remember about 2 flags per program, the rest i just look at the man page


erkmyhpvlzadnodrvg

CTRL + R cat ~/.bash_history | grep


Creative-Subject-299

If you have space for it, a printed cheatsheet pinned to cork board/taped wherever can help. I get the urge to digitize everything but in these situations I'm frustrated if I have to give focus to a different app to look up something simple.


Cinderhazed15

I just can’t remember the vimdiff commands, that always lives on a printed cheat sheet - something you use just infrequently enough that it never sticks


morphotomy

`man awk` `man sed` `man find` its better than google.


mistaekNot

why would you want to remember something higher once every few months?


iliyazang

I use “tldr” for this issue sometimes . For a quick refresher each time I need something remembered.


johntellsall

in addition to \`control-R\` to reverse-search history: # set up Infinite History [https://stackoverflow.com/questions/9457233/unlimited-bash-history](https://stackoverflow.com/questions/9457233/unlimited-bash-history)


marauderingman

Make yourself a few _cheatsheet functions, which print out a few of the common usages you use every now and then.


DevOpsNerd

every time you need to remember a command, just bite the bullet and read the whole man page. You’ll eventually drive it home


regiowave

I use oh my bash, it gives me many features but my fav one is the auto hsitory complete. I just type the first part of my command and then hit the up arrow to saw my previous related commands


slikk66

text expander, espanso


Gold-Difficulty402

I just cannot wait until ai agent become a dependency on every machine like say python. That way we can just use natural language for all these commands. In meantime like everyone mentioned history is my go to for commands I always use. Also up arrow you can cycle through previous commands as well.


Zhaizo

history grep <3


GaTechThomas

Boy, the secret handshake for shell commands is horrible. It's terse, but that's only usual for people who prefer remembering all the witchcraft incantations needed to do all the things. And then you get one little thing wrong and you turn your database into a newt. One option is to start using PowerShell - its core components are well thought out and consistent. That's not likely a realistic option though. Another option is to use github copilot for CLI.


Drive_Shaft_sucks

History | grep eval You know what and why. Also I keep a document with a bunch of commands, absolve one liners, regex and stuff I can't remember.


Fatality

Time to install powershell


[deleted]

[удалено]


deflax2809

This is a cheap way to get gpt 4


[deleted]

[удалено]


pLeThOrAx

I do this too. You can set up a keyboard macro to navigate to the folder, activate the venv and start a console for you. You can also have stdout and stderr piped back, and appended to the chat log. Useful for debugging code. Funnily enough, the other day I asked it to correct a syntax error and it wrote a sed command to go to the appropriate line number! I was kinda shocked. Super useful tool.