Skip to content

Instantly share code, notes, and snippets.

@subfission
Created December 18, 2025 14:18
Show Gist options
  • Select an option

  • Save subfission/63f365a5667364769d5adc32d6b0e67a to your computer and use it in GitHub Desktop.

Select an option

Save subfission/63f365a5667364769d5adc32d6b0e67a to your computer and use it in GitHub Desktop.
Bash - Administration Examples

To be added to https://github.com/subfission/Bash-Tips-Tricks when finished.


Bash Tips and Tricks for Administative Work

Commands oriented to administrative workflows. Placeholders: <ip>, <user>, <port>, <file>, <iface>, <mac>, <domain>, <dns_server>, <pid>, <pattern>, <processname>.


SECTIONS: Hardware Management ·


Hardware Management

Inspect lsusb info with many attached devices

Command ends when you press return.

diff <(lsusb) <(read; lsusb)

Send files from memory into vim for editing using process substitution, rather than sourcing from HD.

Example usage could be for making a TLS certificate chain, manually reviewing, and then storing in a location of your choosing.

vim <(cat file1 file2)

Using process substitution for performing sorted differential comparisons of files

diff <(sort file1) <(sort file2)

Using process substitution for performing differential comparisons of a file after a temporary edit.

Example could be when editing config files and validating what would be changed, without changing the file.

diff file1 <(sed s/on/#off/I file1)

Monitor a process execution and direct error logs to both a file and system out

./example_executable > >(less) 2> >(tee errorlog.txt)  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment