Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Create an Alias. Check this out: – Geppettvs D'Constanzo Oct 8 '12 at 16:44
up vote 3 down vote accepted

You can make command short by editing .bashrc file and add the following line at the end of the file.

alias new_command='long old_command'

For here you can use

alias newcommand = nohup sublime . &

share|improve this answer

You can shorten commands by creating an alias. Aliases should be put in ~/.bash_aliases (not in ~/.bashrc or ~/.profile).

Alias in .bash_aliases

You can create ~/.bash_aliases with the following command:

touch ~/.bash_aliases

You can now edit the file and put your alias in there in the format:

alias cmd='command'

For example:

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 ls.

Why not in .bashrc or .profile?

.bashrc and .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 .bashrc:

# 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

If .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:

share|improve this answer

Add following to your .bashrc:

 alias sblm='nohup sublime . &'

This will create an alias for the command. You can always execute then sblm, which will be evaluated as nohup sublime . & by your shell.

share|improve this answer
Make a note that if you are not using bash, but something, say ZSH, then you would use the ~/.zshrc file. Make sure you use the rc file for your shell, which should be explained in that shell's manpage. – Thomas Ward Oct 8 '12 at 18:49

You could make a wrapper script something like this -

mkdir -p ~/bin
echo "nohup sublime . &" > ~/bin/sbl
chmod 700 ~/bin/sbl

Now typing 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.