You are not logged in.
Pages: 1
Hi,
I have returned to linux after 9 years.
First I have tried Thumbleweed. It is fine working distro out of box, but somehow inside I still had Arch, as it was distro I used before.
Then I have returned here, but seriously, pacman search output is horrible for reading.
I was trying to find script to do it better. In the end, the final way was chatgpt (as long as I am not big bash scripter) and output like zypper as it was perfect for me.
Here is script for pacman output as zypper:
#!/bin/bash
# Hlavička
printf "\n"
printf "%-1s | %-25s | %-21s | %-15s | %s\n" "I" "Name" "Version" "Repo" "Description"
printf "%s\n" "--+---------------------------+-----------------------+-----------------+-----------------------------------------------------------------"
installed_pkgs=$(pacman -Qq)
pacman -Ss --color=always $@ | awk -v installed="$installed_pkgs" '
function strip_colors(s) {
gsub(/\033\[[0-9;]*m/, "", s)
return s
}
NR % 2 == 1 {
orig = $1
split(orig, a, "/")
pkg_clean = strip_colors(a[2])
if (seen[pkg_clean]++) next
repo_colored = a[1] "\033[0m" # uzavře barvu
ver = $2
installed_flag = (index(installed, pkg_clean) > 0 ? "i" : " ")
getline desc
sub(/^ /, "", desc)
printf "%-1s | %-25s | %-32s | %-26s | %s#*\n", installed_flag, pkg_clean, ver, repo_colored, desc
}'here it is as it looks like:

So in the end, it formats like zypper output and does not show duplicated packages from non-V3 repos (it shows first one found - so priority repo)
However, it has fixed table layout. Very long names/versions/descriptions broke it a little. I have tried dynamic one with chatgpt but still some errors and search had some lags due to cycles etc.
If there is anyone skilled in this on this forum, maybe he can finish this to perfect. Or maybe check how zypper do it.
If not, I am leaving it here for anyone interested in better output. In the end, it works ![]()
Last edited by LukynZ (2026-02-03 11:50:58)
Offline
Pages: 1