Last active
April 15, 2023 16:48
-
-
Save CyberPunkCodes/bd873db7cd9051f2c0d231f3f7f3e0a8 to your computer and use it in GitHub Desktop.
Oh-My-Zsh - Best and Most Helpful - My Custom ZSH Aliases - Tips Hack Help Info Doc Tutorial
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
# Source Reload | |
alias reload.zsh="source ~/.zshrc" | |
alias reload.profile="source ~/.bash_profile" | |
alias reload.term="source ~/.bash_profile && source ~/.zshrc" | |
# cd | |
alias ..="cd .." | |
# ls | |
alias ll="ls -AlhG" | |
#alias cll="/usr/local/bin/cll `pwd`" | |
# tar | |
alias tarr="tar -pczf $1 $2" | |
alias untarr="tar -pxzf $1" | |
alias starr="sudo tar -pczf $1 $2" | |
# Paths | |
alias go.webroot="/Applications/XAMPP/xamppfiles/htdocs" | |
alias go.sites="~/Sites" | |
# Mac | |
alias mac.showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder" | |
alias mac.hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder" | |
# Docker | |
alias docker.cleancontainer="docker ps -a -q | xargs docker rm" | |
alias docker.cleanimage="docker images --filter dangling=true -q | xargs docker rmi" | |
# Find & Delete all ".DS_Store" files (recursive) | |
alias delete.ds="find . -name '.DS_Store' -type f -print -delete" | |
# Functions - My perfected ls command! | |
cll() { ls -AlhG "$@" | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(" %0o ",k);print}' | cut -c 1-5,21-; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Introduction
This is my current custom
aliases.zsh
file for Oh-My-Zsh.You are not supposed to edit your
.zshrc
file! It is only for the main settings. If you want to add custom things (like aliases, functions, etc), then you should create a newfile.zsh
in/Users/<you>/.oh-my-zsh/custom/
. I chose to name italiases.zsh
as majority of them are aliases. You can create multiple files, they all should be loaded. So you could createaliases.zsh
for aliases andfunctions.zsh
for your functions, and whatever else you want.Installation:
NOTE: You must have Oh-My-Zsh installed. Replace
<you>
in the path below with your username.First,
cd
into your Oh-My-Zsh custom directory:cd /Users//.oh-my-zsh/custom
Then use one of the below methods to download this gist:
Curl Method
Wget Method
PHP Method
Copy-n-Paste method
Copy the raw code from here and paste it into your Terminal.
CTRL+o (Oh, not zero) Then EnterTo save
CTRL+x To exit
I hope you find my custom Oh-My-Zsh aliases helpful!
Did You Know
Did you know that you can use dots/periods in your alias names? I used a few in my Gist above. It makes remembering them easier, and allows you to group them.
For example, for all my paths that I may want quick access to, they start with
go
. So I can do:Now, I don't have all of those defined in my Gist, so they won't work. Just showing how the (dot) can group your similar commands together. Maybe you wanted to define some
Git
aliases. You could do:Contributing
Do you have a function that is awesome and majority of people would probably find useful? Feel free to let me know. If I like it, it may find it's way into this Gist 👍