7 ms·
> I have to look up the very fiddly and unintuitive systemd commands all the time. service start? service.foo start? start foo.service? Oh right, sudo systemctl
by pkkm 2y ago
> I have to look up the very fiddly and unintuitive systemd commands all the time. service start? service.foo start? start foo.service? Oh right, sudo systemctl start service.foo
I don't get this complaint. It's the same order as almost every other command-line utility that has subcommands: <command> <subcommand> <thing to operate on>. To me, that kind of consistency is very intuitive.
systemctl stop my-service
systemctl status my-service
git add my-file
git remote remove upstream
apt install my-package
docker run my-container
adb push local-file remote-file
- kstrauser 2y agoFor me: * /etc/init.d/my-service stop and Ubuntu’s: * service my-service stop both lurk in my brain.
- pkkm 2y agoSure, it's different from the old way, but I don't think "unintuitive" is the right word for that. systemd forced people to change their habits so that it could be more intuitive. Of course, people are going to disagree about whether it was worth it - it's the age-old question about breaking backwards compatibility for the sake of minor improvement. Personally, I got used to it pretty quickly and I like it more than the old commands now.
- b112 2y agoYet, the "ease" of use is a joke. Every try to stop and start a service at different points? At points you choose? Have fun! Ah well, it's all been said before.
- kstrauser 2y agoYeah, I gave up resisting and I’m rolling with it. Ok, fine, this is the way now. And yet my fingers still want to type it the other way.
- ndom91 2y agoThe way I remember this is that the old way didn't allow for applying the verb to multiple units. Now you can "restart" multiple units, i.e. `systemctl restart nginx webapp`, etc.
- kstrauser 2y agoThanks. I'm going to use that to remember it now.
- ripitout 2y agoPlus, you could always write a quick shell script to swap the arguments if it detects this specific failure. Inability to remember or learn which commands expect which arguments is, at some point, not the responsibility of the software to fix. Unfortunately, this field does necessitate some amount of memorization and ability to problem-solve.
- godelski 2y agoI feel the same way. The big part for me is that it tells us that owyn doesn't use tab completion if they're forgetting about the ".service" part. Sure, I don't remember either, I don't have to. I'll add the abstraction for anyone confused program [command [subcommand]] [flags] [object] e.g.s systemctl status sshd.service systemctl enable --now sshd.service touch -c test.sh echo 'Hello World' echo "Hello ${USER}" Anything in brackets is optional and might not appear or be available. By command I mean a category of commands. Such as 'pip install' vs 'pip uninstall', which are sub-programs inside the main program. But this can have layers such as 'uv pip install'. Often flags can be used in any order because you'll just loop over all the arguments but this is still the standard order. There's also the two actor pattern program [command [subcommand]] [flags] source destination e.g.s cp /foo/bar/baz.txt "${HOME%/}/" scp -i "${HOME}/.ssh/foo" ${HOME}/to_upload.sh user@remote:~/ dd if=/dev/urandom of=/dev/diskToDestroy rsync /mnt/hdd1/ /mnt/hdd2/
- Macha 2y agoAlso the `.service` part is optional anyway for most commands (including the start, stop, restart etc. ones they use in their examples). Only commands that can operate on services and other non-service units require it.
- IgorPartola 2y agoWhen 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.
- brontitall 2y agoDoing it the way it does allows specifying multiple services. systemctl status myapp mydb
- autoexec 2y agoWhy not allow for both and accept the option at any location? Something like: systemctl --stop myapp mydb systemctl myapp mydb --stop
- IgorPartola 2y agoI would rather do that as two commands than to scroll to see the output of each.
- okanat 2y agoThere is no output for success.
- 2y ago
- frizlab 2y agoIt’s because service was the other way around, I’m sure.
- DHowett 2y agosystemd services are named "foo.service", and you do not need to specify the ".service" in almost any case.
- tremon 2y agoThey're referring to Debian's service(8) command. NAME service - run a System V init script SYNOPSIS service SCRIPT COMMAND [OPTIONS] (the manpage wasn't updated, but the same command also supports systemd services nowadays)
- OlympusMonds 2y agoIf I had to guess it's because of the 'service' command, which goes 'service foo start'. It took me ages to unlearn that pattern for using systemctl, even though as you say: it's far more consistent
- Ayesh 2y agoI think the previous post mentions the `service` command, which has `service foo start` pattern. I'm used to `service` command, so I have muscle memory which `systemd` breaks. The way `systemd` commands are laid out is better, it just messes with `service` command muscle memory.
- Mayzie 2y agoIt's been a decade at this point since the last big distro (and surrounding drama), Debian and Ubuntu following shortly after, moved to systemd.
- kijin 2y agoMany distros still provide the `service` command, and don't print any warnings when you use it. At best, you might get an informational message that the equivalent systemd command is being called. There is no recommendation to call the systemd command directly, or any sign of the `service` command being deprecated any time soon. As a result, a lot of people are probably still relying on their muscle memory for the `service` command.
- cassianoleal 2y agoI disagree that the way systemd is laid out is better. With initV, issuing many command in sequence to the same service (enable, then start… stop then start… etc) is much quicker and easier as it’s “up-arrow, control-W, type new command. With the systemd option I either need to navigate one word to the left (or more depending on how the shell is configured wrt word separation) before I replace the command, or I need to delete both the command and the service name, and retype more. It’s not a huge difference but small downgrades in ergonomics add up over time.
- egberts1 2y agoA huge typing pain. A backward step in intuitive CLI usage. We can be such a fuddy-duddy gray-beards.
- deleted 2y ago[deleted]
- gymbeaux 2y agoI on the other hand DO get this complaint. It’s less about the “word order” and more remembering the words to type. As a software engineer I have to google stuff all the time. I haven’t touched C#’s PLINQ in five years, I doubt I could do it from memory. Likewise, I can count on one hand the number of times I will set up a systemd service in a given year. Many (most?) of us are all over the place, expected to “wear many hats” and aren’t in a single IDE or language all day every day. Certainly if I were a “Linux admin” I would have systemd pretty committed to memory. Anyone else probably wouldn’t.
- ecef9-8c0f-4374 2y agosudo service my-service start sudo service my-service stop