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

Tuesday, December 1, 2020

Check installed package in Raspberry Pi OS, using dpkg/dpkg-query

To list all installed packages, enter the command in Terminal:

$ dpkg -l

or

$ dpkg-query -l

To list about a specified package:

$ dpkg -l package-name-pattern

or

$ dpkg-query -l package-name-pattern



dpkg is a tool to install, build, remove and manage Debian packages. It can also be used as a front-end to dpkg-deb and dpkg-query. 

dpkg-query is a tool to show information about packages listed in the dpkg database.

With command "-l [package-name-pattern...]" list all known packages matching one or more patterns. If no package-name-pattern is given, list all packages in /usr/local/var/lib/dpkg/status, excluding the ones marked as not-installed (i.e.  those which have been previously purged).

The first three columns of the output show the desired action, the package status, and errors, in that order.

              Desired action:
                u = Unknown
                i = Install
                h = Hold
                r = Remove
                p = Purge

              Package status:
                n = Not-installed
                c = Config-files
                H = Half-installed
                U = Unpacked
                F = Half-configured
                W = Triggers-awaiting
                t = Triggers-pending
                i = Installed

              Error flags:
                <empty> = (none)
                R = Reinst-required




Wednesday, February 20, 2019

Check glibc version

To check the glibc version in Raspberry Pi/Raspbian, simple enter the command in Terminal:

$ ldd --version

Work on Raspberry Pi/Raspbian:

Also work on Linux Mint:

Thursday, March 10, 2016

Display WiFi config using Linux command iwconfig


Iwconfig is similar to ifconfig(8), but is dedicated to the wireless interfaces. It is used to set the parameters of the network interface which are specific to the wireless operation (for example : the frequency). Iwconfig may also be used to display those parameters, and the wireless statistics (extracted from /proc/net/wireless).

All these parameters and statistics are device dependent. Each driver will provide only some of them depending on hardware support, and the range of values may change. Please refer to the man page of each device for details.

This video show iwconfig run on Raspberry Pi 3/Raspbian Jessie with build-in WiFi, to display WiFi info:


We can get WiFi link quality with command:
$ iwconfig wlan0 | grep -i quality



Sunday, September 27, 2015

Search for available package, and know the version before install

apt-cache is a low-level tool used to query information from APT's binary cache files.


You can search available package with"
$ apt-cache search package


or know the details of the package; such as version
$ apt-cache show package


Wednesday, April 8, 2015

Python to get uptime of Raspberry Pi, in second

In linux, the command "$ cat /proc/uptime" shows how long the system has been on since it was last restarted. ~ http://en.wikipedia.org/wiki/Uptime#Using_uptime


This Python example code get uptime in second, run on Raspberry Pi:
import os

uptime = os.popen("awk '{print $1}' /proc/uptime").readline()
print("uptime(sec) = "+uptime)


Wednesday, April 1, 2015

List all Linux command available - compgen

To list all available Linux command can be run:
$ compgen -c

To list all command start with "ls"
$ compgen -c ls

To list all command contain the letters "ls"
$ compgen -c | grep ls



Wednesday, March 25, 2015

How to list info of installed package

dpkg-query is a tool to show information about packages listed in the dpkg database.

Examples:



Tuesday, March 17, 2015

Read CPUs frequency of Raspberry Pi 2

There are 4 cpu core on Raspberry Pi 2. ls /sys/devices/system/cpu show 4 cpu, cpu0~cpu3. The files hold the scaling current frequency of each cpu.
/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

Tested on Raspberry Pi 2, running Raspbian.


Related:

Get CPU load from /proc/loadavg

/proc
The proc filesystem is a pseudo-filesystem which provides an interface to kernel data structures.  It is commonly mounted at /proc.  Most of it is read-only, but some files allow kernel variables to be changed.

/proc/loadavg
The first three fields in this file are load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1, 5, and 15 minutes.  They are the same as the load average numbers given by uptime(1) and other programs.  The fourth field consists of two numbers separated by a slash (/).  The first of these is the number of currently runnable kernel scheduling entities (processes, threads).  The value after the slash is the number of kernel scheduling entities that currently exist on the system.  The fifth field is the PID of the process that was most recently created on the system.

reference: http://man7.org/linux/man-pages/man5/proc.5.html

Test on Raspberry Pi running Raspbian.


Related:
- Python display Raspberry Pi load average graphically

Monday, March 16, 2015

View dynamic system info with Linux command top and htop

$ top

The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of processes or threads currently being managed by the Linux kernel. The types of system summary information shown and the types, order and size of information displayed for processes are all user configurable and that configuration can be made persistent across restarts.

The program provides a limited interactive interface for process manipulation as well as a much more extensive interface for personal configuration--encompassing every aspect of its operation. And while top is referred to throughout this document, you are free to name the program anything you wish. That new name, possibly an alias, will then be reflected on top's display and used when reading and writing a configuration file.


$ htop

Htop is a free (GPL) ncurses-based process viewer for Linux.

It is similar to top, but allows you to scroll vertically and horizontally, so you can see all the processes running on the system, along with their full command lines.

Tasks related to processes (killing, renicing) can be done without entering their PIDs.

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




Tuesday, March 10, 2015

Wednesday, July 16, 2014

Read Raspberry Pi CPU temperature

In Raspbian, the file /sys/class/thermal/thermal_zone0/temp keep the CPU temperature, in 1000 (C degree). We can read Raspberry Pi CPU temperature with the command:

$ cat /sys/class/thermal/thermal_zone0/temp


Tuesday, July 15, 2014

List installed package with dpkg

Enter the dpkg command with -l option to list installed packabe:

$ dpkg -l


/etc/apt/sources.list, packages sources

As part of its operation, Apt uses a file that lists the 'sources' from which packages can be obtained. This file is /etc/apt/sources.list.

Source and details: https://wiki.debian.org/SourcesList