User avatar
Posts: 15
Joined: Wed Dec 17, 2014 5:15 am
Location: Raleigh, NC
Contact: Website

GPIO from command line

Wed Dec 17, 2014 5:21 am

I am trying to do the first thing with GPIOs, that is, turning one on.
It seems I'm missing something or I skipped a lesson. What do I have to do to get the gpio command to work from the command line, bash, logged in a terminal?
When I type
I get
-bash: gpio: command not found
There is no manpage for gpio.
I'm using Debian Wheezy on a Raspberry PI B

User avatar
Posts: 14468
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: GPIO from command line

Wed Dec 17, 2014 6:28 am

You'll need to install the Wiring Pi utilities from

There are full instructions on how to download and install them on that site.

User avatar
Posts: 1086
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: GPIO from command line

Wed Dec 17, 2014 6:37 am

You dont even need "gpio" package. The RPi GPIOs can be accessed as files. Have a look at ... rials/gpio

User avatar
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: GPIO from command line

Wed Dec 17, 2014 6:08 pm

If you want the gpio command to work then you need wiringpi, but you can manipulate it using files as has been said.

example bash script using nothing but the built in software to flash an led connected to gpio 9 :

Code: Select all

echo 9 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio9/direction
while [[ : ]]
    echo 1 > /sys/class/gpio/gpio9/value
    sleep 1
    echo 0 > /sys/class/gpio/gpio9/value
    sleep 1
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

Return to “Beginners”