If you’d like to add your own command line tip please reply to this post
How to login to the raspberry pi via terminal (SSH)
ssh pi@*** (*** = or IP-address from Pi or domain name)
Password = emonpi2016 (standard password if you didn’t change it)
Safely shutdown or reboot a raspberry pi
after you logged in via SSH you can issue these commands
shutdown :
sudo shutdown -h now
-or-
sudo poweroff
reboot :
sudo shutdown -r now
-or-
sudo reboot
Factory Reset
Factory reset can be made by connecting via ssh then running:
sudo su
~/emonpi/./factoryreset
Warning - destroys all data!
Troubleshooting - Guide | OpenEnergyMonitor
Maintain crontab files
List cron for user Pi
crontab -l -u pi
List cron for root
sudo crontab -l
Edit cron for user Pi *
crontab -e -u pi
Edit cron for root *
sudo crontab -e
* for low-write emon devices, use rpi-rw to unlock filesystem and allow write access.
Determine emonSD image version
ls /boot | grep emonSD
Display_PHPfina_Feed_Interval
To determine feed interval and start time of feed.
cd /home/pi/data/phpfina
od -i 1.meta
response:
0000000 0 0 10 1435712370
0000020
10 is interval in seconds
1435712370 is start time in unix epoch
Submitted by chaveiro on Mon, 27/07/2015 - 12:30
Get status of all Services
Runs all init scripts, in alphabetical order, with the status command. The status is:
[ + ] for running services
[ - ] for stopped services and
[ ? ] for services without a ‘status’ command
sudo service --status-all
#emon Node-RED
including npm & node.js
Status or Restart of Node-RED Service
Use the below commands to get the status or restart Node-RED
sudo service nodered status
sudo service nodered restart
Version number of Node-RED
npm show node-red version
npm show node-red version -g
Node-RED items in syslog
Display Node-RED items saved in syslog
sudo cat /var/log/syslog | grep "Node-RED"
Output Node-RED items in syslog
sudo tail -f /var/log/syslog | grep "Node-RED"
Version of npm
npm is used for installing installing nodes for Node-RED
npm -v
sudo npm -v
List user installed Nodes with version info
run command from the Node-RED install directory
cd /home/pi/.node-red
npm list -g | grep emoncms
npm list | grep emoncms
Upgrade of NPM version 1.x to version 2.x *
sudo npm install -g [email protected]
logout
* for low-write emon devices, use rpi-rw to unlock filesystem and allow write access.
Check for outdated Node-RED npm packages
npm outdated --prefix ~/.node-red
-or-
cd ~/.node-red
npm outdated
to check for outdated global npm packages:
npm outdated -g
Version of node.js
node -v
sudo node -v
Check if Redis is running
redis-cli PING
If running, the response should be “PONG”
Flush Redis
redis-cli flushall
#emon mySQL
Access mySQL database
for advanced users only (this leaves me out!)
mysql -u emoncms -p emonpiemoncmsmysql2016 emoncms
Show emoncms tables
mysql> show tables;
Display Feed info
Display ID number, feed id Name, Tag for feed, Datatype (realtime, daily, etc), Public (or private), Size of feed, Engine used for feed (phpfina or phptimeseries, etc.), and Process List for all Feeds
mysql> select * from feeds;
Selectively monitor log file in real time
Display new lines with a string (e.g., “NEW FRAME : OK 5”) in the emonhub.log file:
tail -f /var/log/emonhub/emonhub.log | grep "NEW FRAME : OK 5"
Selectively display log file
Display all lines with a string (e.g., “NEW FRAME : OK 5”) in the emonhub.log file:
cat /var/log/emonhub/emonhub.log | grep "NEW FRAME : OK 5"
Display all lines with two strings (e.g., “mqtt” or “mosquitto”) in the syslog file:
cat /var/log/syslog | grep -ie mqtt -e mosquitto
Thank you to @Paul, @bidouilleur, @Bill.Thomson, @Robert.Wall, @glyn.hudson, @pb66 for their help in creating this post.