frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Shell Tricks That Make Life Easier (and Save Your Sanity)

https://blog.hofstede.it/shell-tricks-that-actually-make-life-easier-and-save-your-sanity/
61•zdw•8h ago

Comments

zahlman•1h ago
Not a fan of the LLM-flavoured headings, and the tips seem like a real mixed bag (and it'd be nice to give credit specifically to the readline library where appropriate as opposed to the shell), but there are definitely a few things in here I'll have to play around with.

One thing I dislike about brace expansions is that they don't play nicely with tab completion. I'd rather have easy ways to e.g. duplicate the last token (including escaped/quoted spaces), and delete a filename suffix. And, while I'm on that topic, expand variables and `~` immediately (instead of after pressing enter).

aa-jv•1h ago
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 ..

senectus1•51m ago
omg >$ CTRL-R<specialthing>

I could kiss you.. this alone is amazing!

aa-jv•44m ago
Yes indeed, it is very fun to discover this if you don't know it already, it expands your understanding of your shell life immensely, doesn't it?
fragmede•26m ago
http://atuin.sh adds a database to store history in and a custom app to use for lookup with added modes to help with searching.
tetris11•1h ago
Never heard of instant truncate, nor `fc`, nor `Esc .`

Quite a few useful ones

chasil•49m ago
A much larger base for ksh (as a pdksh descendent) is Android. OpenBSD is a tiny community in comparison, although Android has acquired code directly from OpenBSD, notably the C library.

The vi editing mode is always present in ksh, but is optional in dash. If present, the POSIX standard requires that "set -o vi" enable this mode, although other methods to enable it are not prohibited (such as inputrc for bash/readline), and as such is a "universal trick."

The article is relying on some Emacs mode, which is not POSIX.

$_ is not POSIX if I remember correctly.

History in vi mode is easier, just escape, then forward slash (or question mark) and the search term (regex?), then either "n" or "N" to search the direction or its reverse.

I've seen a lot of people who don't like vi mode, but its presence is the most deeply standardized.

fellerts•41m ago
CTRL + W usually deletes everything until the previous whitespace, so it would delete the whole '/var/log/nginx/' string in OP's example. Alt + backspace usually deletes until it encounters a non-alphanumeric character.

Be careful working CTRL + W into muscle memory though, I've lost count of how many browser tabs I've closed by accident...

gryfft•34m ago
Ctrl-Shift-T usually brings that tab right back at least
hejira•28m ago
In my terminal it's the exact opposite – Alt-Backspace deletes to the previous space, whereas Ctrl-W deletes to the last non-alphanumeric (such as /). I'm using fish shell in an Alacritty terminal.

Yeah, pressing Ctrl-W accidentially is a pain sometimes ... but Ctrl-Shift-T in Firefox is a godsend.

Joker_vD•40m ago
> The “Works (Almost) Everywhere” Club

> The Backspace Replacements

Also known as "emacs editing mode". Funnily enough, what POSIX mandates is the support for "vi editing mode" which, to my knowledge, almost nobody ever uses. But it's there in most shells, and you can enable it with "set -o vi" in e.g. bash.

ZeroGravitas•18m ago
Vi mode is also available in Claude code and gemini-cli to give some recent examples, and a bunch of other places you might not expect it, as well the more obvious places where code is written.

Once you get used to it, it is painful to go back.

voidUpdate•36m ago
With ctrl+r, if you press it twice, it will autofill the search with whatever you last searched for. pressing it more will go back through the history. Been using that a lot recently when doing docker stuff. ctrl+r, type the container name, keep going until I get the compose build command. ctrl+r, ctrl+r, repeat until the log command. Then I can just mash ctrl+r to get the build and log commands. Ctrl+r is your friend. ctrl+r
arcanemachiner•4m ago
Make sure to add fzf + shell integration for maximum Ctrl+r goodness.
tkocmathla•36m ago
I love this, from a comment on the article:

  He had in his path a script called `\#` that he used to comment out pipe elements like `mycmd1 | \# mycmd2 | mycmd3`. This was how the script was written:
 
  ```
  #!/bin/sh
  cat
  ```
talkin•23m ago
> cd -: The classic channel-flipper. Perfect for toggling back and forth.

And not only cd. Gotta love 'git checkout -'

faangguyindia•18m ago
I just open, agent in tui, and ask it to do what I want and make a plan, i read the plan edit it and run it.

Simple, no need to learn any commandline these days.

I used to use arch and all, and managed many big projects. I find little value in learning new tools anymore, just feed it docs and it generated working plan most of the time

Now I've moved to coding in Haskell, which i find suits me better than wasting my time with cli and exploring what options all these cli tools have.

ahmedfromtunis•7m ago
Using the terminal becomes much more cozy and comfortable after I activate vim-mode.

A mistake 3 words earlier? No problem: <esc>3bcw and I'm ready to go.

Want to delete the whole thing? Even easier: <esc>cc

I can even use <esc>v to open the command inside a fully-fledged (neo)vim instance for more complex rework.

If you use (neo)vim already, this is the best way to go as there are no new shortcuts to learn and memorize.

Personal Encyclopedias

https://whoami.wiki/blog/personal-encyclopedias
123•jrmyphlmn•13h ago•31 comments

Running Tesla Model 3's computer on my desk using parts from crashed cars

https://bugs.xdavidhu.me/tesla/2026/03/23/running-tesla-model-3s-computer-on-my-desk-using-parts-...
616•driesdep•12h ago•192 comments

ARC-AGI-3

https://arcprize.org/arc-agi/3
386•lairv•15h ago•259 comments

Earthquake scientists reveal how overplowing weakens soil at experimental farm

https://www.washington.edu/news/2026/03/19/earthquake-scientists-reveal-how-overplowing-weakens-s...
160•Brajeshwar•19h ago•66 comments

The truth that haunts the Ramones: 'They sold more T-shirts than records'

https://english.elpais.com/culture/2026-03-17/the-uncomfortable-truth-that-will-always-haunt-the-...
106•c420•4d ago•50 comments

My DIY FPGA board can run Quake II

https://blog.mikhe.ch/quake2-on-fpga/part4.html
147•sznio•3d ago•49 comments

The EU still wants to scan your private messages and photos

https://fightchatcontrol.eu/?foo=bar
1124•MrBruh•12h ago•300 comments

More precise elevation data for GraphHopper routing engine

https://www.graphhopper.com/blog/2026/03/23/more-precise-elevation-data-for-graphhopper/
37•karussell•2d ago•0 comments

Two studies in compiler optimisations

https://www.hmpcabral.com/2026/03/20/two-studies-in-compiler-optimisations/
75•hmpc•3d ago•5 comments

90% of Claude-linked output going to GitHub repos w <2 stars

https://www.claudescode.dev/?window=since_launch
279•louiereederson•15h ago•170 comments

Ashby (YC W19) Is Hiring Engineers Who Make Product Decisions

https://www.ashbyhq.com/careers?ashby_jid=c3c7125d-7883-4dff-a2bf-f5a55de4a364&utm_source=hn
1•abhikp•2h ago

Supreme Court Sides with Cox in Copyright Fight over Pirated Music

https://www.nytimes.com/2026/03/25/us/politics/supreme-court-cox-music-copyright.html
344•oj2828•18h ago•266 comments

False claims in a widely-cited paper

https://statmodeling.stat.columbia.edu/2026/03/24/false-claims-in-a-published-no-corrections-no-c...
272•qsi•8h ago•103 comments

Shell Tricks That Make Life Easier (and Save Your Sanity)

https://blog.hofstede.it/shell-tricks-that-actually-make-life-easier-and-save-your-sanity/
61•zdw•8h ago•18 comments

Show HN: Robust LLM Extractor for Websites in TypeScript

https://github.com/lightfeed/extractor
37•andrew_zhong•5h ago•24 comments

Maxell MXCP-P100 – wireless cassette player

https://maxell-usa.com/product/cassetteplayer/
18•ChrisArchitect•2d ago•8 comments

Quantization from the Ground Up

https://ngrok.com/blog/quantization
249•samwho•17h ago•46 comments

You probably don't want to buy a retro console

https://medium.com/@razorbeamz/you-probably-dont-want-to-buy-a-retro-console-a-guide-for-people-w...
9•razorbeamz•44m ago•1 comments

Apple randomly closes bug reports unless you "verify" the bug remains unfixed

https://lapcatsoftware.com/articles/2026/3/11.html
397•zdw•14h ago•223 comments

Do Architects Still Need to Draw? (2020)

https://www.lifeofanarchitect.com/do-architects-still-need-to-draw/
19•hbarka•4d ago•16 comments

What came after the 486?

https://dfarq.homeip.net/what-came-after-486/
20•jnord•2d ago•14 comments

Power consumption of Game Boy flash cartridges (2021)

https://gekkio.fi/blog/2021/power-consumption-of-game-boy-flash-cartridges/
34•JNRowe•2d ago•1 comments

Swift 6.3 Released

https://www.swift.org/blog/swift-6.3-released/
18•ingve•1h ago•4 comments

Show HN: A plain-text cognitive architecture for Claude Code

https://lab.puga.com.br/cog/
92•marciopuga•9h ago•30 comments

Data is everywhere. The government is buying it without a warrant

https://www.npr.org/2026/03/25/nx-s1-5752369/ice-surveillance-data-brokers-congress-anthropic
38•nuke-web3•3h ago•11 comments

Jury finds Meta liable in case over child sexual exploitation on its platforms

https://www.cnn.com/2026/03/24/tech/meta-new-mexico-trial-jury-deliberation
384•billfor•1d ago•479 comments

My astrophotography in the movie Project Hail Mary

https://rpastro.square.site/s/stories/phm
857•wallflower•3d ago•197 comments

"Disregard That" Attacks

https://calpaterson.com/disregard.html
76•leontrolski•10h ago•54 comments

Thoughts on slowing the fuck down

https://mariozechner.at/posts/2026-03-25-thoughts-on-slowing-the-fuck-down/
841•jdkoeck•19h ago•382 comments

Show HN: Optio – Orchestrate AI coding agents in K8s to go from ticket to PR

https://github.com/jonwiggins/optio
51•jawiggins•16h ago•28 comments