Skip to content

Instantly share code, notes, and snippets.

@olliefr
Last active August 22, 2022 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olliefr/756cf30e708186fa0701036d5f06e0d6 to your computer and use it in GitHub Desktop.
Save olliefr/756cf30e708186fa0701036d5f06e0d6 to your computer and use it in GitHub Desktop.
Awesome command line one-liners
# Generate a random password
openssl rand -base64 18
# Display total size of a single directory in human-readable format
du -csh /home/oliver/
# Display size of everything in a directory in human-readable format
du -csh /home/oliver/*
# Compare the output of two programs without having to save it into files first.
# Use subshells to execute the command pipelines individually, by enclosing the pipeline within parenthesis.
# Then prefix these with < to create anonymous named pipes which can be pass to diff.
diff <(snap find "python2") <(snap find "media player")
# Find my IP address
curl -s api.ipify.org
@olliefr
Copy link
Author

olliefr commented Jun 19, 2022

Collect all relevant PIDs and join with a ,

(ps -e -o pid,comm | grep gitkraken | cut -f2 -d ' ') | sed ':a; N; $!ba; s/\n/,/g'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment