Last active
December 12, 2023 05:44
-
-
Save devynspencer/cfdce35b3230e72214ef to your computer and use it in GitHub Desktop.
A quaint collection of bash commands detailing the inner struggle of mankind.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list all attached usb devices | |
lsblk --nodeps --noheadings --list --scsi --paths --output name,vendor,model,tran | grep ' usb' | |
# restart a fuckload of services at once | |
services=('api backup scheduler volume'); for service in $services; do systemctl restart openstack-cinder-$service; done | |
# display concise ip / network interface info | |
ip addr show | sed -nE "s/inet\s(.*)\/[0-9]+.*\s(\w+)/\2 \1/p" | column -to ' => ' | |
# lo => 127.0.0.1 | |
# enp0s25 => 10.107.1.95 | |
# virbr0 => 192.168.124.1 | |
# list all ethernet network interfaces | |
ip link show | sed -nE "s/[0-9]:\s(\w+):.*/\1/p" | grep 'en|eth' | |
# download and run a remote shell script | |
script_url='http://host.internal/directory/filename.sh'; wget $script_url -O - | bash | |
# extract one file from an rpm | |
rpm2cpio logrotate-1.0-1.i386.rpm |cpio -ivd etc/logrotate.conf | |
# install file from rpm | |
yum --nogpgcheck localinstall packagename.arch.rpm | |
# save youtube videos from all chrome tabs | |
chrome-cli list links | awk '{ print $2}' | sort -u | grep viewkey >> movies.db | |
# download youtube videos from all chrome tabs | |
chrome-cli list links | awk '{ print $2}' | grep viewkey | youtube-dl --external-downloader=aria2c --batch-file - # may cause wtf-mode on networking | |
chrome-cli list links | awk '{ print $2}' | grep viewkey | youtube-dl --batch-file - |
Show ports being actively listened on, including the listening process:
# show processes listening on port 514
sudo netstat -antup | grep 514
Remove an entry from known_hosts
, bonus!
ssh-keygen -R remote-hostname
Play uptime
roulette using pdsh
PDSH_SSH_ARGS_APPEND="-q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=publickey" sudo pdsh -g rhel6 uptime | awk '{ print $1 " " $4 " " $5 }' | column -t
Kill all Docker containers / images:
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
Fuck you Docker. Nobody wants all your cruft.
# smartsmartsmart
alias drm='docker rm $(docker ps -aq); docker rmi $(docker images -q)'
alias drmf='docker rm $(docker ps -aq); docker rmi -f $(docker images -q)'
Meanwhile, in finger town ...
alias di='docker images'
alias diq='docker images -q'
alias dp='docker ps'
alias dpq='docker ps -q'
alias dpa='docker ps -a'
alias db='docker build .'
alias drm='docker rm $(docker ps -aq); docker rmi $(docker images -q)'
alias drmf='docker rm $(docker ps -aq); docker rmi -f $(docker images -q)'
alias ds='docker stop $(docker ps -q)'
alias dlogin='docker login --username=devynspencer --email=devynhartleyspencer@gmail.com'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Open a new tmux session and immediately begin tailing logs for
/var/log/messages
,/var/log/glusterfs/nfs.log
etc.