Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. 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

I'm very new to Linux environment and I just got myself a Pi to play with it. Recently I found this command to check my Pi's temperature which is /opt/vc/bin/vcgencmd measure_temp

Is it possible to save that command somewhere with a shortcut or an alias? So that I could just type in like checktemp and it would run the command.

Ignore me if I'm asking a nonsense question.

share|improve this question
up vote 6 down vote accepted

You can use the alias command. To make it persistent, you'll have to modify the ~/.bash_aliases file.

  1. Open the ~/.bash_aliases file with your favorite editor (nano, vim, ...)

    $ nano ~/.bash_aliases
  2. Add to the end of the file the following line

    alias checktemp='/opt/vc/bin/vcgencmd measure_temp'

    , where checktemp is the command you want to use.

  3. Exit your bash session:

    $ exit

    Then log in.

  4. You are ready to use your brand new command:

    $ checktemp
share|improve this answer
Exactly what I need. Thanks :) – Ye Myat Aung Jan 3 '13 at 14:20

Don't need to exit bash, just reload your profile.

From anywhere: $ . ~/.profile

From your home dir: $ . .profile

share|improve this answer

What they did above was good. FYI .bash_aliases is not there by default in new Raspian OS. If you are using a non-root user to run these change the above that Morgan Courbet Said to this:

alias checktemp='sudo /opt/vc/bin/vcgencmd measure_temp'

Then reload like the others said like this:

. ~/.bash_aliases

So you can add a .bash_aliases and still work. I think its better than putting into another file since you usually want many aliases to make it easier. Also, for the sudo command to work, you need to have you user in visudo like this.



I hope this helps clarify some.

share|improve this answer

This article explains the command you are looking for: alias command

share|improve this answer
Welcome to the Rapsberry PI StackExchange. Generally speaking, link only answers are against best practices. While it's important to cite sources, a better answer would include at least a high level summary of the links content and an example. Links have a tendency to "rot". – Jacobm001 Jun 11 '15 at 15:39

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.