The Poetics of CLI Command Names
Recommended read: The Poetics of CLI Command Names https://smallstep.com/blog/the-poetics-of-cli-command-names/
The Poetics of CLI Command Names
Recommended read: The Poetics of CLI Command Names https://smallstep.com/blog/the-poetics-of-cli-command-names/
Generating Random Bytes On the Command Line with OpenSSL (1 mins read).
How to generate random bytes as binary, base64 or hex, using openssl
on the command-line.
linux - What is the difference between `sudoedit` and `sudo vim`? - Stack Overflow
Recommended read: linux - What is the difference between `sudoedit` and `sudo vim`? - Stack Overflow https://stackoverflow.com/questions/22084422/what-is-the-difference-between-sudoedit-and-sudo-vim/22084506#22084506
Generating the Client Assertion JWT for private_key_jwt
Authentication with Ruby (1 mins read).
A helper script to generate the client assertion required to authenticate to an Authorization Server that supports private_key_jwt
, on the command-line with Ruby.
Verifying Signed JWTs (JWS) with Ruby (2 mins read).
Using the ruby-jwt library to verify a signed JSON Web Token (JWS) on the command-line.
Creating Signed JWTs (JWS) with Ruby (1 mins read).
Using the json-jwt and ruby-jwt libraries to sign a JSON Web Token on the command-line.
Why You Should Write a CLI Tool for Your Organisation
Recommended read: Why You Should Write a CLI Tool for Your Organisation https://www.surminus.com/blog/why-you-should-write-a-cli-tool-for-your-org/
Is `sudo` almost useless? - Information Security Stack Exchange
Recommended read: Is `sudo` almost useless? - Information Security Stack Exchange https://security.stackexchange.com/questions/232924/is-sudo-almost-useless
How to Run Java on the Command-Line to Attach a Debugger (1 mins read).
How to run java
on the command-line, and make it possible to attach a debugger.
Anna Dodson and I had good fun a couple of years ago with https://github.com/veltman/clmystery and https://overthewire.org/wargames/
Converting Output from Rest Assured to Curl Requests (3 mins read).
How to convert the log output from Rest Assured to a curl
request.
How to convert a SVG to a PNG with ImageMagick? - Stack Overflow
Recommended read: How to convert a SVG to a PNG with ImageMagick? - Stack Overflow https://stackoverflow.com/questions/9853325/how-to-convert-a-svg-to-a-png-with-imagemagick#14174624
Take care editing bash scripts
Recommended read: Take care editing bash scripts https://thomask.sdf.org/blog/2019/11/09/take-care-editing-bash-scripts.html
Determining What Motherboard You're Using, On Linux (1 mins read).
How to determine what motherboard the machine you're using is reporting, on the command-line with Linux.
jq - my new favorite tool to work with json on the command line
Recommended read: jq - my new favorite tool to work with json on the command line https://200ok.ch/posts/jq-my-new-favorite-tool-to-work-with-json-on-the-command-line.html
Toggling Your Bluetooth Connection using bluetoothctl
on the Command-Line (1 mins read).
How to script bluetoothctl
to toggle your connection to a Bluetooth device.
Ignoring bulk change commits with git blame
Recommended read: Ignoring bulk change commits with git blame https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame
A great addition for those scripting with curl!
Recommended read: curl write-out JSON https://daniel.haxx.se/blog/2020/03/17/curl-write-out-json/
Splitting an X509 PEM-Encoded Certificate Bundle into Multiple Files (1 mins read).
Splitting a certificate bundle into separate files using split
or awk
.
The growth of command line options, 1979-Present
Recommended read: The growth of command line options, 1979-Present https://danluu.com/cli-complexity/
How to Use curl
to Send Requests to Domains Without Editing Your /etc/hosts
File (1 mins read).
Using curl
's --resolve
flag to perform custom lookup for hosts.
Triggering an AWS Lambda from the Command-Line (1 mins read).
How to invoke an AWS Lambda function from the Command-Line.
Generating HMAC Signatures on the Command Line with OpenSSL (1 mins read).
How to generate HMAC signatures for a given string, using openssl
.
Creating Signed JWTs (JWS) with Node.JS (1 mins read).
How to use the jsonwebtoken library to create a Signed JSON Web Token (JWS) with Node.JS.
AWS CLI v2 is now generally available
Recommended read: AWS CLI v2 is now generally available https://aws.amazon.com/blogs/developer/aws-cli-v2-is-now-generally-available/
Anybody can write good bash (with a little effort)
I used to write a lot of shell scripts before realising that what I was trying to do was treat shell scripting as a "full" scripting language (I won't define here what I mean by "full").
Its not - reach for a higher level scripting language like Ruby or Python when things are getting more complicated, and allow shell scripts to glue things together, or be for quick tasks maybe a few lines long.
When you do write them, this advice is great but it's definitely worth gaining understanding of when you should and shouldn't use them.
Recommended read: Anybody can write good bash (with a little effort) https://blog.yossarian.net/2020/01/23/Anybody-can-write-good-bash-with-a-little-effort
Big list of http static server one-liners
Recommended read: Big list of http static server one-liners https://gist.github.com/willurd/5720255
Parsing a Unix Epoch With Bash/Ruby on the Command-Line (1 mins read).
How to convert a Unix Epoch to a human-readable date format.
What You Probably Didn’t Know About Sudo
Very interesting to see that there's even more to the command than expected - and some great new features coming soon.
Recommended read: What You Probably Didn’t Know About Sudo https://aster.cloud/2019/12/17/what-you-probably-didnt-know-about-sudo/
Recommended read: A quick primer on dig https://mrkaran.dev/posts/dig-overview/
Pretty Printing XML on the Command-Line (1 mins read).
How to use xmllint
to pretty-print XML/HTML files.
List What Files Changed in a Git Commit (1 mins read).
How to list what files changed in a given commit.
Recommended read: Improving CLIs with isatty https://blog.jez.io/cli-tty/
Recommended read: Beware of shell globs https://soptik.tech/articles/beware-of-shell-globs.html
Using the OpenSSL Command-Line to Verify an SSL/TLS Connection (2 mins read).
How to use the openssl
command-line to verify whether certs are valid.
Pretty Printing YAML with the Ruby Command-Line (1 mins read).
Using Ruby's YAML
library to pretty-print YAML files from the command-line.
This is my go-to for tidying up disk space issues when working with Docker
Recommended read: Docker Cleanup Commands https://www.calazan.com/docker-cleanup-commands/
Piping Data When Not Running a Command with sudo
(1 mins read).
How to (more) safely pipe stdin
to an elevated command with sudo tee
.
Minifying JSON with Python (1 mins read).
How to take a pretty-printed JSON string and replace it with a minifed JSON string using Python.
Minifying JSON with Ruby (1 mins read).
How to take a pretty-printed JSON string and replace it with a minifed JSON string using Ruby.
Two shebang papercuts and a thimble
Recommended read: Two shebang papercuts and a thimble https://www.crystae.net/posts/2019/11/08/two-shebang-papercuts/
Analysing webservers logs locally with goaccess
Recommended read: Analysing webservers logs locally with goaccess https://ma.ttias.be/analysing-webservers-logs-locally-with-goaccess/
Safely Creating And Using Temporary Files
This is a great resource to highlight the difficulty of creating temporary files safely - something I've tried to share before but without these great examples.
Its especially bad if using a shared CI/CD server and putting downloaded files into /tmp as you don't know whether it'll be clobbered / stolen by others on the instance
Recommended read: Safely Creating And Using Temporary Files https://www.netmeister.org/blog/mktemp.html
Recommended read: Unnecessary use of `curl -X` https://daniel.haxx.se/blog/2015/09/11/unnecessary-use-of-curl-x/
A Linux sysadmin's guide to moving to a new website
Recommended read: A Linux sysadmin's guide to moving to a new website https://ma.ttias.be/sysadmin-guide-move-content-new-website/
Recommended read: Stupid UNIX Tricks https://sneak.berlin/20191011/stupid-unix-tricks/
Use the Unofficial Bash Strict Mode (Unless You Looove Debugging)
This is a great article about how to be safer when writing shell scripts. I am a huge proponent of not using them where possible, and instead moving them to another scripting language (Ruby, Python, Node) which you can test, and use a shared standard library.
Recommended read: Use the Unofficial Bash Strict Mode (Unless You Looove Debugging) http://redsymbol.net/articles/unofficial-bash-strict-mode/
Adding Newlines to all Files in Git (3 mins read).
Adding newlines at the end of all Git-tracked files.
Easily Parsing Failed Cucumber Scenarios from the JSON Report (2 mins read).
How to parse a Cucumber JSON report to display the failed scenarios and their causes.
Learn a little jq, awk and sed
This is a great post - I thoroughly recommend learning how to use common commandline tools such as awk
, grep
, sed
, but also adopting a scripting language for more complicated stuff. I don't mean Bash, or another shell scripting language, but something like Node, Python or Ruby, as it'll give you the opportunity for a greater standard library, as well as tonnes of packages built by others.
Recommended read: Learn a little jq, awk and sed https://letterstoanewdeveloper.com/2019/07/29/learn-a-little-jq-awk-and-sed/
Pretty Printing JSON Files Inline on the Command Line (2 mins read).
How to rewrite multiple JSON files inline on the Command Line.
Pretty Printing JSON Web Tokens (JWTs) on the Command Line using OpenSSL (3 mins read).
How to easily introspect a JWT on the command line using OpenSSL and optionally Python for real pretty-printing.
https://www.vidarholen.net/contents/blog/?p=746
In every programming language, there is a linting tool that can help pick up on some common style issues. ShellCheck isn't one of those - it's so much more!
I've been using it for many years now, and since it came into my life it's honestly changed the way I use shell scripts. There have been so many pitfalls that I've avoided falling into since learning about them (and adding ShellCheck to my Vim linting setup.
This is a great read from Vidar, the ShellCheck author, about a case where it could've caught issues that caused the deletion of a production database!
Recommended read: https://www.vidarholen.net/contents/blog/?p=746 https://www.vidarholen.net/contents/blog/?p=746
URL Decoding with Ruby on the Command Line (1 mins read).
How to use Ruby's standard library to decode URLs with a handy one-liner.
Viewing X.509 DER Certificate Fingerprints with OpenSSL (1 mins read).
How to view an X.509 DER certificate's fingerprint using openssl
commands.
Viewing X.509 PEM Certificate Fingerprints with OpenSSL (1 mins read).
How to view an X.509 PEM certificate's fingerprint using openssl
commands.
Verifying Signed JWTs (JWS) with Node.JS (3 mins read).
How to use the jsonwebtoken and node-jose libraries to verify the signature of a Signed JSON Web Token (JWS) with Node.JS.
Setting your default AWS profile for the AWS CLI and SDKs (2 mins read).
Setting the default AWS profile when working with multiple profiles and the AWS CLI / SDKs.
Viewing X.509 DER Certificate Details with OpenSSL (2 mins read).
How to convert an X.509 DER file to a human-readable format using openssl
commands.
Viewing X.509 PEM Certificate Details with OpenSSL (2 mins read).
How to convert an X.509 PEM file to a human-readable format using openssl
commands.
Safely Force Pushing with Git using --force-with-lease=ref
(6 mins read).
How git push --force-with-lease=ref
can save you from overriding others' changes on shared Git branches.
My editorial workflow for blog posts (8 mins read).
Taking you through the journey I go on when writing blog posts, from ideation to publishing the post.
Viewing Git history of a file in git log
while ignoring file renames (5 mins read).
How to track changes to files in Git without pesky file renames getting in the way, using git log --follow
.
Pretty Printing JSON Web Tokens (JWTs) on the Command Line using Ruby (3 mins read).
How to easily introspect and pretty print a signed JWT (JWS) or an encrypted JWT (JWE) on the command line using Ruby's standard library, or using the ruby-jwt external library.
Merging multiple repositories into a monorepo, while preserving history, using git subtree
(3 mins read).
How to merge multiple repositories, with their history, into a single repository, using the git subtree add
command.
Sharing Multiple SSH Sessions over the Same Network Socket (3 mins read).
Reusing network sockets for speed and reduction of authentication handshakes with OpenSSH.
Better Git Diff Outputs with Git Submodules (2 mins read).
How to get nicer diff
s when working with submodules.
Executing an Interactive Python Shell (REPL) for a Script (1 mins read).
Using python -i
to get an interactive REPL after running a Python source file.
SSLError
When Running Berkshelf Behind a Proxy (2 mins read).
Getting around the pesky OpenSSL::SSL::SSLError SSLv2/v3 read server hello A
error when running Berkshelf behind a proxy.
Converting YAML to JSON and vice versa (Part 1 - Ruby) (2 mins read).
Coerce YAML to JSON and vice versa, from the comfort of your Gem-studded command line.
glances, a top
and htop
replacement (1 mins read).
I share the tool I have been using for system utilisation and monitoring, glances
.