A list of useful commands on PLCnext terminal
sudo update-axcf2152
cat /etc/plcnext/arpversion
ot, to get only the basic info
cat /etc/plcnext/arpversion | grep -i Arpversion | awk '{print $2}'
sudo reboot
sudo recover-axcf2152 1
sudo recover-axcf2152 2
sudo /etc/init.d/plcnext start
sudo /etc/init.d/plcnext stop
sudo /etc/init.d/plcnext restart
tail -f -n 20 /opt/plcnext/logs/Output.log
where "-n 20" is the number of previous lines to show
Move file in /usr/local/lib and then
cd /usr/local/lib
ln -sf _nomelibreria_.so
sudo ldconfig
ifconfig eth0 192.168.1.x netmask 255.255.255.0
route add default gateway 192.168.1.1
sudo echo "nameserver 8.8.8.8" > /etc/resolv.conf
cat /etc/resolv.conf
find . -name tecmint.txt
Looks in the current directory and all sub-directories
With root you can search in every directory
guix package --search=zabbix
guix install zabbix-agentd
top
if you can log in to the PLC then you can take a look at the contents of this file:
nano /opt/plcnext/config/Io/PnS/PnS.local.config
python3 --version
netstat -tn 2>/dev/null | grep -E '\s[0-9.]+:80\s' | awk '{print $5}' | cut -d : -f 1 | sort | uniq -c | sort -nr
Where:
command | description |
---|---|
netstat -tn 2>/dev/null | returns informations all tcp/tcp6 connections |
grep -E '\s[0-9.]+:80\s' | filters rows that contains ip addres with 80 port using regular expressions |
awk '{print $5}' | prints only column 5th that is described as "Foreign Address" that contains connected client ip address with his remote port |
cut -d : -f 1 | extracts only ip address for connected client |
sort | sorts rows to let them to be counted with next command (uniq command) |
uniq -c | counts (-c) neighbouring rows and print them as: number_of_rows row_text |
sort -nr | makes numeric sort (-n) and reverse result (-r) |
date
date -u
date +"%Z %z"
cat /etc/timezone
For the following commands thanks to: https://github.com/plcnextusa/PLCnext-Guides/blob/master/Useful%20Linux%20Commands
usermod -aG sudo username
nano /etc/ssh/sshd_config (remove comment # from the line which says permit root login yes)
echo "" > $(docker inspect --format='{{.LogPath}}' <container_name_or_id>)
grep Arpversion /etc/plcnext/arpversion
cat /etc/device_data/phoenixsign/production_data | grep 'DEVNAME=' | awk -F '\"' '{print $2}' | sed 's/\"//g'
cat /sys/class/net/eth0/address
ifconfig eth0 | awk '/inet addr/ {gsub("addr:", "", $2); print $2}'
./usr/sbin/sdcard_state.sh getStatus
./usr/sbin/sdcard_state.sh getBootDevice
./usr/sbin/sdcard_state.sh request_deactivation
Then reboot the PLC for the change to go into effect.
./usr/sbin/sdcard_state.sh request_activation
Then reboot the PLC for the change to go into effect.
date -s "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')"
free -m | awk 'NR==2{printf "%.2f\n",$3*100/$2 }’
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}'
(root user) /etc/init.d/plcnext restart
(admin user) sudo /etc/init.d/plcnext restart
cat /etc/device_data/phoenixsign/cloud_uuid
cat /etc/device_data/phoenixsign/production_data
cd /usr/share/zoneinfo
ls
sudo unlink /etc/localtime
sudo ln -s /usr/share/zoneinfo/[ZONE NAME HERE] /etc/localtime