this post was submitted on 30 Dec 2025
14 points (93.8% liked)

Linux

63755 readers
642 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS
 

Honestly I don't know if anyone needs this, as most stuff can be done with simple processing of standard text anyway. I had a bit fun finding out how to convert the output format. If there is an easier way to do this, so be it. At least this was an exercise for me. So here it is.

flatpak-list-json

#!/usr/bin/env bash

# Flatpak list output as JSON format

# Examples with jq:
#   flatpak-list-json | jq -r '.[].name'
#   flatpak-list-json | jq -r '.[0:2].[].application'
#   flatpak-list-json | jq '.[0:2]'
#   flatpak-list-json | jq '.[] | select(.description | contains("video"))'

columns='name,description,application,version,branch,branch,arch,runtime,origin,installation,ref,active,latest,size,options'

# Default show all flatpaks, use flatpak --app or --runtime option to limit type of package.
flatpak list --app --columns "${columns}" |
    column \
        --json \
        --table-name 'flatpak' \
        --table-columns "${columns}" \
        --separator $'\t' \
        --keep-empty-lines |
    jq '.flatpak[0:]'

It simply outputs the flatpak list as a JSON data. This can be used with other software that processes JSON. A few examples are given using the standalone jq app. The script itself uses following commands: flatpak column jq.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here