logoalt Hacker News

aa-jvlast Thursday at 8:20 AM3 repliesview on HN

My favourite shell trick is to comment my code:

  $ some_long_command -with -args -easily -forgotten # thatspecialthing
... Some weeks later ..

  $ CTRL-R<specialthing>
.. finds:

  $ some_long_command -with -args -easily -forgotten # thatspecialthing

Need to see all the special things you've done this week/whenever?

  $ history | grep "\#"
...

Makes for a definite return of sanity ..


Replies

scbrglast Thursday at 3:37 PM

I once saw this pattern referred to as a bashtag, which I think was an excellent name (no matter if you actually run bash as your shell or not).

senectus1last Thursday at 8:34 AM

omg >$ CTRL-R<specialthing>

I could kiss you.. this alone is amazing!

show 3 replies
skydhashlast Thursday at 12:48 PM

I don’t keep history. Any commands I think will be useful, I save it in a script.