{"id":13593716,"url":"https://github.com/skx/sysbox","last_synced_at":"2025-05-16T19:08:01.648Z","repository":{"id":39181679,"uuid":"251225851","full_name":"skx/sysbox","owner":"skx","description":"sysadmin/scripting utilities, distributed as a single binary","archived":false,"fork":false,"pushed_at":"2024-11-23T12:32:00.000Z","size":468,"stargazers_count":269,"open_issues_count":0,"forks_count":19,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-12T18:51:50.119Z","etag":null,"topics":["busybox","cli","golang","scripting","sysadmin","sysadmin-scripts","sysadmin-tool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"skx","custom":"https://steve.fi/donate/"}},"created_at":"2020-03-30T06:56:24.000Z","updated_at":"2025-04-08T03:52:17.000Z","dependencies_parsed_at":"2024-12-04T04:02:32.361Z","dependency_job_id":null,"html_url":"https://github.com/skx/sysbox","commit_stats":{"total_commits":175,"total_committers":4,"mean_commits":43.75,"dds":0.02857142857142858,"last_synced_commit":"4217f43e3c24f664e3bf305221ecd58afcc30d29"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsysbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsysbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsysbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fsysbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skx","download_url":"https://codeload.github.com/skx/sysbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254592395,"owners_count":22097013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["busybox","cli","golang","scripting","sysadmin","sysadmin-scripts","sysadmin-tool"],"created_at":"2024-08-01T16:01:23.543Z","updated_at":"2025-05-16T19:08:01.624Z","avatar_url":"https://github.com/skx.png","language":"Go","readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/skx/sysbox)](https://goreportcard.com/report/github.com/skx/sysbox)\n[![license](https://img.shields.io/github/license/skx/sysbox.svg)](https://github.com/skx/sysbox/blob/master/LICENSE)\n[![Release](https://img.shields.io/github/release/skx/sysbox.svg)](https://github.com/skx/sysbox/releases/latest)\n\n\n* [SysBox](#sysbox)\n  * [Installation](#installation)\n  * [Bash Completion](#bash-completion)\n* [Overview](#overview)\n* [Tools](#tools)\n* [Future Additions?](#future-additions)\n* [Github Setup](#github-setup)\n\n\n\n\n# SysBox\n\nThis repository is the spiritual successor to my previous [sysadmin-utils repository](https://github.com/skx/sysadmin-util)\n\nThe idea here is to collect simple utilities and package them as a single binary, written in go, in a similar fashion to the `busybox` utility.\n\n\n\n## Installation\n\nInstallation upon a system which already contains a go-compiler should be as simple as:\n\n```\n$ go install github.com/skx/sysbox@latest\n```\n\nIf you've cloned [this repository](https://github.com/skx/sysbox) then the following will suffice:\n\n```\n$ go build .\n$ go install .\n```\n\nFinally may find binary releases for various systems upon our [download page](https://github.com/skx/sysbox/releases).\n\n\n\n## Bash Completion\n\nThe [subcommand library](https://github.com/skx/subcommands) this application uses has integrated support for the generation of a completion script for the bash shell.\n\nTo enable this add the following to your bash configuration-file:\n\n```\nsource \u003c(sysbox bash-completion)\n\n```\n\n\n\n\n# Overview\n\nThis application is built, and distributed, as a single-binary named `sysbox`, which implements a number of sub-commands.\n\nYou can either run the tools individually, taking advantage of the [bash completion](#bash-completion) support to complete the subcommands and their arguments:\n\n    $ sysbox foo ..\n    $ sysbox bar ..\n\nOr you can create symlinks to allow specific tool to be executed without the need to specify a subcommand:\n\n    $ ln -s $(which sysbox) /usr/local/bin/calc\n    $ /usr/local/bin/calc '3 * 3'\n    9\n\n\n\n\n# Tools\n\nThe tools in this repository started out as being simple ports of the tools in my [previous repository](https://github.com/skx/sysadmin-util), however I've now started to expand them and fold in things I've used/created in the past.\n\nYou can view a summary of the available subcommands via:\n\n    $ sysbox help\n\nMore complete help for each command should be available like so:\n\n    $ sysbox help sub-command\n\nExamples are included where useful.\n\n\n\n## calc\n\nA simple calculator, which understands floating point-operations, unlike `expr`, and has some simple line-editing facilities built into its REPL-mode.\n\nThe calculator supports either execution of sums via via the command-line, or as an interactive REPL environment:\n\n```\n$ sysbox calc 3.1 + 2.7\n5.8\n\n$ sysbox calc\ncalc\u003e let a = 1/3\n0.333333\ncalc\u003e result * 9\n3\ncalc\u003e result * 9\n27\ncalc\u003e exit\n$\n```\n\nHere you see the magic variable `result` is always updated to store the value of the previous calculation.\n\n\n\n## choose-file\n\nThis subcommand presents a console-based UI to select a file.  The file selected will be displayed upon STDOUT.  The list may be filtered via an input-field.\n\nUseful for launching videos, emulators, etc:\n\n* `sysbox choose-file -execute=\"xine -g --no-logo --no-splash -V=40 {}\" ~/Videos`\n  * Choose a file, and execute `xine` with that filename as one of the arguments.\n* `xine $(sysbox choose-file ~/Videos)`\n  * Use the STDOUT result to launch instead.\n\nThe first form is preferred, because if the selection is canceled nothing happens.  In the second-case `xine` would be launched with no argument.\n\n\n\n## choose-stdin\n\nAlmost identical to `choose-file`, but instead of allowing the user to choose from a filename it allows choosing from the contents read on STDIN.  For example you might allow choosing a directory:\n\n```\n$ find ~/Repos -type d | sysbox choose-stdin -execute=\"firefox {}\"\n```\n\n\n\n## chronic\n\nThe chronic command is ideally suited to wrap cronjobs, it runs the command you specify as a child process and hides the output produced __unless__ that process exits with a non-zero exit-code.\n\n\n\n## comments\n\nThis is a simple utility which outputs the comments found in the files named upon the command-line.  Supported comments include C-style single-line comments (prefixed with `//`), C++-style multi-line comments (between `/*` and `*/`), and shell-style comments prefixed with `#`.\n\nUsed for submitting pull-requests to projects about typos - as discussed [here upon my blog](https://blog.steve.fi/i_m_a_bit_of_a_git__hacker__.html).\n\n\n\n## collapse\n\nThis is a simple tool which will read STDIN, and output the content without any extra white-space:\n\n* Leading/Trailing white-space will be removed from every line.\n* Empty lines will be skipped entirely.\n\n\n\n## cpp\n\nSomething _like_ the C preprocessor, but supporting only the ability to include files, and run commands via `#include` and `#execute` respectively:\n\n    #include \"file/goes/here\"\n    #execute ls -l | wc -l\n\nSee also `env-template` which allows more flexibility in running commands, and including files (or parts of files) via templates.\n\n\n\n## env-template\n\nPerform expansion of golang `text/template` files, with support for getting environmental variables, running commands, and reading other files.\n\nYou can freely use any of the available golang template facilities, for example please see the sample template here [cmd_env_template.tmpl](cmd_env_template.tmpl), and the the examples included in the [text/template documentation](https://golang.org/pkg/text/template/).\n\n\u003e As an alternative you can consider the `envsubst` binary contained in your system's `gettext{-base}` package.\n\n**NOTE**: This sub-command also allows file-inclusion, in three different ways:\n\n* Including files literally.\n* Including lines from a file which match a particular regular expression.\n* Including the region from a file which is bounded by two regular expressions.\n\nSee `sysbox help env-template` for further details, and examples.  You'll also\nsee it is possible to execute arbitrary commands and read their output.  This facility was inspired by the [embedmd](https://github.com/campoy/embedmd) utility, and added in [#17](https://github.com/skx/sysbox/issues/17).\n\nSee also `cpp` for a less flexible alternative which is useful for mere file inclusion and command-execution.\n\n\n\n## exec-stdin\n\nRead STDIN, and allow running a command for each line.  You can refer to\nthe line read either completely, or by fields.\n\nFor example:\n\n```\n$ ps -ef | sysbox exec-stdin echo field1:{1} field2:{2} line:{}\n```\n\nSee the usage-information for more details (`sysbox help exec-stdin`), but consider this a simple union of `awk`, `xargs`, and GNU parallel (since we can run multiple commands in parallel).\n\n\n\n## expect\n\nexpect allows you to spawn a process, and send input in response to given output read from that process.  It can be used to perform simple scripting operations against remote routers, etc.\n\nFor examples please consult the output of `sysbox help expect`, but a simple example would be the following, which uses telnet to connect to a remote host and run a couple of commands.  Note that we use `\\r\\n` explicitly, due to telnet being in use, and that there is no password-authentication required in this example:\n\n```sh\n    $ cat script.in\n    SPAWN telnet telehack.com\n    EXPECT \\n\\.\n    SEND   date\\r\\n\n    EXPECT \\n\\.\n    SEND   quit\\r\\n\n\n    $ sysbox expect script.in\n```\n\n\n\n## feeds\n\nThe feeds sub-command retrieves the contents of the (single) remote URL which is specified, and outputs a list of all the RSS/Atom feeds which have been referenced within that file.\n\nBasic usage would be:\n\n    $ sysbox feeds https://blog.steve.fi/\n\nIf no protocol is specified \"https\" is assumed, (for example an argument of \"example.com\" will be converted to https://example.com).\n\n\n\n## find\n\nThe find sub-command allows finding files/directories that match a given number\nof regular expressions.  Basic usage is:\n\n    $ sysbox find foo bar$\n\nBy default the names of files are shown, but you can view either files, directories, or both.  The starting point will be the current working directory, but `-path` can be used to change that:\n\n    $ sysbox find -path /etc -files=true -directories=true '(i?)magic'\n    /etc/ImageMagick-6/magic.xml\n    /etc/magic\n    /etc/magic.mime\n    /etc/sane.d/magicolor.conf\n\n\n\n## fingerd\n\nA trivial finger-server.\n\n\n\n## html2text\n\nA simple tool for converting from HTML to Text, added when I realized I'd\nconnected to a system over `ssh` and there were no console viewers installed,\n(such as `lynx`, `links`, or `w3m`).\n\n\n\n## httpd\n\nA simple HTTP-server.  Allows serving to localhost, or to the local LAN.\n\n\n\n## http-get\n\nVery much \"curl-lite\", allows you to fetch the contents of a remote URL.  SSL errors, etc, are handled, but only minimal options are supported.\n\nBasic usage would be:\n\n    $ sysbox http-get https://example.com/\n\nIf no protocol is specified \"https\" is assumed, (for example an argument of \"example.com\" will be converted to https://example.com).\n\n\n\n## ips\n\nThis tool lets you easily retrieve a list of local, or global, IPv4 and\nIPv6 addresses present upon your local host.  This is a little simpler\nthan trying to parse `ip -4 addr list`, although that is also the\ncommon approach.\n\n\n\n## markdown-toc\n\nThis tool creates a simple Markdown table-of-contents, which is useful\nfor the `README.md` files as used on github.\n\n\n\n## make-password\n\nThis tool generates a single random password each time it is executed, it is designed to be quick and simple to use, rather than endlessly configurable.\n\n\n\n## rss\n\nShow a summary of the contents of the given RSS feed.  By default the links to the individual entries are shown, but it is possible to use a format-string to show more.\n\n\n\n## run-directory\n\nRun every executable in the given directory, optionally terminate if any command returns a non-zero exit-code.\n\n\u003e The exit-code handling is what inspired this addition; the Debian version of `run-parts` supports this, but the CentOS version does not.\n\n\n\n## splay\n\nThis tool allows sleeping for a random amount of time.  This solves the problem when you have a hundred servers all running a task at the same time, triggered by `cron`, and you don't want to overwhelm a central resource that they each consume.\n\n\n\n## ssl-expiry\n\nA simple utility to report upon the number of hours, and days, until a given TLS certificate (or any intermediary in the chain) expires.\n\nIdeal for https-servers, but also TLS-protected SMTP hosts, etc.\n\n\n\n## timeout\n\nRun a command, but kill it after the given number of seconds.  The command is executed with a PTY so you can run interactive things such as `top`, `mutt`, etc.\n\n\n\n## todo\n\nA command to look for TODO items which contain dates in the past, the idea\nbeing that you can record notes for yourself, along with deadlines, in your\ncode.  Later you can see which deadlines have been exceeded.\n\n\n\n## tree\n\nTrivial command to display the contents of a filesystem, as a nested tree.  This is similar to the standard `tree` command, without the nesting and ASCII graphics.\n\n\n\n## urls\n\nExtract URLs from the named files, or STDIN.  URLs are parsed naively with a simple regular expression and only `http` and `https` schemes are recognized.\n\n\n\n## validate-json\n\nValidate JSON files for correctness and syntax-errors.\n\n\n\n## validate-xml\n\nValidate XML files for correctness and syntax-errors.\n\n\n\n## version\n\nReport the version of the binary, when downloaded from our [release page](https://github.com/skx/sysbox/releases).\n\n\n\n## validate-yaml\n\nValidate YAML files for correctness and syntax-errors.\n\n\n\n## watch\n\nExecute the same command constantly, with a small delay.  Useful to observe a command-completing.\n\n\n\n## with-lock\n\nAllow running a command with a lock-file to prevent parallel executions.\n\nThis is perfect if you fear your cron-jobs will start slowing down and overlapping executions will cause problems.\n\n\n\n\n# Future Additions?\n\nUnlike the previous repository I'm much happier to allow submissions of new utilities, or sub-commands, in this repository.\n\n\n\n\n# Github Setup\n\nThis repository is configured to run tests upon every commit, and when\npull-requests are created/updated.  The testing is carried out via\n[.github/run-tests.sh](.github/run-tests.sh) which is used by the\n[github-action-tester](https://github.com/skx/github-action-tester) action.\n\nReleases are automated in a similar fashion via [.github/build](.github/build),\nand the [github-action-publish-binaries](https://github.com/skx/github-action-publish-binaries) action.\n\nSteve\n--\n","funding_links":["https://github.com/sponsors/skx","https://steve.fi/donate/"],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskx%2Fsysbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskx%2Fsysbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskx%2Fsysbox/lists"}