7 ms·
Sysz – An fzf terminal UI for systemctl
- flitzofolov 5y agoLooks like a useful tool, thanks for sharing!
- bloopernova 5y agoI'm continually impressed at how many uses fzf has. Yet I still feel like we're only scratching the surface of its utility.
- ducktective 5y agoDid you know we can make unix tools (like jq) interactive (lik a REPL) using fzf? https://news.ycombinator.com/item?id=28577337 https://news.ycombinator.com/item?id=28577337 Checkout Daniel's other scripts: https://github.com/DanielFGray/fzf-scripts https://github.com/DanielFGray/fzf-scripts
- bloopernova 5y agoYes! I have that one in my ```~/.fzf.zsh```
- vcdimension 5y agoI use it for browsing documentation and code files, e.g. to browse syscall manpages: apropos -s 2 '.*' | fzf --height=100% --preview-window=down:wrap --preview='man -s 2 {1}' --bind='alt-v:execute(man -s 2 {1}),enter:execute(man -s 2 {1})' You can also use it with rlwrap for browsing commandline history of arbitrary REPLs (https://github.com/hanslub42/rlwrap/blob/fb60c9aa7579d6b68f2ea70bcf590818eba9b7c7/filters/handle_hotkeys.py https://github.com/hanslub42/rlwrap/blob/fb60c9aa7579d6b68f2...)
- zamadatix 5y agoDoes anyone know of a way or how to go about making a way to get <tab> and <tab><tab> to bash autocomplete "systemctl status " with service names? It seems like remembering where the service name has dashes, matches the package name, has a "d" at the end, and so on is half the battle for me when working with systemctl. This achieves something similar but it also does a whole lot more than just help complete the name. Edit: Helps to have bash-completion working properly for the user :).
- deleted 5y ago[deleted]
- isodude 5y agoDoes it suffice with systemd's bash completion? On debian it's bundled with systemd. systemd: /usr/share/bash-completion/completions/systemctl
- xyzzy_plugh 5y agoThis works for me out of the box. Your bash profile might not be sourcing systemd's /usr/share/bash-completion/completions/systemctl or equivalent path. This host has bash 4.4.23 and systemd 247.6
- zamadatix 5y agoThanks for the confirmation I cleaned a few things up and the user profile is now loading it properly and auto-completion works.
- jfrunyon 5y agoHonestly I don't understand why some distros still don't ship with completions for this sort of thing. Debian and Ubuntu have had this for the entire time they've been using systemd, as far as I recall. (And they've supported completion on other tools for even longer!)
- freedomben 5y agowhat distros don't? (honest question)
- jfrunyon 5y agoI'm not sure, to be quite honest. I know I've worked with a few systems in the last ~3.5 years that were missing completions that are present in Ubuntu 18.04, but I can't find any of them now. (It looks like the person I replied to had an issue with his own profile files rather than a distro issue.)
- Spivak 5y agoThe crazy thing about this is how simple the code is. _sysz_list_units | fzf \ --exact \ --multi \ --ansi \ --reverse \ --no-sort \ --history="$SYSZ_HISTORY" \ --prompt="Units: " \ --bind "ctrl-v:preview('${BASH_SOURCE[0]}' _fzf_cat {})" \ --preview="'${BASH_SOURCE[0]}' _fzf_preview {}" \ --preview-window=70% | readarray -t PICKS This is the whole UI. Just give it a list of things to search through, a prompt, and a command for previewing the thing and fzf handles literally all the rest of the UI for you.
- whalesalad 5y agoI have not heard of fzf - but anything that makes cli interactions with systemd is welcome by me. I love it as a tool - but it is kinda verbose with cli args.
- ripley12 5y agoIf you have trouble running this, try updating fzf. TIL that my package manager's version of fzf is 4 years old, and that did not play nicely with some of the features used by Sysz.
- deleted 5y ago[deleted]
- psacawa 5y agoWith fzf-tab [1], you can use fzf wherever your zsh completion is. Here is a screencast showing it[2]. [1] https://github.com/Aloxaf/fzf-tab https://github.com/Aloxaf/fzf-tab [2] https://asciinema.org/a/KhDMhtZ3J8ppO7B8L6jFSE1co https://asciinema.org/a/KhDMhtZ3J8ppO7B8L6jFSE1co
- sva_ 5y agoSeems nice but it gets slow with long lists. Should lazy-load
- jabo 5y agoOff-topic, but TIL about Unlicense License from this project’s license. Was wondering how it differed from MIT and found this interesting thread: https://softwareengineering.stackexchange.com/questions/147111/what-is-wrong-with-the-unlicense https://softwareengineering.stackexchange.com/questions/1471...
- dr_kiszonka 5y agoOff-topic: how do you call a prompt that looks like the one in the video? I'd like to have one in my fish terminal. (I tried installing an oh-my-fish theme with such a prompt, but it required Powerline fonts, which I can't get to work.)
- freedomben 5y agoCan anyone compare/contrast fzf and pick[1]? I use pick for all sorts of things, but especially as a replacement in vim for CtrlP. Wondering if I'm missing out on something :-) [1] https://github.com/mptre/pick https://github.com/mptre/pick
- joehillen 5y agoThis is the first I've heard of "pick", but it looks like it's missing a lot of the interactive features of fzf. Those features are what make fzf good for building UIs.
- seumars 5y agoI love fzf but somehow I can never find a way to naturally make it a part of my workflow.
- tcoff91 5y agoThe zag ctrl-r integration for fuzzy searching terminal history is amazing. Also you can do * and hit tab and use fzf to grab a file to use as a command line argument. Fzf is wonderful.
- petepete 5y agoMy biggest tip is to use the '**' shortcut from bash/zsh. My most frequent use case is for running tests, I can type: $ be rspec spec/**{tab} Fzf will open inline, select the file(s) you want and run them (like this https://asciinema.org/a/mYTmT908gvVxZTMAsfPxltULx https://asciinema.org/a/mYTmT908gvVxZTMAsfPxltULx) To get this to work I had to add this line to my .zshrc source /usr/share/zsh/site-functions/fzf
- epr 5y agoIf you don't have the globstar optional behavior enabled in bash this won't work. From the manual: If set, the pattern ‘*’ used in a filename expansion context will match all files and zero or more directories and subdirectories. If the pattern is followed by a ‘/’, only directories and subdirectories match. To enable: $ shopt -s globstar To disable: $ shopt -u globstar
- eliaspro 5y agoWhy does it use "sudo" in the first place when systemd uses PolicyKit for proper fine-grained/action-specific privilege acquisition out-of-the-box?
- quasarj 5y agoWait, does that mean I'm supposed to use systemctl without sudo, and just type my password when it prompts me?
- jordemort 5y agoIf PolicyKit is functioning correctly on your system, then yes. In my experience, though, a working PolicyKit is not something you can count on with server installs and minimal installs.
- michaelmrose 5y agoThis is a really interesting example of the virtue of small general tools that can be combined in useful ways. Kudos.
- pwdisswordfish8 5y ago> Runs sudo automatically and only if necessary So never? Because systemctl by default triggers a PolicyKit prompt when run without sufficient privileges. sudo is entirely unnecessary.
- franga2000 5y agoIs polkit a hard requirement? I seem to recall systems where sudo was always needed for systemd stuff. Polkit was either not installed or somehow disabled.
- pwdisswordfish8 5y agoNow that I looked, Debian lists it under ‘Suggests’, so apparently it’s not mandatory. Still, I get the impression it’s at least preferred.
- deleted 5y ago[deleted]
- BrightGlow 5y agoPolkit is compile-time optional in systemd, debian has it disabled by default.