Difference between revisions of "Linux command: alias"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) |
Rafahsolis (talk | contribs) m (→BBVA) Tag: visualeditor |
||
| (26 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | === Create alias === | + | ===Create alias=== |
<nowiki>alias imagenes='cd /media/discoduro/archivos/Pictures'</nowiki> | <nowiki>alias imagenes='cd /media/discoduro/archivos/Pictures'</nowiki> | ||
| − | === Create permanent alias === | + | ===Create permanent alias=== |
| − | <nowiki>echo 'alias imagenes="cd /media/discoduro/archivos/Pictures"' >> ~/. | + | <nowiki>echo 'alias imagenes="cd /media/discoduro/archivos/Pictures"' >> ~/.bash_aliases && . ~/.bashrc</nowiki> |
| − | === delete alias === | + | |
| + | ===delete alias=== | ||
<nowiki>unalias imagenes</nowiki> | <nowiki>unalias imagenes</nowiki> | ||
| − | === see defined alias === | + | ===see defined alias=== |
<nowiki>alias</nowiki> | <nowiki>alias</nowiki> | ||
| − | === alias definition file === | + | ===alias definition file=== |
alias can also be defined in file ~/.bash_aliases.<br /> | alias can also be defined in file ~/.bash_aliases.<br /> | ||
| − | + | =~/.bash_aliases= | |
| − | < | + | ==BBVA== |
| − | #!/bin/bash | + | <syntaxhighlight lang="bash"> |
| − | alias instala="sudo apt-get install" | + | alias clip="cat /media/sf_vmshared/clipboard" |
| − | alias vpn=/home/rafa/vpn.sh | + | alias nanoclip="nano /media/sf_vmshared/clipboard" |
| − | </nowiki> | + | #alias runserver="python manage.py runserver 0.0.0.0:8888 --settings=malwepid.settings.dev" |
| + | alias runserver="python manage.py runserver 0.0.0.0:8888" | ||
| + | alias ssh_malwepid="ssh -i ~/.ssh/DNC-FKY.pem ubuntu@ec2-52-57-220-220.eu-central-1.compute.amazonaws.com" | ||
| + | alias fpsim_fronend='ssh ubuntu@fpsim-frontend' | ||
| + | alias fpsim_spark="ssh ubuntu@fpsim-frontend 'ssh ubuntu@fpsim-spark'" | ||
| + | alias dev_settings="export DJANGO_SETTINGS_MODULE=malwepid.settings.dev" | ||
| + | alias tunnel_fsimdb="ssh -i ~/.ssh/DNC-FKY.pem -N -L 5555:fsim-dbpg.c9hdfwhhklwy.eu-central-1.rds.amazonaws.com:5432 ubuntu@ec2-52-57-220-220.eu-central-1.compute.amazonaws.com" | ||
| + | alias tunnel_newsdb="ssh -i ~/.ssh/rra_id.pem -N -L 5555:fsim-dbpg.c9hdfwhhklwy.eu-central-1.rds.amazonaws.com:5432 ubuntu@news.menupayapp.com" | ||
| + | alias tunnel_news_adsl="ssh -i ~/.ssh/rt_rsa -ND 10.0.2.15:1111 rra@20.1.40.109" | ||
| + | alias push="git push origin --all;git push gitlab --all;git push origin --tags;git push gitlab --tags" | ||
| + | alias pdgrt_remote_master_back="git remote set-url origin git@git.rra.lan:pdgrt/misiones/back-end.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/master-back.git" | ||
| + | alias pdgrt_remote_master_front="git remote set-url origin git@git.rra.lan:pdgrt/misiones/front-end.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/master-front.git" | ||
| + | alias pdgrt_remote_node_back="git remote set-url origin git@git.rra.lan:pdgrt/encargos/back-end.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/node-back.git" | ||
| + | alias pdgrt_remote_node_front="git remote set-url origin git@git.rra.lan:pdgrt/encargos/front-end.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/node-front.git" | ||
| + | alias pdgrt_remote_deploy="git remote set-url origin git@git.rra.lan:pdgrt/deploy.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/deploy.git" | ||
| + | alias firefox='/opt/firefox/firefox' | ||
| + | alias pilaf_settings="export DJANGO_SETTINGS_MODULE=pilaf_detectors.settings.test" | ||
| + | alias mirror_log='tail -f /home/rafa/PycharmProjects/git_mirror/logs/git_mirror.log' | ||
| + | alias git-mirror="/home/rafa/.virtualenvs/git_mirror/bin/python /home/rafa/PycharmProjects/git_mirror/mirror.py work" | ||
| + | alias terse='/home/rafa/RACF/terse/terselinux.i386' | ||
| + | alias push='git push' | ||
| + | alias gitdiscard='git add . && git stash && git stash drop' | ||
| + | alias upgrade="sudo apt update && sudo apt upgrade" | ||
| + | alias mkvirtualenv="mkvirtualenv -p /usr/bin/python3" | ||
| + | # Proxy | ||
| + | |||
| + | ETH0=$(ifconfig | grep -A 1 eth0 | grep inet | awk '{print $2}') | ||
| + | ETH0=$(ifconfig | grep -A 1 br0 | grep inet | awk '{print $2}') | ||
| + | TUN0=$(ifconfig | grep -A 1 tun0 | grep inet | awk '{print $2}') | ||
| + | alias foxy="ssh -ND 127.0.0.1:1080 -i ~/.ssh/DNC-FKY.pem ubuntu@ec2-52-57-220-220.eu-central-1.compute.amazonaws.com" | ||
| + | alias proxy_mossad="ssh -ND 127.0.0.1:1080 mossad.rra.lan" | ||
| + | alias proxy_vpn="echo 'Opening SOCKS5 @$TUN0:1080' && ssh -ND $TUN0:1080 rafa@localhost" | ||
| + | alias proxy_15="echo 'Opening SOCKS5 @$ETH0:1080' && ssh -ND $BR0:1080 rafa@localhost" | ||
| + | |||
| + | function dns(){ | ||
| + | nslookup ${1} | grep Address | grep -v 127.0.0.1 | awk '{print $NF}' | ||
| + | } | ||
| + | |||
| + | function macs(){ | ||
| + | ip -o link | awk '$2 != "lo:" {print $2, $(NF-2)}' | ||
| + | } | ||
| + | |||
| + | function newpass() { | ||
| + | tr -dc 'a-zA-Z0-9._!@#$%^&*()' < /dev/urandom | fold -w $1 | head -n 1 | ||
| + | } | ||
| + | |||
| + | </syntaxhighlight><br /> | ||
| + | ==Trinity== | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | #!/bin/bash | ||
| + | alias upgrade="sudo apt update && sudo apt upgrade" | ||
| + | alias youtube-mp3="youtube-dl --verbose --extract-audio --audio-format mp3" | ||
| + | alias instala="sudo apt-get install" | ||
| + | alias vpn=/home/rafa/vpn.sh | ||
| + | alias todo="nano /media/rafa/GIT/documentos/TODO" | ||
| + | alias towiki="nano /media/rafa/GIT/TO_WIKI" | ||
| + | alias rtcode="cd /home/rafa/documentos/work/bbva/git/RedTeam" | ||
| + | alias tunel_mail_accounts="echo 'To port 3666' && ssh -N -L 3666:localhost:3306 ubuntu@webmail.herrerosolis.com" | ||
| + | alias clone="git clone" | ||
| + | alias push="git push" | ||
| + | alias fetch="git fetch" | ||
| + | alias commit="git commit -m" | ||
| + | alias add="git add ." | ||
| + | alias git2fa="oathtool --totp -b <seed>" | ||
| + | alias cpc_flower="echo 'Flower available at: http://localhost:5555' && ssh -p 7777 -i .ssh/cpc.pem -N -L 5555:localhost:5555 ubuntu@cpc" | ||
| + | alias ssh_malwepid='ssh -i ~/.ssh/DNC-FKY.pem ubuntu@ec2-52-57-220-220.eu-central-1.compute.amazonaws.com' | ||
| + | alias ihacklabs="sudo openvpn /home/rafa/Descargas/labvpn/Hacking_Lab_Zr0kE_Hacking.ovpn" | ||
| + | alias tinderbot="workon tinder-bot; cd ~/PycharmProjects/tinder_bot/FlirtManager; python manage.py runserver 127.0.0.1:8888 --noreload" | ||
| + | alias kill_tinderbot="ps aux | grep 'python manage.py runserver 127.0.0.1:8888 --noreload' | grep -v grep | awk '{print $2}' | xargs -n 1 kill" | ||
| + | alias popcorntime="~/apps/popcorntime/Popcorn-Time &" | ||
| + | alias dns='sudo mkdir /run/resolvconf && echo "nameserver 8.8.8.8" | sudo tee /run/resolvconf/resolv.conf' | ||
| + | alias serve='/usr/bin/python -m SimpleHTTPServer' TORRENTS_DIR='/home/rafa/PycharmProjects/Scrapers/xdownload/XDownload/XDownload/torrents/pornbay' TRANSMISSION_DOWNLOAD_FOLDER='/home/rafa/Downloads/tranmission' | ||
| + | alias send_torrents='find /home/rafa/Vídeos -path /home/rafa/Vídeos/Morpheus -prune -o -name "*.torrent" -exec rsync --remove-source-files {} morpheus:/home/rafa/popcorntime_torrents \;' | ||
| + | alias t-start='sudo service transmission-daemon start' | ||
| + | alias t-stop='sudo service transmission-daemon stop' | ||
| + | alias t-reload='sudo service transmission-daemon reload' | ||
| + | alias t-list='transmission-remote -n 'transmission:transmission' -l' | ||
| + | alias t-basicstats='transmission-remote -n 'transmission:transmission' -st' | ||
| + | alias t-fullstats='transmission-remote -n 'transmission:transmission' -si' | ||
| + | alias t-status='sudo systemctl status transmission-daemon' # | ||
| + | alias t-download='echo transmission-cli -w ${TRANSMISSION_DOWNLOAD_FOLDER} -er $TORRENTS_DIR' | ||
| + | |||
| + | function t-download() { | ||
| + | transmission-cli -w ${TRANSMISSION_DOWNLOAD_FOLDER} -er $TORRENTS_DIR/${1} | ||
| + | } | ||
| + | |||
| + | function download_dir { | ||
| + | FILE_PATH=$(find ~/Downloads -iname *${1}* | grep "mp4\|mkv\|avi") | ||
| + | LINES=$(find ~/Downloads -iname *${1}* | grep "mp4\|mkv\|avi" | wc -l) | ||
| + | |||
| + | if [ -z "$FILE_PATH" ]; then | ||
| + | echo Not Found | ||
| + | [ $PS1 ] && return || exit; | ||
| + | elif [ "${LINES}" -ne "1" ]; then | ||
| + | echo More than one found: ${LINES} | ||
| + | echo ${FILE_PATH} | ||
| + | [ $PS1 ] && return || exit; | ||
| + | else | ||
| + | |||
| + | DIR_PATH=$(dirname "${FILE_PATH}") | ||
| + | echo $FILE_PATH | ||
| + | echo opening ${DIR_PATH} | ||
| + | nautilus "${DIR_PATH}" | ||
| + | fi | ||
| + | } | ||
| + | |||
| + | |||
| + | |||
| + | function morpheus_transfer { | ||
| + | if [ -z "${1}" ] || [ -z "{$2}" ]; then | ||
| + | echo usage: download_dir parent_directory find_pattern | ||
| + | exit 1 | ||
| + | fi | ||
| + | find ${1} -iname ${2} -exec rsync --remove-source-files -azv {} morpheus.lan:/media/video/classification_pending/ \; | ||
| + | } | ||
| + | |||
| + | |||
| + | |||
| + | </syntaxhighlight><br /> | ||
| + | ==Morpheus== | ||
| + | <nowiki>function tr_move() { | ||
| + | if [ -z $TR_AUTH ]; then | ||
| + | echo "Must export TR_AUTH=username:password (leave a space before the comand so it doesn't get recorded at .bash_history" | ||
| + | elif [ -z $1 ]; then | ||
| + | echo "Must provide a torrent id" | ||
| + | else | ||
| + | transmission-remote -n ${TR_AUTH} -t ${1} --move /var/lib/transmission-daemon/downloads/porn/ | ||
| + | fi | ||
| + | } | ||
| + | |||
| + | function tr_list() { | ||
| + | if [ -z $TR_AUTH ]; then | ||
| + | echo "Must export TR_AUTH=username:password (leave a space before the comand so it doesn't get recorded at .bash_history" | ||
| + | else | ||
| + | transmission-remote -n ${TR_AUTH} -l | ||
| + | fi | ||
| + | } | ||
| + | |||
| + | function tr_find() { | ||
| + | if [ -z $TR_AUTH ]; then | ||
| + | echo "Must export TR_AUTH=username:password (leave a space before the comand so it doesn't get recorded at .bash_history" | ||
| + | elif [ -z "${1}" ]; then | ||
| + | echo "Must provide a search string" | ||
| + | else | ||
| + | transmission-remote -n ${TR_AUTH} -l | grep -i "${1}" | ||
| + | fi | ||
| + | } | ||
| + | alias upgrade="sudo apt update && sudo apt upgrade"</nowiki> | ||
| + | |||
| + | ==Some usefull alias== | ||
| + | <nowiki>alias h="history" # quick access to command history | ||
| + | alias c="clear" # quick way to clear terminal screen | ||
| + | alias grep="grep —color -n" # colorize matches; show line numbers | ||
| + | alias df="df -h" # show free space using human readable units | ||
| + | alias du="du -sh" # show disk usage using human readable units | ||
| + | alias sc="source $HOME/.cshrc" | ||
| + | alias gousb="cd $USBDRIVE_PATH"</nowiki> | ||
Latest revision as of 08:34, 28 February 2020
Create alias
alias imagenes='cd /media/discoduro/archivos/Pictures'
Create permanent alias
echo 'alias imagenes="cd /media/discoduro/archivos/Pictures"' >> ~/.bash_aliases && . ~/.bashrc
delete alias
unalias imagenes
see defined alias
alias
alias definition file
alias can also be defined in file ~/.bash_aliases.
~/.bash_aliases
BBVA
alias clip="cat /media/sf_vmshared/clipboard"
alias nanoclip="nano /media/sf_vmshared/clipboard"
#alias runserver="python manage.py runserver 0.0.0.0:8888 --settings=malwepid.settings.dev"
alias runserver="python manage.py runserver 0.0.0.0:8888"
alias ssh_malwepid="ssh -i ~/.ssh/DNC-FKY.pem ubuntu@ec2-52-57-220-220.eu-central-1.compute.amazonaws.com"
alias fpsim_fronend='ssh ubuntu@fpsim-frontend'
alias fpsim_spark="ssh ubuntu@fpsim-frontend 'ssh ubuntu@fpsim-spark'"
alias dev_settings="export DJANGO_SETTINGS_MODULE=malwepid.settings.dev"
alias tunnel_fsimdb="ssh -i ~/.ssh/DNC-FKY.pem -N -L 5555:fsim-dbpg.c9hdfwhhklwy.eu-central-1.rds.amazonaws.com:5432 ubuntu@ec2-52-57-220-220.eu-central-1.compute.amazonaws.com"
alias tunnel_newsdb="ssh -i ~/.ssh/rra_id.pem -N -L 5555:fsim-dbpg.c9hdfwhhklwy.eu-central-1.rds.amazonaws.com:5432 ubuntu@news.menupayapp.com"
alias tunnel_news_adsl="ssh -i ~/.ssh/rt_rsa -ND 10.0.2.15:1111 rra@20.1.40.109"
alias push="git push origin --all;git push gitlab --all;git push origin --tags;git push gitlab --tags"
alias pdgrt_remote_master_back="git remote set-url origin git@git.rra.lan:pdgrt/misiones/back-end.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/master-back.git"
alias pdgrt_remote_master_front="git remote set-url origin git@git.rra.lan:pdgrt/misiones/front-end.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/master-front.git"
alias pdgrt_remote_node_back="git remote set-url origin git@git.rra.lan:pdgrt/encargos/back-end.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/node-back.git"
alias pdgrt_remote_node_front="git remote set-url origin git@git.rra.lan:pdgrt/encargos/front-end.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/node-front.git"
alias pdgrt_remote_deploy="git remote set-url origin git@git.rra.lan:pdgrt/deploy.git;git remote add gitlab git@git.herrerosolis.com:BBVA-RedTeam/Django/pdgrt/deploy.git"
alias firefox='/opt/firefox/firefox'
alias pilaf_settings="export DJANGO_SETTINGS_MODULE=pilaf_detectors.settings.test"
alias mirror_log='tail -f /home/rafa/PycharmProjects/git_mirror/logs/git_mirror.log'
alias git-mirror="/home/rafa/.virtualenvs/git_mirror/bin/python /home/rafa/PycharmProjects/git_mirror/mirror.py work"
alias terse='/home/rafa/RACF/terse/terselinux.i386'
alias push='git push'
alias gitdiscard='git add . && git stash && git stash drop'
alias upgrade="sudo apt update && sudo apt upgrade"
alias mkvirtualenv="mkvirtualenv -p /usr/bin/python3"
# Proxy
ETH0=$(ifconfig | grep -A 1 eth0 | grep inet | awk '{print $2}')
ETH0=$(ifconfig | grep -A 1 br0 | grep inet | awk '{print $2}')
TUN0=$(ifconfig | grep -A 1 tun0 | grep inet | awk '{print $2}')
alias foxy="ssh -ND 127.0.0.1:1080 -i ~/.ssh/DNC-FKY.pem ubuntu@ec2-52-57-220-220.eu-central-1.compute.amazonaws.com"
alias proxy_mossad="ssh -ND 127.0.0.1:1080 mossad.rra.lan"
alias proxy_vpn="echo 'Opening SOCKS5 @$TUN0:1080' && ssh -ND $TUN0:1080 rafa@localhost"
alias proxy_15="echo 'Opening SOCKS5 @$ETH0:1080' && ssh -ND $BR0:1080 rafa@localhost"
function dns(){
nslookup ${1} | grep Address | grep -v 127.0.0.1 | awk '{print $NF}'
}
function macs(){
ip -o link | awk '$2 != "lo:" {print $2, $(NF-2)}'
}
function newpass() {
tr -dc 'a-zA-Z0-9._!@#$%^&*()' < /dev/urandom | fold -w $1 | head -n 1
}
Trinity
#!/bin/bash
alias upgrade="sudo apt update && sudo apt upgrade"
alias youtube-mp3="youtube-dl --verbose --extract-audio --audio-format mp3"
alias instala="sudo apt-get install"
alias vpn=/home/rafa/vpn.sh
alias todo="nano /media/rafa/GIT/documentos/TODO"
alias towiki="nano /media/rafa/GIT/TO_WIKI"
alias rtcode="cd /home/rafa/documentos/work/bbva/git/RedTeam"
alias tunel_mail_accounts="echo 'To port 3666' && ssh -N -L 3666:localhost:3306 ubuntu@webmail.herrerosolis.com"
alias clone="git clone"
alias push="git push"
alias fetch="git fetch"
alias commit="git commit -m"
alias add="git add ."
alias git2fa="oathtool --totp -b <seed>"
alias cpc_flower="echo 'Flower available at: http://localhost:5555' && ssh -p 7777 -i .ssh/cpc.pem -N -L 5555:localhost:5555 ubuntu@cpc"
alias ssh_malwepid='ssh -i ~/.ssh/DNC-FKY.pem ubuntu@ec2-52-57-220-220.eu-central-1.compute.amazonaws.com'
alias ihacklabs="sudo openvpn /home/rafa/Descargas/labvpn/Hacking_Lab_Zr0kE_Hacking.ovpn"
alias tinderbot="workon tinder-bot; cd ~/PycharmProjects/tinder_bot/FlirtManager; python manage.py runserver 127.0.0.1:8888 --noreload"
alias kill_tinderbot="ps aux | grep 'python manage.py runserver 127.0.0.1:8888 --noreload' | grep -v grep | awk '{print $2}' | xargs -n 1 kill"
alias popcorntime="~/apps/popcorntime/Popcorn-Time &"
alias dns='sudo mkdir /run/resolvconf && echo "nameserver 8.8.8.8" | sudo tee /run/resolvconf/resolv.conf'
alias serve='/usr/bin/python -m SimpleHTTPServer' TORRENTS_DIR='/home/rafa/PycharmProjects/Scrapers/xdownload/XDownload/XDownload/torrents/pornbay' TRANSMISSION_DOWNLOAD_FOLDER='/home/rafa/Downloads/tranmission'
alias send_torrents='find /home/rafa/Vídeos -path /home/rafa/Vídeos/Morpheus -prune -o -name "*.torrent" -exec rsync --remove-source-files {} morpheus:/home/rafa/popcorntime_torrents \;'
alias t-start='sudo service transmission-daemon start'
alias t-stop='sudo service transmission-daemon stop'
alias t-reload='sudo service transmission-daemon reload'
alias t-list='transmission-remote -n 'transmission:transmission' -l'
alias t-basicstats='transmission-remote -n 'transmission:transmission' -st'
alias t-fullstats='transmission-remote -n 'transmission:transmission' -si'
alias t-status='sudo systemctl status transmission-daemon' #
alias t-download='echo transmission-cli -w ${TRANSMISSION_DOWNLOAD_FOLDER} -er $TORRENTS_DIR'
function t-download() {
transmission-cli -w ${TRANSMISSION_DOWNLOAD_FOLDER} -er $TORRENTS_DIR/${1}
}
function download_dir {
FILE_PATH=$(find ~/Downloads -iname *${1}* | grep "mp4\|mkv\|avi")
LINES=$(find ~/Downloads -iname *${1}* | grep "mp4\|mkv\|avi" | wc -l)
if [ -z "$FILE_PATH" ]; then
echo Not Found
[ $PS1 ] && return || exit;
elif [ "${LINES}" -ne "1" ]; then
echo More than one found: ${LINES}
echo ${FILE_PATH}
[ $PS1 ] && return || exit;
else
DIR_PATH=$(dirname "${FILE_PATH}")
echo $FILE_PATH
echo opening ${DIR_PATH}
nautilus "${DIR_PATH}"
fi
}
function morpheus_transfer {
if [ -z "${1}" ] || [ -z "{$2}" ]; then
echo usage: download_dir parent_directory find_pattern
exit 1
fi
find ${1} -iname ${2} -exec rsync --remove-source-files -azv {} morpheus.lan:/media/video/classification_pending/ \;
}
Morpheus
function tr_move() {
if [ -z $TR_AUTH ]; then
echo "Must export TR_AUTH=username:password (leave a space before the comand so it doesn't get recorded at .bash_history"
elif [ -z $1 ]; then
echo "Must provide a torrent id"
else
transmission-remote -n ${TR_AUTH} -t ${1} --move /var/lib/transmission-daemon/downloads/porn/
fi
}
function tr_list() {
if [ -z $TR_AUTH ]; then
echo "Must export TR_AUTH=username:password (leave a space before the comand so it doesn't get recorded at .bash_history"
else
transmission-remote -n ${TR_AUTH} -l
fi
}
function tr_find() {
if [ -z $TR_AUTH ]; then
echo "Must export TR_AUTH=username:password (leave a space before the comand so it doesn't get recorded at .bash_history"
elif [ -z "${1}" ]; then
echo "Must provide a search string"
else
transmission-remote -n ${TR_AUTH} -l | grep -i "${1}"
fi
}
alias upgrade="sudo apt update && sudo apt upgrade"
Some usefull alias
alias h="history" # quick access to command history
alias c="clear" # quick way to clear terminal screen
alias grep="grep —color -n" # colorize matches; show line numbers
alias df="df -h" # show free space using human readable units
alias du="du -sh" # show disk usage using human readable units
alias sc="source $HOME/.cshrc"
alias gousb="cd $USBDRIVE_PATH"