Skip to content

Instantly share code, notes, and snippets.

@inceabdullah
Last active December 30, 2023 09:14
Show Gist options
  • Save inceabdullah/979b7e675d510c7898b5fd9c48719274 to your computer and use it in GitHub Desktop.
Save inceabdullah/979b7e675d510c7898b5fd9c48719274 to your computer and use it in GitHub Desktop.
alias watch='watch '
alias xargs='xargs '
alias aprint='awk "{print \$1}"'
alias bprint='awk "{print \$2}"'
alias cprint='awk "{print \$3}"'
alias zprint='awk "{print \$NF}"'
cdrun () {
( cd "$1" && shift && command "$@" )
}
alias cdd='cd ..'
alias cddd='cd ../..'
alias listening-ports='watch -n 1 sudo ss -tlpn'
alias tstail="perl -pe 'use POSIX strftime;
\$|=1;
select((select(STDERR), \$| = 1)[0]);
print strftime \"[%Y-%m-%d %H:%M:%S] \", localtime'"
alias myip='f() { dig +short myip.opendns.com @resolver1.opendns.com; }; f'
alias lslast='find . -printf "%T@ %Tc %p\n" | sort -nr | head -5'
alias listening-ports='watch -n 1 sudo ss -tlpn'
alias tstail="perl -pe 'use POSIX strftime;
\$|=1;
select((select(STDERR), \$| = 1)[0]);
print strftime \"[%Y-%m-%d %H:%M:%S] \", localtime'"
alias myip='f() { dig +short myip.opendns.com @resolver1.opendns.com; }; f'
alias ll='ls -alrtF |grep -vE "\s(\.)+/$"'
alias lslast='find . -printf "%T@ %Tc %p\n" | sort -nr | head -5'
alias lslastchanged='find . -printf "%C@ %c %p\n" | sort -nr | head -10'
alias lslastchangedBusyBox='find -print0 | xargs -0 stat -c "%Z %z %n" |sort -nr |head -10'
alias lslastchangedMacOS='find . -print | xargs stat -f "%c %Sc %N" |sort -nr |head -10'
alias sha1sumdirectory='f() { DIRECTORY=$1; if [[ -z "$1" ]]; then DIRECTORY=.; fi; COMMAND_RUNNING_PATH=$PWD; cd $DIRECTORY; find . -type f -print0 |xargs -0 sha1sum |sort |sha1sum |head -c40; cd $COMMAND_RUNNING_PATH; }; f'
alias sha1sumdirectorycontent='f() { DIRECTORY=$1; if [[ -z "$1" ]]; then DIRECTORY=.; fi; COMMAND_RUNNING_PATH=$PWD; cd $DIRECTORY; find . -type f -print0 |xargs -0 sha1sum |cut -d" " -f1 |sort |sha1sum |head -c40; cd $COMMAND_RUNNING_PATH; }; f'
# -------------- hosts --------------- #
alias vhosts='sudo vi /etc/hosts || vi /etc/hosts'
alias cathosts='cat /etc/hosts'
# ------------ end hosts ------------- #
# -------------- SSH -------------- #
alias sshno='ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null"'
alias scpno='scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null"'
alias ssh-copy-idno='ssh-copy-id -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null"'
# ------------ end SSH ------------ #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment