Every time I need to use sublime to open a project from terminal, I have to do this:
nohup sublime . &
Is there a way to short it?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
You can shorten commands by creating an alias. Aliases should be put in
~/.bash_aliases (not in
You can create
~/.bash_aliases with the following command:
You can now edit the file and put your alias in there in the format:
alias subl='nohup sublime . &'
Be warned that if your define an alias that has the same name as a command, the alias takes precedence. This can be useful:
alias ls='ls -alF --color=auto'
Will always give you coloured, classified, complete lists when using
.profile are usually filled with all kind of nifty things by default. While this is certainly useful, it's not convenient when adding aliases yourself. Someone has apparently thought of this and added the following to the default
# Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
.bash_aliases exists, it's loaded by
.bashrc and you have an entire file for all your aliases. If you install the
bash-doc package there are some examples that can be found in:
You could make a wrapper script something like this -
mkdir -p ~/bin echo "nohup sublime . &" > ~/bin/sbl chmod 700 ~/bin/sbl
sbl will have the effect you want (though if you didn't already have a
~/bin folder, you may have to log out & log back in once first so your PATH is correct).
It's traditional to use aliases for this, but I have always preferred using wrappers because they are more flexible if you decide to edit them to do more complex tasks later.