8.41. Psmisc-23.7

The Psmisc package contains programs for displaying information about running processes.

Approximate build time: less than 0.1 SBU
Required disk space: 6.7 MB

8.41.1. Installation of Psmisc

Create the PKGBUILD for the Psmisc package with the following commands:

mkdir /sources/psmisc
cd /sources/psmisc
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="psmisc"
pkgver="23.7"
pkgrel="1"
pkgdesc="The Psmisc package contains programs for displaying information about running processes."
arch=('x86'
      'x86_64')
url="https://gitlab.com/psmisc/psmisc"
license=('GPLv2')
groups=('core')
depends=('glibc'
         'ncurses')
makedepends=('bash'
             'binutils'
             'coreutils'
             'gcc'
             'gettext'
             'grep'
             'make'
             'sed')
source=('https://sourceforge.net/projects/psmisc/files/psmisc/psmisc-23.7.tar.xz')
md5sums=('53eae841735189a896d614cba440eb10')
    
build(){
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr
  make
}

check(){
  cd "${pkgname}-${pkgver}"
  make check
}
package(){
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
REALEOF

Prepare the build directory for the pacman user and build the package:

chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'

Add the newly created package to the central package repository:

cp psmisc-23.7-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/psmisc-23.7-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Psmisc package:

pacman -Syu
pacman -S psmisc --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/psmisc
cp PKGBUILD /srv/pacman/source/LFS/psmisc
cd /sources
rm -rf psmisc

8.41.2. Contents of Psmisc

Installed programs: fuser, killall, peekfd, prtstat, pslog, pstree, and pstree.x11 (link to pstree)

Short Descriptions

fuser

Reports the Process IDs (PIDs) of processes that use the given files or file systems

killall

Kills processes by name; it sends a signal to all processes running any of the given commands

peekfd

Peek at file descriptors of a running process, given its PID

prtstat

Prints information about a process

pslog

Reports current logs path of a process

pstree

Displays running processes as a tree

pstree.x11

Same as pstree, except that it waits for confirmation before exiting