Skip to content

Instantly share code, notes, and snippets.

@n0nuser
Last active August 13, 2024 13:33
Show Gist options
  • Save n0nuser/34fc14a084436ae89c2b3405ad453f0a to your computer and use it in GitHub Desktop.
Save n0nuser/34fc14a084436ae89c2b3405ad453f0a to your computer and use it in GitHub Desktop.
My Bash aliases
alias aliases="source ~/.bash_aliases"
# OS
alias poweroff="halt -p"
# Reboot and forever with No Gui
alias rebootNoGui='sudo systemctl set-default multi-user && sudo reboot'
# Reboot and forever with Gui
alias rebootGui='sudo systemctl set-default graphical && sudo reboot'
# Starts Gui, useful when in No Gui
alias startGui='sudo systemctl start gdm3'
#Allows to quickly change between shells: zsh, bash...
alias changesh='_ch() { chsh -s $(which $1) ;}; _ch'
# VPN
alias wireguard-on="wg-quick up wg0 && systemctl enable wg-quick@wg0"
alias wireguard-off="wg-quick down wg0 && systemctl disable wg-quick@wg0"
# University
## MPI
## $1 - C filename without ".c" extension
## $2 - Number of processes
## $3 - Argv[1] of C file
alias mpicompile='_mc() { mpicc $1.c -o $1 -lm && mpirun -np $2 -oversubscribe $1 $3 ;}; _mc $1 $2 $3'
# Miscellaneous
alias weather='_w() { curl -H "Accept-Language: $2" "wttr.in/$1?0pn" ;}; _w'
alias covid='curl "https://corona-stats.online/$1?"'
alias crypto='_c() { curl rate.sx/$1 ;}; _c'
alias say='echo "$1" | espeak -s 120 2>/dev/null'
alias changeBackground='_gb() { dir="$(pwd)/$1";gsettings set org.gnome.desktop.background picture-uri "file:///$dir" ;}; _gb $1'
alias vminfo="vboxmanage guestproperty enumerate $1" # VirtualBox info of running machine
alias filelower="tr '[:upper:]' '[:lower:]' < $1"
alias fileupper="tr '[:lower:]' '[:upper:]' < $1"
# Utils
alias www="python3 -m http.server"
alias diff="colordiff"
alias wipe='_w() { dd if=/dev/zero of=$1 bs=4096 status=progress ;}; _w'
alias wget="wget -c" # So download resumes if it suddenly stops
alias untar="tar -xvf"
alias copy="xclip -selection clipboard"
alias open='xdg-open'
# Network
alias ipconfig="ip -c --brief addr show"
alias publicip="curl ifconfig.me"
# icanhazip.com
# ipinfo.io/ip
# api.ipify.org
# checkip.dyndns.org
# ident.me
# bot.whatismyipaddress.com
# ipecho.net/plain
alias hosts="sudo nano /etc/hosts"
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
alias "$method"="lwp-request -m \"$method\""
done
alias netscan='_netscan() { nmap -v -T5 -sn $1 | grep -v "host down" | grep -w "scan report" ;}; _netscan'
# Above and below do the same
alias arpscan="sudo arp-scan -l -v"
alias gobusterdefault='_gb() { gobuster dir -u http://$1 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php -r -f -t 25 -o gobuster.txt ;}; _gb'
alias connections="ss | grep -v '*'"
## Fast Nmap
alias ports='_p() { nmap -Pn -p- --min-rate=20000 -T4 $1 | grep ^[0-9] | cut -d "/" -f 1 | tr "\n" "," | sed s/,$// ;}; _p'
alias fastnmap='_fn() { nmap -Pn -sC -sV -p $(ports $1) $1 | tail -n+5 | head -n-3 | tee nmap.txt ;}; _fn'
alias vulnnmap='_vn() { nmap --script vuln -p $(ports $1) $1 | tail -n+5 | head -n-3 | tee vuln_scan.txt ;}; _vn'
# Buffer Overflows
alias pattern="/usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l $1"
alias offset="/usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l $1 -q $2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment