Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 5 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
    temp=48.7'C
    
share|improve this answer
    
Exactly what I need. Thanks :) –  Ye Myat Aung Jan 3 '13 at 14:20
add comment

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

From anywhere: $ . ~/.profile

From your home dir: $ . .profile

share|improve this answer
add comment

Your Answer

 
discard

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.