Skip to main content
Made the title more general, since the question (and answers) can apply to any model of the RPi.
Link

Is there a Bash command to check if the Which model Raspberry Pi is 2 or 3I am running?

Copy edited (e.g. ref. <http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29> and <http://en.wiktionary.org/wiki/straightforward>). Removed historical information (e.g. ref. <http://meta.stackexchange.com/a/230693>).
Source Link

Is there a Bash command to check if the Pi is Raspberry Pi is 2 or 3?

Is there a Bash command to check if the Pi is Raspberry Pi is 2 or 3?

Is there a way of determining whether the current Raspberry Pi is either a 2 Model B and 3 with Raspbian Jessie Lite 8.0?

This is because I have a particular bootstrap.sh written in Bash where it needs to set the attribute txpower for a Wi-Fi USB dongle (here, Raspberry Pi 2) using a Ralink RT5370 chipset driver.

I set the Wireless attributes using iwconfig (which, I know is deprecated, but it currently gets the job done, so I am not changing it).

Since, in Raspberry Pi 3 the internal Wi-Fi chipset is a bcm-based chipset which will not let the following command execute:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0dBm

With Raspberry Pi 3 the above mentioned command works just by removing dBm from the above mentioned command:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0

I would like to add a check whether the Raspberry Pi model is 2 or 3 using Bash.

Any hints?

In case, someone wants to go through the bootstrap.sh: Bootstrapping for TWIN

Notes

  • I checked that dBm is not required, also in the case of the Raspberry Pi 2 with the Ralink chipset hence for non-ambiguity one can use the same command for both the Raspberry Pis viz.

      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
    
  • It is interesting to note that for external Wi-Fi USB dongles one needs to perform the following (for Raspberry Pi 2):

      ifconfig wlan0 down
      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
      ifconfig wlan0 up
    

    while as for inbuilt Wi-Fi modules (Raspberry Pi 3) there is no need for ifconfig up and down. Just the straightforward iwconfig command works.

Is there a Bash command to check if the Pi is Raspberry Pi 2 or 3?

Is there a way of determining whether the current Raspberry Pi is either a 2 Model B and 3 with Raspbian Jessie Lite 8.0?

This is because I have a particular bootstrap.sh written in Bash where it needs to set the attribute txpower for a Wi-Fi USB dongle (here, Raspberry Pi 2) using a Ralink RT5370 chipset driver.

I set the Wireless attributes using iwconfig (which, I know is deprecated, but it currently gets the job done, so I am not changing it).

Since, in Raspberry Pi 3 the internal Wi-Fi chipset is a bcm-based chipset which will not let the following command execute:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0dBm

With Raspberry Pi 3 the above mentioned command works just by removing dBm from the above mentioned command:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0

I would like to add a check whether the Raspberry Pi model is 2 or 3 using Bash.

Any hints?

In case, someone wants to go through the bootstrap.sh: Bootstrapping for TWIN

Notes

  • I checked that dBm is not required, also in the case of the Raspberry Pi 2 with the Ralink chipset hence for non-ambiguity one can use the same command for both the Raspberry Pis viz.

      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
    
  • It is interesting to note that for external Wi-Fi USB dongles one needs to perform the following (for Raspberry Pi 2):

      ifconfig wlan0 down
      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
      ifconfig wlan0 up
    

    while as for inbuilt Wi-Fi modules (Raspberry Pi 3) there is no need for ifconfig up and down. Just the straightforward iwconfig command works.

Is there a Bash command to check if the Raspberry Pi is 2 or 3?

Is there a way of determining whether the current Raspberry Pi is either a 2 Model B and 3 with Raspbian Jessie Lite 8.0?

This is because I have a particular bootstrap.sh written in Bash where it needs to set the attribute txpower for a Wi-Fi USB dongle (here, Raspberry Pi 2) using a Ralink RT5370 chipset driver.

I set the Wireless attributes using iwconfig (which, I know is deprecated, but it currently gets the job done, so I am not changing it).

Since, in Raspberry Pi 3 the internal Wi-Fi chipset is a bcm-based chipset which will not let the following command execute:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0dBm

With Raspberry Pi 3 the above mentioned command works just by removing dBm from the above mentioned command:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0

I would like to add a check whether the Raspberry Pi model is 2 or 3 using Bash.

Any hints?

In case, someone wants to go through the bootstrap.sh: Bootstrapping for TWIN

Notes

  • I checked that dBm is not required, also in the case of the Raspberry Pi 2 with the Ralink chipset hence for non-ambiguity one can use the same command for both the Raspberry Pis viz.

      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
    
  • It is interesting to note that for external Wi-Fi USB dongles one needs to perform the following (for Raspberry Pi 2):

      ifconfig wlan0 down
      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
      ifconfig wlan0 up
    

    while as for inbuilt Wi-Fi modules (Raspberry Pi 3) there is no need for ifconfig up and down. Just the straightforward iwconfig command works.

Copy edited (e.g. ref. <http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29> and <http://en.wiktionary.org/wiki/straightforward>). Removed historical information (e.g. ref. <http://meta.stackexchange.com/a/230693>).
Source Link

Is there a bashBash command to check if the Pi is Raspberry Pi 2 or 3?

Is there a way of determining whether the current Raspberry Pi is either a 2 Model B and 3 with Raspbian Jessie Lite 8.0?

This is because I have a particular bootstrap.sh written in bashBash where it needs to set the attribute txpower for WiFia Wi-Fi USB Dongledongle (here, Raspberry Pi 2) using a Ralink RT5370 Chipsetchipset driver.

I set the Wireless attributes using iwconfig (which, I know is deprecated, but it currently gets the job done, so I am not changing it).

Since, in PiRaspberry Pi 3 the internal WiFiWi-Fi chipset is, a bcm based-based chipset which will not let the following command execute:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0dBm

Edit (1)

withWith Raspberry Pi 3 the above mentioned command works with just by removing dBm from the above mentioned command:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0

I would like to add a check whether the Raspberry Pi model is 2 or 3 using bashBash.

Any hints?

In case, someone wants to go through the bootstrap.sh  : Bootstrapping for TWIN

Notes + Edit (2)

  • I checked that dBm is not required, also in the case of the PiRaspberry Pi 2 with the Ralink Chipsetchipset hence for non-ambiguity one can use the same command for both the pisRaspberry Pis viz.

      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
    
  • It is interesting to note that for External WiFiexternal Wi-Fi USB Donglesdongles one needs to perform the following (for PiRaspberry Pi 2):

      ifconfig wlan0 down
      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
      ifconfig wlan0 up
    

    while as for Inbuilt WiFi Modulesinbuilt Wi-Fi modules (PiRaspberry Pi 3) there is no need for ifconfig up and down. Just the straight forwardstraightforward iwconfig command works.

Is there a bash command to check if the Pi is Raspberry Pi 2 or 3

Is there a way of determining whether the current Raspberry Pi is either a 2 Model B and 3 with Raspbian Jessie Lite 8.0?

This is because I have a particular bootstrap.sh written in bash where it needs to set the attribute txpower for WiFi USB Dongle (here, Raspberry Pi 2) using a Ralink RT5370 Chipset driver.

I set the Wireless attributes using iwconfig (which, I know is deprecated but currently gets the job done so I am not changing it)

Since, in Pi 3 the internal WiFi chipset is, bcm based chipset which will not let the following command execute:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0dBm

Edit (1)

with Pi 3 the above mentioned command works with just by removing dBm from the above mentioned command:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0

I would like to add a check whether the Pi model is 2 or 3 using bash

Any hints?

In case, someone wants to go through the bootstrap.sh  : Bootstrapping for TWIN

Notes + Edit (2)

  • I checked that dBm is not required also in the case of the Pi 2 with Ralink Chipset hence for non-ambiguity one can use the same command for both the pis viz.

      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
    
  • It is interesting to note that for External WiFi USB Dongles one needs to perform the following (for Pi 2):

      ifconfig wlan0 down
      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
      ifconfig wlan0 up
    

    while as for Inbuilt WiFi Modules (Pi 3) there is no need for ifconfig up and down. Just the straight forward iwconfig command works.

Is there a Bash command to check if the Pi is Raspberry Pi 2 or 3?

Is there a way of determining whether the current Raspberry Pi is either a 2 Model B and 3 with Raspbian Jessie Lite 8.0?

This is because I have a particular bootstrap.sh written in Bash where it needs to set the attribute txpower for a Wi-Fi USB dongle (here, Raspberry Pi 2) using a Ralink RT5370 chipset driver.

I set the Wireless attributes using iwconfig (which, I know is deprecated, but it currently gets the job done, so I am not changing it).

Since, in Raspberry Pi 3 the internal Wi-Fi chipset is a bcm-based chipset which will not let the following command execute:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0dBm

With Raspberry Pi 3 the above mentioned command works just by removing dBm from the above mentioned command:

iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0

I would like to add a check whether the Raspberry Pi model is 2 or 3 using Bash.

Any hints?

In case, someone wants to go through the bootstrap.sh: Bootstrapping for TWIN

Notes

  • I checked that dBm is not required, also in the case of the Raspberry Pi 2 with the Ralink chipset hence for non-ambiguity one can use the same command for both the Raspberry Pis viz.

      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
    
  • It is interesting to note that for external Wi-Fi USB dongles one needs to perform the following (for Raspberry Pi 2):

      ifconfig wlan0 down
      iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
      ifconfig wlan0 up
    

    while as for inbuilt Wi-Fi modules (Raspberry Pi 3) there is no need for ifconfig up and down. Just the straightforward iwconfig command works.

Tweeted twitter.com/StackRaspi/status/829439238412312576
Added Observations for Posterity for WiFi configs on both Pis
Source Link
Shan-Desai
  • 1.5k
  • 2
  • 13
  • 28
Loading
added pi3 power setting
Source Link
Shan-Desai
  • 1.5k
  • 2
  • 13
  • 28
Loading
Source Link
Shan-Desai
  • 1.5k
  • 2
  • 13
  • 28
Loading