Skip to content

Instantly share code, notes, and snippets.

@zedmatrix
zedmatrix / gist:f5b0d8d3e1ebc43485ca7a823a50c6b7
Created February 19, 2026 20:40
Some Quick Bash Functions
#!/bin/sh
## Quick untar and Change to directory
xtar() {
[ -z "$1" ] && { echo "Requires Package Name. Exiting."; return 1; }
local file="$1"
local dir
dir=$(tar -tf "$file" | head -1 | cut -d'/' -f1)
tar -xf "$file" || { echo "Tar extraction failed"; return 1; }
cd "$dir" || { echo "Failed to cd into $dir"; return 1; }