News for hackers. Stuff that matters.
Re:Show HN: Interactive systemd (a better way to work with s... by IgorPartola on Saturday January 18, 2025 @04:19PM (#42751505)
When it comes to starting and stopping services I want the verb to go last. Way easier to press up, backspace backspace backspace o p to change service ssh start to service ssh top. This is a frequent pattern I follow as I start/stop/restart/reload. Having to go back at least one word adds keystrokes that aren’t necessary.
Re:Show HN: Interactive systemd (a better way to work with s... by brontitall on Saturday January 18, 2025 @04:32PM (#42751590)
Doing it the way it does allows specifying multiple services.

systemctl status myapp mydb

Re:Show HN: Interactive systemd (a better way to work with s... by IgorPartola on Saturday January 18, 2025 @07:36PM (#42752625)
I would rather do that as two commands than to scroll to see the output of each.
Re:Show HN: Interactive systemd (a better way to work with s... by okanat on Saturday January 18, 2025 @08:48PM (#42752922)
There is no output for success.
Re:Show HN: Interactive systemd (a better way to work with s... by BikiniPrince on Saturday January 18, 2025 @09:45PM (#42753161)
Only failure is rewarded!
Re:Show HN: Interactive systemd (a better way to work with s... by egberts1 on Sunday January 19, 2025 @05:57AM (#42755942)
NOBODY ask for a status of two services.

Hence the verb-last CLI rulez!

Re:Show HN: Interactive systemd (a better way to work with s... by autoexec on Saturday January 18, 2025 @05:32PM (#42751946)
Why not allow for both and accept the option at any location?

Something like:

systemctl --stop myapp mydb

systemctl myapp mydb --stop

Re:Show HN: Interactive systemd (a better way to work with s... by bronson on Saturday January 18, 2025 @05:48PM (#42752050)
unnecessary flexibility brings unnecessary bugs
Re:Show HN: Interactive systemd (a better way to work with s... by Ayesh on Saturday January 18, 2025 @09:31PM (#42753104)
All `--` strings should be "options". Starting/stopping a service is not an option, it's a command. I don't enjoy `pacman` for this very reason.
Re:Show HN: Interactive systemd (a better way to work with s... by johnchristopher on Saturday January 18, 2025 @05:59PM (#42752114)
Do you use your space bar to handle heating ?
Re:Show HN: Interactive systemd (a better way to work with s... by IgorPartola on Sunday January 19, 2025 @10:23AM (#42757765)
What do you mean?
Re:Show HN: Interactive systemd (a better way to work with s... by johnchristopher on Sunday January 19, 2025 @11:23AM (#42758409)
It's a reference to an XKCD comic https://xkcd.com/1172/ that pokes fun at users with strong attachments to some software behaviours and/or interfaces.

Also, it looks like you are one of today's lucky 10,000 ! https://xkcd.com/1053/

Re:Show HN: Interactive systemd (a better way to work with s... by IgorPartola on Tuesday January 21, 2025 @09:48AM (#42780675)
Haha excellent! Thank you!
Re:Show HN: Interactive systemd (a better way to work with s... by kjellsbells on Saturday January 18, 2025 @05:33PM (#42751961)
I agree, but here's a handy Bashism:

^art^op

Converts the "start" in "foo start bar" to "stop", ie runs "foo stop bar". Append :p to do the substitution but print the command instead of running it.

Re:Show HN: Interactive systemd (a better way to work with s... by IgorPartola on Saturday January 18, 2025 @07:36PM (#42752628)
Learn something new every day. What is the ^ representing in this case?
Re:Show HN: Interactive systemd (a better way to work with s... by kjellsbells on Saturday January 18, 2025 @09:46PM (#42753168)
Caret is a word designator in bash's history scheme. Here it acts as a way to mark the thing with the thing being replaced. There's a more detailed explanation in [1] and a quick read in [2]. Essentially bash let's you do manipulation and re-execution of commands from your history and one of the manipulations is via word substitution.

[1] https://www.gnu.org/software/bash/manual/html_node/Word-Desi...

[2] https://www.johndcook.com/blog/2022/10/21/shell-replace-word...

Re:Show HN: Interactive systemd (a better way to work with s... by emmelaich on Saturday January 18, 2025 @05:55PM (#42752091)
It actually should be possible to switch them around. No-ones going to call their service 'stop' or 'service' right?
Re:Show HN: Interactive systemd (a better way to work with s... by Ayesh on Saturday January 18, 2025 @09:32PM (#42753108)
Someone should create a set of systemd units that show something funny when entered, like how `sl` does for `ls`.
Re:Show HN: Interactive systemd (a better way to work with s... by gf000 on Saturday January 18, 2025 @05:02PM (#42751777)
Press alt+B twice?
Re:Show HN: Interactive systemd (a better way to work with s... by smallmancontrov on Saturday January 18, 2025 @05:11PM (#42751817)
Alt + Bikeshed?

(Kidding aside, quick reminder that on Mac you have to enable Settings>Profiles>Keyboard>Use Option as Meta key, or else Alt doesn't work)

Re:Show HN: Interactive systemd (a better way to work with s... by noumuon on Sunday January 19, 2025 @07:54AM (#42756563)
Just use an alias. I don't understand why a problem with such a simple solution should cause such issues.
Re:Show HN: Interactive systemd (a better way to work with s... by zbentley on Sunday January 19, 2025 @08:48AM (#42756918)
Because I switch computers (often, for work), and what's muscle memory on one then becomes "command not found" on others without the alias. Many of those computers I don't control and can't say "well, everyone should just run my aliases".

Because I have to share commands with other people who are troubleshooting their own systems, and copy/paste from history becomes useless if I have specific aliases.

Because someday I or someone will want to script these interactions, and aliases are not available in subprocesses.

Re:Show HN: Interactive systemd (a better way to work with s... by lee_ars on Sunday January 19, 2025 @09:56AM (#42757527)
People are telling you why. You're just choosing to disregard their answers as insufficient. This is not a them-problem. It's a you-problem.