Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, December 9, 2020

Display system info with neofetch

neofetch is a Terminal-based tools to displays information about your operating system, software and hardware in visual way.

To install neofetch to Raspberry Pi OS, enter the command:

$ sudo apt install neofetch



Friday, December 4, 2020

Test network speed between Raspberry Pi using iPerf3

iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, buffers and protocols (TCP, UDP, SCTP with IPv4 and IPv6). For each test it reports the bandwidth, loss, and other parameters.

This post show how to run iPerf3 on two Raspberry Pi to check the network speed between.

On both Raspberry Pi, install iPerf3 by entering command in Terminal:

$ sudo apt install iperf3
After installed.

In the service side, enter the command:
$ iperf3 -s
In the client side, enter command:
$ iperf3 -c <server ip>




Monday, July 15, 2019

Free Linux Journal's THE 25TH ANNIVERSARY ISSUE

To get your free issue of this Linux Journal April 2019 issue (THE 25TH ANNIVERSARY ISSUE), simply visit HERE and type in your e-mail

Monday, April 13, 2015

Resize file system on microSD of Ubuntu MATE 15.04 for Raspberry Pi 2

This post show how to resize file system on microSD with Ubuntu MATE 15.04 for Raspberry Pi 2 installed, using Linux GUI application GParted run on another Linux machine.

To install GParted, enter the command:
$ sudo apt-get install gparted

This video show how:


After resized and boot up Ubuntu MATE on Raspberry Pi 2, now I have 15.7G on a 16G microSD.




This page (eLinux: RPi Resize Flash Partitions http://elinux.org/RPi_Resize_Flash_Partitions) describes activities relating to partitions on the Raspberry Pi for Linux based operating systems, such as Raspian Linux. It may also apply to other operating systems too, but you should check. Incorrectly using the instructions is likely to corrupt your system.

Monday, March 30, 2015

Python display CPUs frequency graphically, run on Raspberry Pi 2/Linux


In Linux, the file "/sys/devices/system/cpu/*/cpufreq/scaling_cur_freq" show the available frequency your CPU(s) are scaled to currently, in KHz.

In Raspberry Pi 2/Raspbian, where is:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq

This Python 2 example run on Raspberry Pi 2, to display CPU frequency graphically. (It seem that all CPU run on the same frequency)


plotCpuFreq.py
import os
import matplotlib.pyplot as plt
from drawnow import *

# Run on Raspberry Pi 2
# 4 CPUs
cpu0Freq = []
cpu1Freq = []
cpu2Freq = []
cpu3Freq = []

plt.ion()
cnt=0

def plotCpuFreq():
    plt.ylim(0,1500000)
    plt.title('Raspberry Pi 2 CPUs Frequency')
    plt.grid(True)
    plt.ylabel('KHz')
    plt.plot(cpu0Freq, 'r^-', label='cpu0')
    plt.plot(cpu1Freq, 'c>-', label='cpu1')
    plt.plot(cpu2Freq, 'bv-', label='cpu2')
    plt.plot(cpu3Freq, 'm<-', label='cpu3')
    plt.legend(loc='upper right')

#pre-load dummy data
for i in range(0,100):
    cpu0Freq.append(0)
    cpu1Freq.append(0)
    cpu2Freq.append(0)
    cpu3Freq.append(0)
    
while True:
    cpu0 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq").readline()
    cpu1 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq").readline()
    cpu2 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq").readline()
    cpu3 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq").readline()

    print(cpu0 + " " + cpu1 + " " + cpu2 + " " + cpu3)
    cpu0Freq.append(cpu0)
    cpu0Freq.pop(0)
    cpu1Freq.append(cpu1)
    cpu1Freq.pop(0)
    cpu2Freq.append(cpu2)
    cpu2Freq.pop(0)
    cpu3Freq.append(cpu3)
    cpu3Freq.pop(0)
    
    drawnow(plotCpuFreq)
    plt.pause(1)



To install needed libraries on Raspberry Pi, refer to "Install numpy, matplotlib and drawnow for Python 2".


The almost same code run on Linux with dual core.


plot2CpuFreq.py
import os
import matplotlib.pyplot as plt
from drawnow import *

# Run on Dual Core Atom
# with 2 CPU
cpu0Freq = []
cpu1Freq = []

plt.ion()
cnt=0

def plotCpuFreq():
    plt.ylim(0,2000000)
    plt.title('Dual Core CPUs Frequency')
    plt.grid(True)
    plt.ylabel('KHz')
    plt.plot(cpu0Freq, 'r^-', label='cpu0')
    plt.plot(cpu1Freq, 'c>-', label='cpu1')
    plt.legend(loc='upper right')

#pre-load dummy data
for i in range(0,100):
    cpu0Freq.append(0)
    cpu1Freq.append(0)
    
while True:
    cpu0 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq").readline()
    cpu1 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq").readline()

    print(cpu0 + " " + cpu1)
    cpu0Freq.append(cpu0)
    cpu0Freq.pop(0)
    cpu1Freq.append(cpu1)
    cpu1Freq.pop(0)
    
    drawnow(plotCpuFreq)
    plt.pause(1)



Saturday, March 28, 2015

Python display memory usage on Raspberry Pi/Linux

Linux command free display amount of free and used memory in the system. This example run the command "free -h" using Python, to display memory usage. It work on Raspberry Pi and also other Linux.



#Linux command free - Display amount of free and used memory in the system
# Example:
#pi@raspberrypi ~ $ free -h
#             total       used       free     shared    buffers     cached
#Mem:          863M       272M       591M         0B        19M       174M
#-/+ buffers/cache:        77M       785M
#Swap:          99M         0B        99M
#
# This sample run "free -h" in Python and get the result 
import os 

def getFreeDescription():
    free = os.popen("free -h")
    i = 0
    while True:
        i = i + 1
        line = free.readline()
        if i==1:
            return(line.split()[0:7])
                                 
def getFree():
    free = os.popen("free -h")
    i = 0
    while True:
        i = i + 1
        line = free.readline()
        if i==2:
            return(line.split()[0:7])

# Disk information
description = getFreeDescription()
mem = getFree()

print(description)
print(mem)
print(description[0] + " : " + mem[1])
print(description[1] + " : " + mem[2])
print(description[2] + " : " + mem[3])
print(description[3] + " : " + mem[4])
print(description[4] + " : " + mem[5])
print(description[5] + " : " + mem[6])


Run on Raspberry Pi 2/Raspbian:

Run on Ubuntu Linux:

Wednesday, January 29, 2014

A beginners guide to the Unix and Linux

UNIX Tutorial for Beginners is a on-line beginners guide to the Unix and Linux operating system. Eight simple tutorials which cover the basics of UNIX / Linux commands.

UNIX Tutorial for Beginners
UNIX Tutorial for Beginners
This tutorial is available for download so you can work offline, download.

Monday, October 28, 2013

Linus Torvalds Interviewed on Stage at LinuxCon + CloudOpen Europe 2013

Linus Torvalds Interviewed on Stage at LinuxCon + CloudOpen Europe 2013
From LinuxCon + CloudOpen Europe 2013 in Edinburgh, UK. Dirk Hohndel and Linus Torvalds discuss what's next for Linux and the Linux kernel.