Live data from Hacker News

Start all of your commands with a comma (2009)

rhodesmill.org

101–110 of 252 posts

Re: Start all of your commands with a comma (2009)

#101
post #75

I prefer all my custom commands as 1 letter. On my most frequently used machine/dev env this means - e for vim m for mise n for pnpm c for Claude x for codex

r for uv run

j for just

I use fish abbreviations for this, as they expand to the full command in the shell history.

Re: Start all of your commands with a comma (2009)

#102
post #52

I didn't like the idea. I prefer the alternative approach: _I_ decide the order of dirs in the PATH env. If I introduce an executable with a name, that overrides a system one - I probably do that intentionally. If I introduce an alias (like `grep='grep --binary-files=without-match --ignore-case --color=auto`) that matches the name of a system binary - I probably do that intentionally. And if I EVER need to call grep…

Just on your first suggestion, this also means that if a person or process can drop a file (unknown to you) into your ~/bin/ then they can wreak havoc. Eg they can override `sudo` to capture your password, or override `rm` to send your files somewhere interesting, and so on. Btw on the second suggestion, I think there's a command named `command` that can help with that sort of thing, avoids recursive pitfalls.

The issue of rootless malicious command overrides is solved by typing the whole path, such as "/bin/sudo".

Re: Start all of your commands with a comma (2009)

#103

I didn't like the idea. I prefer the alternative approach: _I_ decide the order of dirs in the PATH env. If I introduce an executable with a name, that overrides a system one - I probably do that intentionally. If I introduce an alias (like `grep='grep --binary-files=without-match --ignore-case --color=auto`) that matches the name of a system binary - I probably do that intentionally. And if I EVER need to call grep…

I do the same thing, but I also have a command that shows me what functions or scripts might be shadowing other scripts

Care to share?

Re: Start all of your commands with a comma (2009)

#104
post #96
post #27

Why so many people use ~/bin/? What’s wrong with ~/.local/bin?

Personally I use ~/opt/ /bin where ~/opt is a ‘one stop shop’ containing various things, including a symlink to ~/local and directories or symlinks for things that don't play well with others (e.g. cargo, go), and an ~/opt/prefer/bin that goes at the start of PATH containing symlinks to resolve naming conflicts. (Anything that modifies standard behaviour is not in PATH, but instead a shell function present only in in…

What's the difference between opt and local?

I thought was for mixin externally provided systems like Homebrew, local is for machine or org-level customizations, and ~ is for user-level customizations.

Re: Start all of your commands with a comma (2009)

#106
post #87

Earlier quoted context omitted.

Underscore requires pressing Shift, however. > I don't like the idea of a punctuation prefix as punctuation usually has a specific meaning somewhere and including it as the first character in a filename looks wrong. So you don’t use dotfiles? ;)

Well dotfiles demonstrate that punctuation can have a special meaning in filenames. I'm not convinced by "quicker to type" arguments as that's rarely the bottleneck, so I'm perfectly happy with using underscores in filenames and variables. I wouldn't use underscore as the beginning character of a filename unless it had a specific meaning to me (e.g. temporary files), so I'd be more inclined to use a two or three char…

For me it’s not about quickness, but about strain. Like in RSI.

Re: Start all of your commands with a comma (2009)

#107

Tangentially related. Don't ever put "." in your PATH. I used to do this to avoid typing the "./" to execute something in my current directory. BAD IDEA. It can turn a typo into a fork bomb. I took down a production server trying to save typing two characters.

lol. What a beautiful footgun — for such a tiny optimization.

Re: Start all of your commands with a comma (2009)

#108
This has been a popular topic nearly every time the post makes the HN front page.

* https://news.ycombinator.com/item?id=40769362 (2024, 169 comments)

* https://news.ycombinator.com/item?id=31846902 (2022, 123 comments)

* https://news.ycombinator.com/item?id=22778988 (2020, 90 comments)

Re: Start all of your commands with a comma (2009)

#110
post #27

Why so many people use ~/bin/? What’s wrong with ~/.local/bin?

I personally use both, each for different purposes.

I snapshot my entire home directory every hour (using btrfs+snapper), but I exclude ~/.local/ from the snapshots. So I use ~/.local/bin/ for third-party binaries, since there's no reason to back those up; and ~/bin/ for scripts that I wrote myself, since I definitely want to back those up.

This is a pretty idiosyncratic use though, so I'd be surprised if many other people treated both directories this way.

Post reply on HN