frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Scripts I wrote that I use all the time

https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/
220•speckx•5h ago

Comments

weregiraffe•2h ago
Looks very useful!
southwindcg•2h ago
Regarding the `line` script, just a note that sed can print an arbitrary line from a file, no need to invoke a pipeline of cat, head, and tail:

    sed -n 2p file
prints the second line of file. The advantage sed has over this line script is it can also print more than one line, should you need to:

    sed -n 2,4p file
prints lines 2 through 4, inclusive.
tonmoy•1h ago
It is often useful to chain multiple sed commands and sometimes shuffle them around. In those cases I would need to keep changing the fist sed. Sometimes I need to grep before I sed. Using cat, tail and head makes things more modular in the long run I feel. It’s the ethos of each command doing one small thing
southwindcg•1h ago
True, everything depends on what one is trying to do at the time.
1-more•50m ago
yeah I almost always start with `cat` but I still pipe it into `sed -n 1,4p`
wiether•2h ago
It's been a while since I haven't read something as useful!

There also some very niche stuff that I won't use but found funny

giraffe_lady•2h ago
The nato phonetic alphabet one cracked me up. My dude you don't need that, call center employees don't know it, just say S as in Sugar like ur grandma used to.
ericyd•2h ago
The nato phonetic alphabet is still useful even if the other party doesn't know it, I've used it a bunch of times on the phone to spell out my 10- letter last name. Saves quite a lot of time and energy for me vs saying "letter as in word" for each letter.
SoftTalker•1h ago
> saying "letter as in word" for each letter

Which often just confuses things further.

Me: My name is "Farb" F-A-R-B. B as in Baker.

Them: Farb-Baker, got it.

giraffe_lady•1h ago
"M as in Mancy."
giraffe_lady•1h ago
Right but it's not much more useful than any other phonetic alphabet the other party doesn't know, including the one you make up on the spot.
vunderba•15m ago
Exactly. The listening party doesn't need to have knowledge of the NATO alphabet to still benefit from it since they are just regular English words.

I once had someone sound out a serial number over a spotty phone connection years ago and they said "N as in NAIL". You know what sounds a lot like NAIL? MAIL.

And that is why we don't just arbitrarily make up phonetic alphabets.

senkora•1h ago
I once had the customer service agent for Iberia (the Spanish airline) confirm my confirmation number with me using it.

It worked with me and I guess it must have usually worked for him in most of his customer interactions.

kelvinjps10•47m ago
When I worked in customer service, I asked a teammate what I could do to spell back something the customer said, and she taught me that system, it helped me a lot.
soiltype•2h ago
This is exactly the kind of stuff I'm most interested in finding on HN. How do other developers work, and how can I get better at my work from it?

What's always interesting to me is how many of these I'll see and initially think, "I don't really need that." Because I'm well aware of the effect (which I'm sure has a name - I suppose it's similar to induced demand) of "make $uncommon_task much cheaper" -> "$uncommon_task becomes the basis of an entirely new workflow/skill". So I'm going to try out most of them and see what sticks!

Also: really love the style of the post. It's very clear but also includes super valuable information about how often the author actually uses each script, to get a sense ahead of time for which ones are more likely to trigger the effect described above.

A final aside about my own workflows which betrays my origins... for some of these operations and for others i occasionally need, I'll just open a browser dev tools window and use JS to do it, for example lowercasing a string :)

chipsrafferty•1h ago
I'd love to see a cost benefit analysis of the author's approach vs yours, which includes the time it took the author to create the scripts, remember/learn to use them/reference them when forgetting syntax, plus time spent migrating whenever changing systems.
te_cima•1h ago
why is this interesting to you? the whole point of doing all of this is to be more efficient in the long run. of course there is an initial setup cost and learning curve after which you will hopefully feel quite efficient with your development environment. you are making it sound like it is not worth the effort because you have to potentially spend time learning "it"? i do not believe that it takes long to "learning" it, but of course it can differ a lot from person to person. your remarks seem like non-issues to me.
akersten•1h ago
It's interesting because there's a significant chance one wastes more time tinkering around with custom scripts than saving in the long run. See https://xkcd.com/1205/

For example. The "saves 5 seconds task that I do once a month" from the blog post. Hopefully the author did not spend more than 5 minutes writing said script and maintaining it, or they're losing time in the long run.

kelvinjps10•50m ago
I find that now with AI, you can make scripts very quickly, reducing the time to write them by a lot. There is still some time needed for prompting and testing but still.
pmontra•2h ago
I also have a radio script to play internet streams with mpv (?). Other random stuff

A password or token generator, simple or complicated random text.

Scripts to list, view and delete mail messages inside POP3 servers

n, to start Nautilus from terminal in the current directory.

lastpdf, to open the last file I printed as PDF.

lastdownload, to view the names of the n most recent files in the Downloads directory.

And many more but those are the ones that I use often and I remember without looking at ~/bin

oceanplexian•2h ago
It's weird how the circle of life progresses for a developer or whatever.

- When I was a fresh engineer I used a pretty vanilla shell environment

- When I got a year or two of experience, I wrote tons of scripts and bash aliases and had a 1k+ line .bashrc the same as OP

- Now, as a more tenured engineer (15 years of experience), I basically just want a vanilla shell with zero distractions, aliases or scripts and use native UNIX implementations. If it's more complicated than that, I'll code it in Python or Go.

D13Fd•1h ago
I would still call my Python scripts “scripts.” I don’t think the term “scripts” is limited to shell scripts.
trenchpilgrim•1h ago
When I had one nix computer, I wanted to customize it heavily.

Now I have many

nix computers and I want them consistent and with only the most necessary packages installed.
ozim•12m ago
Besides many nix computers I also have wife, dog, children, chores, shopping to be done. Unlike when I was young engineer I could stay all night fiddling with bash scripts and environments.
nonethewiser•1h ago
On the other hand, the author seems to have a lot of experience as well.

Personally I tend to agree... there is a very small subset of things I find worth aliasing. I have a very small amount and probably only use half of them regularly. Frankly I wonder how my use case is so different.

edit: In the case of the author I guess he's probably wants to live in the terminal full time. And perhaps offline. there is a lot of static data he's stored like http status codes: https://codeberg.org/EvanHahn/dotfiles/src/commit/843b9ee13d...

In my case i'd start typing it in my browser then just click something i've visited 100 times before. There is something to be said about reducing that redundant network call but I dont think it makes much practical difference and the mental mapping/discoverability of aliases isnt nothing.

jamesbelchamber•1h ago
I am going through a phase of working with younger engineers who have many dotfiles, and I just think "Oh, yeh, I remember having lots of dotfiles. What a hassle that was."

Nowadays I just try to be quite selective with my tooling and learn to change with it - "like water", so to speak.

(I say this with no shade to those who like maintaining their dotfiles - it takes all sorts :))

denimnerd42•1h ago
I prefer using kubectl than any other method so i have plenty of functions to help with that. I'd never consider using python or go for this although I do have plenty of python and go "scripts" on my path too.
planb•1h ago
Yeah - been there, done that, too. I feel like the time I gain from having a shortcut is often less that what I wound need to maintain it or to remember the real syntax when I'm on a machine where it's not available (which happens quite often in my case). I try to go with system defaults as much as possible nowadays.
eikenberry•1h ago
Prepare to swing back again. With nearly 30 years experience I find the shell to be the best integration point for so many things due to its ability to adapt to whatever is needed and its universal availability. My use of a vanilla shell has been reduced to scripting cases only.
fragmede•1h ago
If you come through the other side, you set up LocalCommand in your .ssh/config which copies your config to every server you ssh to, and get your setup everywhere.
grimgrin•57m ago
this is how it works for you

as a person who loves their computer, my ~/bin is full. i definitely (not that you said this) do not think "everything i do has to be possible on every computer i am ever shelled into"

being a person on a computer for decades, i have tuned how i want to do things that are incredibly common for me

though perhaps you're referring to work and not hobby/life

stronglikedan•51m ago
Different strokes for different folks - tenured engineers just settle into whatever works best for them.
chis•51m ago
I think it's more likely to say that this comes from a place of laziness than some enlightened peak. (I say this as someone who does the same, and is lazy).

When I watch the work of coworkers or friends who have gone these rabbit holes of customization I always learn some interesting new tools to use - lately I've added atuin, fzf, and a few others to my linux install

heyitsguay•20m ago
I went through a similar cycle. Going back to simplicity wasn't about laziness for me, it was because i started working across a bunch more systems and didn't want to do my whole custom setup on all of them, especially ephemeral stuff like containers allocated on a cluster for a single job. So rather than using my fancy setup sometimes and fumbling through the defaults at other times, i just got used to operating more efficiently with the defaults.
vunderba•2h ago
Nice. I have a bash script similar to the one listed "removeexif" called prep_for_web which takes any image file (PNG, BMP, JPG, WebP), scrubs EXIF data, checks for transparency and then compresses it to either JPG using MozJPEG or to PNG using PNGQuant.

[1] https://github.com/mozilla/mozjpeg

[2] https://pngquant.org

SoftTalker•2h ago
Some cool things here but in general I like to learn and use the standard utilities for most of this. Main reason is I hop in and out of a lot of different systems and my personal aliases and scripts are not on most of them.

sed, awk, grep, and xargs along with standard utilities get you a long long way.

pinkmuffinere•1h ago
I totally agree with this, I end up working on many systems, and very few of them have all my creature comforts. At the same time, really good tools can stick around and become impactful enough to ship by default, or to be easily apt-get-able. I don't think a personal collection of scripts is the way, but maybe a well maintained package.
dannyobrien•1h ago
Historical note: getting hold of these scripts by chatting to various developers was the motivation for the original 2004 "lifehacks" talk[1][2]. If you ever get into an online argument over what is a "life hack" and what isn't, feel free to use short scripts like these as the canonical example.

Otherwise, I am happy to be pulled into your discussion, Marshall McLuhan style[3] to adjudicate, for a very reasonable fee.

[1] https://craphound.com/lifehacksetcon04.txt

[2] https://archive.org/details/Notcon2004DannyOBrienLifehacks

[3] https://www.openculture.com/2017/05/woody-allen-gets-marshal...

helicaltwine•1h ago
As a bonus, I prepend my custom aliases or scripts with my user name and hyphen (i.e helicaltwine-). It helps me recall rarely used scripts when I need them and forget the names.
headgasket•1h ago
if you use x0vnc (useful if you use a linux machine both from the attached screen and from vnc, and in a bunch of other scenarios), copy and paste to and fro the vnc client is not implemented, quite frustrating. here's 2 scripts that does that for you, I now use this all day. https://github.com/francoisp/clipshare
latexr•1h ago
> trash a.txt b.png moves `a.txt` and `b.png` to the trash. Supports macOS and Linux.

The way you’re doing it trashes files sequentially, meaning you hear the trashing sound once per file and ⌘Z in the Finder will only restore the last one. You can improve that (I did it for years) but consider just using the `trash` commands which ships with macOS. Doesn’t use the Finder, so no sound and no ⌘Z, but it’s fast, official, and still allows “Put Back”.

> jsonformat takes JSON at stdin and pretty-prints it to stdout.

Why prioritise node instead of jq? The latter is considerably less code and even comes preinstalled with macOS, now.

> uuid prints a v4 UUID. I use this about once a month.

Any reason to not simply use `uuidgen`, which ships with macOS and likely your Linux distro?

https://www.man7.org/linux/man-pages/man1/uuidgen.1.html

sedatk•7m ago
and it's `New-Guid` in PowerShell.
jrm4•1h ago
Broadly, I very much love this approach to things and wish it was more "acceptable?" It reminds me of the opposite of things like "the useless use of cat" which to me is one of the WORST meme-type-things in this space.

Like, it's okay -- even good -- for the tools to bend to the user and not the other way around.

yipbub•1h ago
I have mkcd exactly ( I wonder how many of us do, it's so obvious)

I have almost the same, but differently named with scratch(day), copy(xc), markdown quote(blockquote), murder, waitfor, tryna, etc.

I used to use telegram-send with a custom notification sounnd a lot for notifications from long-running scripts if I walked away from the laptop.

I used to have one called timespeak that would speak the time to me every hour or half hour.

I have go_clone that clones a repo into GOPATH which I use for organising even non-go projects long after putting go projects in GOPATH stopped being needed.

I liked writing one-offs, and I don't think it's premature optimization because I kept getting faster at it.

justusthane•1h ago
Obviously that script is more convenient, but if you’re on a system where you don’t have it, you can do the following instead:

    mkdir /some/dir    
    cd !$   
    (or cd <alt+.>)
WhyNotHugo•1h ago
> cpwd copies the current directory to the clipboard. Basically pwd | copy. I often use this when I’m in a directory and I want use that directory in another terminal tab; I copy it in one tab and cd to it in another. I use this once a day or so.

You can configure your shell to notify the terminal of directory changes, and then use your terminal’s “open new window” function (eg: ctrl+shift+n) to open a new window retaining the current directory.

yegle•1h ago
The markdownquote can be replaced by (at least in vim):

^ (jump to the beginning)

ctrl+v (block selection)

j (move cursor down)

shift+i (bulk insert?)

type ><space>

ESC

javier123454321•9m ago
:'<,'>s/.*$/> \0/ also
fragmede•1h ago
Where are the one letter aliases? My life got better after I alias k=kubectl
interestica•50m ago
Share yours!

I use this as a bookmarklet to grab the front page of the new york times (print edition). (You can also go back to any date up to like 2011)

I think they go out at like 4 am. So, day-of, note that it will fail if you're in that window before publishing.

    javascript:(()=>{let d=new Date(new Date().toLocaleString('en-US',{timeZone:'America/New_York'})),y=d.getFullYear(),m=('0'+(d.getMonth()+1)).slice(-2),g=('0'+d.getDate()).slice(-2);location.href=`https://static01.nyt.com/images/${y}/${m}/${g}/nytfrontpage/scan.pdf`})()
xiphias2•49m ago
An important advantage of aliases was not mentioned: I see everything in one place and can easily build aliases on top of other aliases without much thinking.

Anyways, my favourite alias that I use all the time is this:

    alias a='nvim ~/.zshrc && . ~/.zshrc'
It solves the ,,not loaded automatically'' part at least for the current terminal
munchlax•45m ago
mksh is already the MirBSD Korn SHell
o11c•42m ago
I keep meaning to generalize this (directory target, multiple sources, flags), but I get quite a bit of mileage out of this `unmv` script even as it is:

  #!/bin/sh
  if test "$#" != 2
  then
      echo 'Error: unmv must have exactly 2 arguments'
      exit 1
  fi
  exec mv "$2" "$1"
alentred•36m ago
> alphabet just prints the English alphabet in upper and lowercase. I use this surprisingly often (probably about once a month)

I genuinely wonder, why would anyone want to use this, often?

revicon•33m ago
I have a bunch of little scripts and aliases I've written over the years, but none are used more than these...

alias ..='cd ..'

alias ...='cd ../..'

alias ....='cd ../../..'

alias .....='cd ../../../..'

alias ......='cd ../../../../..'

alias .......='cd ../../../../../..'

Bishonen88•28m ago
up() { local d="" for ((i=1; i<=$1; i++)); do d="../$d" done cd "$d" }

up 2, up 3 etc.

vunderba•24m ago
Does zsh support this out-of-the-box? Because I definitely never had to setup any of these kinds of aliases but have been using this shorthand dot notation for years.
tacone•11m ago
I have setup a shortcut: alt+. to run cd.., it's pretty cool.

I also aliased - to run cd -

holyknight•21m ago
cool collection
sedatk•19m ago
> `rn` prints the current time and date using date and cal.

And you can type `rn -rf *` to see all timezones recursively. :)

javier123454321•14m ago
This is one area that I've found success in vibe coding with. Making scripts for repetitive tasks that are just above the complexity threshold where the math between automating and doing manually is not so clear. I have copilot generate the code for me and honestly I don't care too much of its quality, extensibility, and are easy enough to read through where I don't feel like my job is AI pr reviewer.

Willow quantum chip demonstrates verifiable quantum advantage on hardware

https://blog.google/technology/research/quantum-echoes-willow-verifiable-quantum-advantage/
294•AbhishekParmar•5h ago•139 comments

JMAP for Calendars, Contacts and Files Now in Stalwart

https://stalw.art/blog/jmap-collaboration/
136•StalwartLabs•3h ago•39 comments

Mass Assignment Vulnerability Exposes Max Verstappen Passport and F1 Drivers PII

https://ian.sh/fia
63•galnagli•2h ago•12 comments

HP SitePrint

https://www.hp.com/us-en/printers/site-print/layout-robot.html
113•gjvc•3h ago•72 comments

Scripts I wrote that I use all the time

https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/
220•speckx•5h ago•62 comments

Ovi

https://github.com/character-ai/Ovi
16•montyanderson•45m ago•1 comments

Meta is axing 600 roles across its AI division

https://www.theverge.com/news/804253/meta-ai-research-layoffs-fair-superintelligence
320•Lionga•3h ago•232 comments

Look, Another AI Browser

https://manuelmoreale.com/thoughts/look-another-ai-browser
148•v3am•3h ago•97 comments

Cryptographic Issues in Cloudflare's Circl FourQ Implementation (CVE-2025-8556)

https://www.botanica.software/blog/cryptographic-issues-in-cloudflares-circl-fourq-implementation
129•botanica_labs•6h ago•61 comments

MinIO stops distributing free Docker images

https://github.com/minio/minio/issues/21647#issuecomment-3418675115
586•LexSiga•14h ago•350 comments

André Gorz, the Theorist Who Predicted the Revolt Against Meaningless Work (2023)

https://znetwork.org/znetarticle/andre-gorz-was-the-theorist-who-predicted-the-revolt-against-mea...
25•robtherobber•6d ago•2 comments

Introducing Galaxy XR, the first Android XR headset

https://blog.google/products/android/samsung-galaxy-xr/
119•thelastgallon•3h ago•116 comments

Bild AI (YC W25) Is Hiring a Founding AI Engineer

https://www.ycombinator.com/companies/bild-ai/jobs/m2ilR5L-founding-engineer-applied-ai
1•rooppal•3h ago

Linux Capabilities Revisited

https://dfir.ch/posts/linux_capabilities/
146•Harvesterify•6h ago•28 comments

ROG Xbox Ally runs better on Linux than Windows it ships with – up to 32% faster

https://www.tomshardware.com/video-games/handheld-gaming/rog-xbox-ally-runs-better-on-linux-than-...
51•jrepinc•1h ago•15 comments

The Tonnetz

https://thetonnetz.com/
10•mci•4d ago•3 comments

Designing software for things that rot

https://drobinin.com/posts/designing-software-for-things-that-rot/
134•valzevul•22h ago•31 comments

AI assistants misrepresent news content 45% of the time

https://www.bbc.co.uk/mediacentre/2025/new-ebu-research-ai-assistants-news-content
355•sohkamyung•6h ago•252 comments

SourceFS: A 2h+ Android build becomes a 15m task with a virtual filesystem

https://www.source.dev/journal/sourcefs
103•cdesai•7h ago•41 comments

Show HN: Create interactive diagrams with pop-up content

https://vexlio.com/features/interactive-diagrams-with-popups/
21•ttd•5h ago•0 comments

Show HN: Cuq – Formal Verification of Rust GPU Kernels

https://github.com/neelsomani/cuq
3•nsomani•49m ago•1 comments

Internet's biggest annoyance: Cookie laws should target browsers, not websites

https://nednex.com/en/the-internets-biggest-annoyance-why-cookie-laws-should-target-browsers-not-...
461•SweetSoftPillow•8h ago•465 comments

Cyborgs vs. rooms, two visions for the future of computing

https://interconnected.org/home/2025/10/13/dichotomy
15•surprisetalk•3d ago•8 comments

42,600 ton ship to break the world record for the deepest drill at 7 miles

https://blog.bostonorganics.com/chinas-42600-ton-meng-xiang-aims-drill-7-miles-deep-breaking-reco...
34•speckx•2h ago•14 comments

Die shots of as many CPUs and other interesting chips as possible

https://commons.wikimedia.org/wiki/User:Birdman86
180•uticus•5d ago•35 comments

I See a Future in Jj

https://steveklabnik.com/writing/i-see-a-future-in-jj/
85•steveklabnik•3h ago•59 comments

Django 6.0 beta 1 released

https://www.djangoproject.com/weblog/2025/oct/22/django-60-beta-released/
14•webology•42m ago•3 comments

The Body Keeps the Score Is Bullshit

https://josepheverettwil.substack.com/p/the-body-keeps-the-score-is-bullshit
128•adityaathalye•1h ago•117 comments

The Logarithmic Time Perception Hypothesis

http://www.kafalas.com/Logtime.html
38•rzk•5h ago•18 comments

Patina: a Rust implementation of UEFI firmware

https://github.com/OpenDevicePartnership/patina
114•hasheddan•1w ago•17 comments