This is a collection of bash utilities. It contains:
bash_profile
project.Clone this project in your home folder ~
.
cd ~ && git clone https://github.com/marcomontalbano/bash_profile.git
Open and modify your $HOME/.bash_profile
on OS X and Windows or $HOME/.bashrc
on Ubuntu, adding the following script.
#https://github.com/marcomontalbano/bash_profile
source ~/bash_profile/.bash_profile -u
-p <http-proxy>
: combined with -u
, you can use self-update behind proxy.-u
: enables self-update for bash_profile. (the latest release will automatically downloaded and loaded)-w
: show welcome screen on new tabs.The following procedure works for OS X. If you are using Windows or Ubuntu, you don't need it.
If you want to use the git, svn and ssh completion, just run following scripts.
# Bash Completion for GIT
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/bash_profile/.bash_completion_git
# Bash Completion for SVN
curl http://svn.apache.org/repos/asf/subversion/trunk/tools/client-side/bash_completion -o ~/bash_profile/.bash_completion_svn
# Bash Completion for SSH and SFTP
curl https://gist.githubusercontent.com/marcomontalbano/7c48f6756e4e4133c30fdb8e1fff3100/raw -o ~/bash_profile/.bash_completion_ssh
bash_profile__path - get project path.
bash_profile__cd - cd
to the bash_profile
folder. Something like cd ~/bash_profile
bash_profile__version - get current version.
bash_profile__reload - reload the project.
bash_profile__reload_all - reload your own .bash_profile
or .bashrc
.
bash_profile__update - update the bash_profile
project with latest changes. Is "just" a git pull
😄
Below a list of utilities that you can use on command line or your own .bash_profile.
console__set_title - set a console title. (only for OS X and Windows)
cli__is_installed - check if a program is installed on your system. cli__is_installed node
will return true
if node is installed on your system, false
otherwise.
proxy__set - simply set the command line proxy. It works also for npm and apm, if you use them. usage: proxy__set http://domain:8080
or proxy__set http://domain:8080 https://domain:8080
proxy__unset - simply unset the command line proxy.
network__get_ip - get ip address (e.g. 192.168.0.5)
network__get_gateway - get gateway address (e.g. 192.168.0.1)
network__get_broadcast - get broadcast address (e.g. 192.168.0.1)
java__use_jdk - if you work with different version of JDK, you can easily switch with java__use_jdk 1.8
. (only for OS X)
git__update_date
or git__update_date -v -5H
(only for OS X)
PS1 is customized with multiple lines.
there are no changes on the active master branch
there are changes on the active master branch, but not committed yet
you have created a new-branch, but not pushed yet
you have created and pushed a new-branch
you have created a new-branch with some changes, but not committed and pushed yet
you have pushed the new-branch, but it has other changes to commit