Created
July 4, 2015 08:07
-
-
Save fillipetech/02d128c0d67c9d1fdae2 to your computer and use it in GitHub Desktop.
Bash_profile personalizado com atalhos e configurações
This file contains hidden or 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
| # --------------------------------------------------------------------------- | |
| # Descrição: Este arquivo contém todas as minhas configurações e atalhos personalizados para o Bash | |
| # | |
| # Sessões: | |
| # 1. Configurações Básicas | |
| # 2. Definição de atalhos | |
| # 3. Gerenciamento de arquivos e pastas | |
| # 4. Pesquisa | |
| # 5. Rede | |
| # 6. Operações & Informações | |
| # 7. Desenvolvimento | |
| # --------------------------------------------------------------------------- | |
| # ------------------------------- | |
| # 1. CONFIGURAÇÕES BÁSICAS | |
| # ------------------------------- | |
| # Alterando o Prompt | |
| parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } | |
| export PS1="__________________________________________________________________________________\n\w\$(parse_git_branch)\n$ › " | |
| # Definindo os Paths | |
| export PATH="$PATH:/usr/local/bin/" | |
| export PATH="/usr/local/git/bin:/sw/bin/:/usr/local/bin:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:$PATH" | |
| #RVM | |
| export PATH="$PATH:$HOME/.rvm/bin" | |
| export PATH="/Users/fillipeamorim/.rvm/gems/ruby-2.1.2/bin:$PATH" | |
| #MAMP | |
| export PATH="/Applications/MAMP/bin:$PATH" | |
| #mongoDB | |
| export MONGO_PATH=/usr/local/mongodb | |
| export PATH=$PATH:$MONGO_PATH/bin | |
| #Adicionando cores ao terminal | |
| export CLICOLOR=1 | |
| export LSCOLORS=ExFxBxDxCxegedabagacad | |
| # ----------------------------- | |
| # 2. ATALHOS | |
| # ----------------------------- | |
| #atalhos para o Git | |
| alias gi='git init' | |
| alias ga="git add $1" | |
| alias gs='git status' | |
| alias gc="git commit -m $1" | |
| alias gl="git log" | |
| #Outros atalhos | |
| alias cp='cp -iv' # Copiar -i = Pergunta em caso de sobrescrita, -V = lista o arquivo copiado | |
| alias mv='mv -iv' # Mover -i = Pergunta em caso de sobrescrita, -V = lista o arquivo movido | |
| alias mkdir='mkdir -pv' # Criar Pasta -P = esconde o erro caso uma pasta com mesmo nome exista, -V = lista a pasta criada | |
| alias ll='ls -FGlAhp' # Listagem detalhada | |
| alias cd..='cd ../' # Subir 1 diretório | |
| alias ..='cd ../' # Subir 1 diretório | |
| alias ...='cd ../../' # Subir 2 diretórios | |
| alias finder='open -a Finder ./' # Abre o diretório atual no Finder | |
| alias ~="cd ~" # Ir para o home do perfil | |
| alias c='clear' # Limpa a tela do terminal | |
| alias path='echo -e ${PATH//:/\\n}' # Lista todos os Paths setados | |
| mkcd () { mkdir -p "$1" && cd "$1"; } # Cria uma pasta e entra na mesma em seguida | |
| del () { command mv "$@" ~/.Trash ; } # Move o arquivo para a lixeira | |
| ql () { qlmanage -p "$*" >& /dev/null; } # Abre o arquivo no Quick Look do Mac | |
| # --------------------------------------- | |
| # 3. GERENCIAMENTO DE ARQUIVOS & PASTAS | |
| # --------------------------------------- | |
| zipf () { zip -r "$1".zip "$1" ; } # Compacta o arquivo ou pasta após o comando | |
| dat () { mkfile "$1" ./"$1".dat ; } # Cria um arquivo .dat conforme o tamanho definido 1k, 1m, 1g | |
| alias countf='echo $(ls -1 | wc -l)' # Conta a quantidade de arquivos (visíveis) da pasta atual | |
| # Extrai arquivos compactados | |
| extract () { | |
| if [ -f $1 ] ; then | |
| case $1 in | |
| *.tar.bz2) tar xjf $1 ;; | |
| *.tar.gz) tar xzf $1 ;; | |
| *.bz2) bunzip2 $1 ;; | |
| *.rar) unrar e $1 ;; | |
| *.gz) gunzip $1 ;; | |
| *.tar) tar xf $1 ;; | |
| *.tbz2) tar xjf $1 ;; | |
| *.tgz) tar xzf $1 ;; | |
| *.zip) unzip $1 ;; | |
| *.Z) uncompress $1 ;; | |
| *.7z) 7z x $1 ;; | |
| *) echo "'$1' não pode ser extraído via extract()" ;; | |
| esac | |
| else | |
| echo "'$1' não é um arquivo válido!" | |
| fi | |
| } | |
| # --------------------------- | |
| # 4. PESQUISA | |
| # --------------------------- | |
| alias qfind="find . -name " # Pesquisar por arquivo | |
| ff () { /usr/bin/find . -name "$@" ; } # Pesquisar por arquivo na pasta atual | |
| ffs () { /usr/bin/find . -name "$@"'*' ; } # Pesquisar por arquivos que o nome começa com o texto digitado | |
| ffe () { /usr/bin/find . -name '*'"$@" ; } # Pesquisar por arquivos que o nome termina com o texto digitado | |
| # Pesquisar via Spotlight: | |
| spotlight () { mdfind "kMDItemDisplayName == '$@'wc"; } | |
| # --------------------------- | |
| # 5. REDE | |
| # --------------------------- | |
| alias myip='curl ip.appspot.com' # Exibe o IP Público | |
| alias flushDNS='dscacheutil -flushcache' # Limpa o Cache de DNS | |
| # --------------------------------------- | |
| # 6. OPERAÇÕES E INFORMAÇÕES | |
| # --------------------------------------- | |
| # Pesquisa e apaga todos os arquivos .DS_Store de forma recursiva | |
| alias cleanupDS="find . -type f -name '*.DS_Store' -ls -delete" | |
| # ShowHidden: Exibe os arquivos ocultos no finder | |
| # HideHidden: Oculta os arquivos ocultos no finder | |
| alias ShowHidden='defaults write com.apple.finder AppleShowAllFiles -bool TRUE; killall Finder' | |
| alias HideHidden='defaults write com.apple.finder AppleShowAllFiles -bool FALSE; killall Finder' | |
| # Limpa o LaunchServices e remove as entradas duplicadas no menu "Abrir Com..." | |
| alias cleanupLS="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" | |
| # --------------------------------------- | |
| # 7. DESENVOLVIMENTO | |
| # --------------------------------------- | |
| alias apacheEdit='sudo mate /etc/apache2/httpd.conf' # Editar o arquivo httpd.conf | |
| alias editHosts='sudo mate /etc/hosts' # Editar o arquivo /etc/hosts | |
| httpHeaders () { /usr/bin/curl -I -L $@ ; } # Carrega os Headers da URL | |
| # Baixa a página e exibe as informações | |
| httpDebug () { /usr/bin/curl $@ -o /dev/null -w "dns: %{time_namelookup} \nconnect: %{time_connect} \npretransfer: %{time_pretransfer} \nstarttransfer: %{time_starttransfer} \ntotal: %{time_total}\n" ; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment