Skip to content

Instantly share code, notes, and snippets.

View sergiitk's full-sized avatar
🚀
Back to work

Sergii Tkachenko sergiitk

🚀
Back to work
View GitHub Profile
@sergiitk
sergiitk / shell-tools.md
Last active January 5, 2025 12:29
Useful shell tools

Useful shell tools (BSD)

Strings

  • l | tail +2 — Skip first line of stdout
  • l | head -n-1 — Skip last line of stdout (GNU version only)
  • echo "test" | head -c-1 — Remove last newline
  • comm -12 <(echo 1; echo 2) <(echo 1; echo 2; echo 3) — Shows intersection (here 1 2).
  • cat template.txt | envsubst — substitutes environment variables in file
  • echo 123abc | od -c -t d1 — Show decimal dump
  • echo 123abc | xxd — Show a hexdump (or do the reverse)