Skip to content

About

One command, one job. Shell one-liners for Linux sysadmins, edge boxes, and bare metal.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

Repository files navigation

Awesome One-Liners Awesome

One command, one job. Battle-tested shell one-liners for Linux sysadmins, edge boxes, and bare metal. Curated by RoZel-RoSle (K2 King), NextNexus-Cyber maintainer and the producer behind The Mafia Kiss.

Contents

Networking and DHCP

  • Show active DHCP leases (ISC) - grep -E 'lease|hardware|client-hostname' /var/lib/dhcp/dhcpd.leases
  • Test dhcpd.conf before restart - dhcpd -t -cf /etc/dhcp/dhcpd.conf
  • Watch DHCP traffic live - sudo tcpdump -ni eth0 port 67 or port 68 -vv
  • List listening ports with process - ss -tulpn
  • Quick LAN host sweep - nmap -sn 192.168.1.0/24

PXE and Netboot

  • Confirm TFTP is serving - tftp 127.0.0.1 -c get pxelinux.0 && ls -l pxelinux.0
  • Watch netboot requests - sudo journalctl -fu tftpd-hpa
  • One-shot DHCP+TFTP with dnsmasq - sudo dnsmasq -d --port=0 --enable-tftp --tftp-root=/srv/tftp --dhcp-range=192.168.1.100,192.168.1.200 --dhcp-boot=pxelinux.0
  • Write a minimal PXELINUX menu (overwrites default) - printf 'DEFAULT linux\nLABEL linux\n KERNEL vmlinuz\n APPEND initrd=initrd ip=dhcp\n' | sudo tee /srv/tftp/pxelinux.cfg/default
  • Pull kernel and initrd out of a live ISO - 7z e -o/srv/tftp ubuntu.iso casper/vmlinuz casper/initrd
  • Watch raw TFTP requests - sudo tcpdump -ni eth0 udp port 69 -vv

Clustering

  • Pacemaker cluster status - sudo pcs status --full
  • Run a command on every node - for h in node1 node2 node3; do ssh "$h" uptime; done
  • Check corosync rings - sudo corosync-cfgtool -s
  • Single-node k3s server - curl -sfL https://get.k3s.io | sh -
  • Node join token on the server - sudo cat /var/lib/rancher/k3s/server/node-token
  • Join an edge worker - curl -sfL https://get.k3s.io | K3S_URL=https://10.0.0.1:6443 K3S_TOKEN=<node-token> sh -
  • Node readiness and load - sudo k3s kubectl get nodes -o wide && sudo k3s kubectl top nodes

Time Sync (PTP)

  • Check NIC hardware timestamping - ethtool -T eth0
  • Run PTP slave on an interface - sudo ptp4l -i eth0 -s -m
  • Sync system clock to PHC - sudo phc2sys -s eth0 -w -m

CAN Bus

  • Bring up a CAN interface at 500k - sudo ip link set can0 up type can bitrate 500000
  • Dump all frames - candump -tz can0
  • Send a test frame - cansend can0 123#DEADBEEF
  • Spin up a virtual CAN for testing - sudo modprobe vcan && sudo ip link add vcan0 type vcan && sudo ip link set vcan0 up

Disks and Files

  • Top 10 biggest dirs here - du -xh --max-depth=1 . | sort -rh | head -10
  • Find files over 1 GB - find / -xdev -type f -size +1G 2>/dev/null
  • Disk usage at a glance - df -hT -x tmpfs -x devtmpfs

Processes and Logs

  • Top 5 memory hogs - ps aux --sort=-%mem | head -6
  • Errors since boot - journalctl -b -p err --no-pager
  • Follow a service log - journalctl -fu nginx

Android and Andronix

  • Update everything in Termux - pkg update -y && pkg upgrade -y
  • Phone's IP inside Termux - ip -4 addr show wlan0 | grep inet
  • Serve the current folder over Wi-Fi - python3 -m http.server 8080
  • Distros you can install without root - proot-distro list
  • Install and enter Ubuntu - proot-distro install ubuntu && proot-distro login ubuntu
  • Phone storage inside the distro - proot-distro login ubuntu --shared-tmp --bind /sdcard:/mnt/sdcard
  • Keep servers alive when the screen sleeps - termux-wake-lock

More Lists

  • OSINT & Forensics - Domains, usernames, metadata, memory and mobile forensics.
  • CAN Bus - SocketCAN, DBC decoding, ISO-TP/UDS, ICSim.
  • Embedded - Serial, AVR, ESP32, STM32, OpenOCD, Rust, embedded Linux, Altera and open-source FPGA, sigrok.
  • Time & Watchdog - linuxptp, chrony PHC refclocks, NVIDIA PTP, and AMD watchdog timers.
  • NASA & Space - NASA/JPL APIs, F Prime, cFS, Open MCT.
  • Stack Check - Parallel status check for the Mobile Dev + OSINT stack. sh stack-check.sh shows failures only; -v lists everything with a count per status.

Quick Launcher (Termux + fzf)

Fuzzy-search every one-liner in these lists and drop your pick onto the prompt, ready to edit before you run it.

pkg install -y git fzf termux-api
git clone https://github.com/NextNexus-Cyber/awesome-one-liners ~/awesome-one-liners

Add to ~/.zshrc (or ~/.bashrc):

oneliner() {
  local dir="${ONELINER_DIR:-$HOME/awesome-one-liners}" picked cmd
  picked=$(
    awk -F ' - `' '/^- .* - `.*`$/ {
        f = FILENAME; sub(/^.*\//, "", f); sub(/\.md$/, "", f)
        printf "[%s] %s\t%s\n", f, substr($1, 3), substr($2, 1, length($2) - 1)
      }' "$dir"/*.md |
    fzf --delimiter='\t' --with-nth=1 --query="$*" \
        --preview='printf "%s\n" {2}' --preview-window=down:4:wrap \
        --prompt='one-liner > '
  ) || return
  cmd=${picked#*$'\t'}
  command -v termux-clipboard-set >/dev/null 2>&1 && printf '%s' "$cmd" | termux-clipboard-set
  if [ -n "$ZSH_VERSION" ] && [ -z "$ONELINER_PRINT" ]; then
    print -z -- "$cmd"
  else
    printf '%s\n' "$cmd"
  fi
}

if [ -n "$ZSH_VERSION" ]; then
  _oneliner_widget() {
    local cmd
    cmd=$(ONELINER_PRINT=1 oneliner </dev/tty)
    [ -n "$cmd" ] && LBUFFER+=$cmd
    zle reset-prompt
  }
  zle -N _oneliner_widget
  bindkey '^O' _oneliner_widget
elif [ -n "$BASH_VERSION" ]; then
  _oneliner_bash() {
    local cmd
    cmd=$(ONELINER_PRINT=1 oneliner </dev/tty)
    READLINE_LINE="${READLINE_LINE:0:READLINE_POINT}$cmd${READLINE_LINE:READLINE_POINT}"
    READLINE_POINT=$((READLINE_POINT + ${#cmd}))
  }
  bind -x '"\C-o": _oneliner_bash'
fi
  • oneliner searches all lists (oneliner crt.sh pre-fills the search), copies the pick to the Android clipboard when Termux:API is installed, and stages it on the prompt in Zsh or prints it in Bash.
  • Ctrl+O inserts the pick at your cursor mid-command, handy after a |.
  • Update the lists with git -C ~/awesome-one-liners pull -q.

Contributing

One line per entry: a short description, a dash, then the command in backticks. Test it before you PR it. Nothing destructive without a warning.

License

CC0

About

One command, one job. Shell one-liners for Linux sysadmins, edge boxes, and bare metal.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages