-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de59a1a
commit 44559ab
Showing
3 changed files
with
120 additions
and
106 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
alias al="cat ~/.zshrc" | ||
|
||
alias ll="ls -lrth" | ||
alias lla="ls -lrtha" | ||
|
||
alias date="date '+%d-%b-%y | %a | %H:%M:%S | %Z'" | ||
|
||
alias utc="TZ=UTC date" | ||
alias cst="TZ=US/Central date" | ||
alias est="TZ=US/Eastern date" | ||
alias ist="TZ=Asia/Kolkata date" | ||
|
||
# alias chmod commands | ||
alias 000='chmod 000' | ||
alias 644='chmod 644' | ||
alias 666='chmod 666' | ||
alias 655='chmod 655' | ||
alias 755='chmod 755' | ||
alias 777='chmod 777' | ||
|
||
alias cs="cheatsheet" # see functions | ||
alias serve="python3 -m http.server 8080" | ||
|
||
# Search command line history | ||
alias h="history | grep" | ||
|
||
# Search running processes | ||
alias p="ps aux | grep" | ||
alias topcpu="/bin/ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10" | ||
|
||
# git aliases | ||
alias gst="git status" | ||
|
||
# docker-compose | ||
alias dC="docker-compose" | ||
alias dCu="docker-compose up -d" | ||
alias dCd="docker-compose down" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/local/bin/zsh | ||
|
||
function reload() { | ||
source ~/.zshrc | ||
. ~/.zsh_aliases | ||
. ~/.zsh_functions | ||
} | ||
|
||
# mkdir + cd | ||
function mkd() { | ||
if [ $# -eq 1 ]; then | ||
mkdir -p "$1" && cd "$1"; | ||
else | ||
echo "Error - no directory passed!"; | ||
fi | ||
} | ||
|
||
# Add ssh keys on login | ||
function sshadd() { | ||
ssh-add -l >/dev/null | ||
|
||
if [[ $? != 0 ]]; then | ||
ssh-add ~/.ssh/<key-1> ~/.ssh/<key-2> ~/.ssh/<key-3> 2>/dev/null | ||
fi | ||
} | ||
|
||
# Find top n biggest files (default is 5) | ||
function big() { | ||
num=5; | ||
if [ $# -gt 0 ]; then | ||
num=$1 | ||
fi; | ||
find . -type f -exec ls -s {} \; | sort -n -r | head -$num | awk '{printf("%.2fM %s\n", $1*512/1024/1024, $2)}' | ||
} | ||
|
||
# Timer | ||
function timer() { | ||
count=10; | ||
if [ $# -gt 0 ]; then | ||
count=$1 | ||
fi | ||
echo "Timer of $count seconds started"; | ||
for ((i=count; i>0; i--)); do sleep 1; printf "Time remaining : $i seconds \r"; done | ||
echo "\nTime Up!" | ||
echo -e "\a" | ||
} | ||
|
||
# Most used commands | ||
function topcmd() { | ||
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10 | ||
} | ||
|
||
# Go up by n directories | ||
function up() { | ||
level=$1 | ||
if [ $# -gt 0 ]; then | ||
while [ "$level" -gt "0" ]; do | ||
cd .. | ||
level=$(($level - 1)) | ||
done | ||
else | ||
cd .. | ||
fi | ||
} | ||
|
||
# cheat.sh shortcut | ||
function cheatsheet() { curl http://cht.sh/$1 } |
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