To add a user to the sudoers group
Log into the Raspberry Pi as Pi, and add the user with
sudo adduser <username>
Then use usermod to add the user to the specified group:
sudo usermod -G <group> -a <username>
Group is the name of the group, for example sudo.
To set up a Raspberry PI as FTP server
Follow this link
Rotate the screen
If you have one monitor rotated, you can rotate the Raspberry Pi screen, by editing the /boot/config.txt - file
sudo nano /boot/config.txt
At the bottom, add this line:
display_rotate=1
0 = normal config
1 = 90 degrees
2 = 180 degrees
3 = 270 degrees
Save and reboot!
To check which version of RPi you have
When you have many different Raspberry Pis, and you don't know which is which model, run this command to get the model:
cat /sys/firmware/devicetree/base/model
I ran it on two and got this:
Raspberry Pi 2 Model B Rev 1.1
Raspberry Pi 3 Model B Plus Rev 1.3
To install PIP
sudo apt-get install python-pip
To install Beautiful Soup
sudo pip install bs4
sudo apt-get instal python-requests
To get IP addr on eth0
ifconfig eth0 | grep 'inet' | cut -d: -f2 | awk '{print $2}'
my_ip = ([l for l in ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2]
if not ip.startswith("127.")][:1], [[(s.connect(('8.8.8.8', 53)),
s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET,
socket.SOCK_DGRAM)]][0][1]]) if l][0][0])
To start a program at boot time
Add program befor exit 0 in this file.
nano /ets/rc.local
Crontab
To run script automatic, place them in a crontab file:
crontab -e
Add this line at the end:
0 * * * * /usr/bin/python3 /home/pi/your_script.py -> /home/pi/CRON_LOG.txt 2>&1
Install Adafruit for DHT and Python
sudo apt-get install git-core
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo apt-get install build-essential python-dev
sudo python setup.py install
Check which WiFi Raspberry is connected to
iwgetid
List of all registeres WiFi's
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Reconnect to new network:
wpa_cli -i wlan0 reconfigure
DD command
sudo dd if=sensor.iso of=/dev/sdg BS=4M status=progress