You are not logged in.
Pages: 1
Just thought i would share this here and ask a question or two..be mindful im only learning and hope to improve.
This is just a practice script to show system info but in a very basic way, has nothing on programs like neofetch or screenfetch etc.
So below is my effort so far and just want to know if this would work on your devuan system ok. Also id like to figure out a better method of displaying the window manager instead of using wmctrl, like something in coreutils.
Anyhow, needs bash and wmctrl as a dependency and is only work for devuan, i hope
#!/usr/bin/env bash
titles=('\e[1;34m%-6s\e[m\t') # blue titles
line=('\e[1;31m%-37s\e[m\n') # red line
printf "\n"
printf "\t" ; echo "$(whoami)@$(hostname)"
printf $line | tr ' ' -
printf $titles "os:" ; cat /etc/os-release | awk 'NR==1' | sed 's/............//;s/.//;s/.$//g'
printf $titles "kernel:" ; uname --kernel-release
printf $titles "uptime:" ; uptime -p | sed 's/^...//g'
printf $titles "pkgs:" ; dpkg -l | wc -l
printf $titles "memory:" ; free -mh | awk 'NR==2 {print $3" / "$2}'
printf $titles "wm:" ; wmctrl -m | awk 'NR==1 {print $2}'
printf $titles "shell:" ; echo $SHELL
printf $titles "editor:" ; echo $EDITOR
echo $'\e7\e[2;800H\e[16D\e[7m' $(date +"%Y/%m/%d %H:%M")$'\e8'
printf "\n"
prints out this with some colors and stuff like so.
user@hostname
-------------------------------------
os: Devuan GNU/Linux 3 (beowulf)
kernel: 4.19.0-9-amd64
uptime: 1 hour, 59 minutes
pkgs: 813
memory: 721Mi / 7.7Gi
wm: dwm
shell: /bin/bash
editor: vim
Last edited by HevyDevy (2020-06-13 13:04:23)
Offline
also trying to work on incorporating the devuan logo in ascii somehow and also display manager and de for those who use them.
Last edited by HevyDevy (2020-06-13 13:07:28)
Offline
just want to know if this would work on your devuan system
It works pretty good here. I noticed the editor line at the bottom was empty though. Is that because I do not have a default editor configured?
-------------------------------------
os: Devuan GNU/Linux 4 (chimaera/ceres)
kernel: 5.6.0-2-amd64
uptime: 4 hours, 15 minutes
pkgs: 2028
memory: 4.0Gi / 15Gi
wm: Xfwm4
shell: /bin/bash
editor:
I did have to install wmctl as it was not installed.
Last edited by nixer (2020-06-13 13:38:38)
Offline
Thanks nixer,
yeah if you havent got $EDITOR configured in .bashrc i dont think the script will display editor.
just put this in your bashrc
export EDITOR='vim'
replace vim for whatever editor you like.
cheers
Offline
Works for me, but I had to install the wmctrl package as it's not there by default.
user@hostname
-------------------------------------
os: Devuan GNU/Linux 3 (beowulf)
kernel: 4.19.0-9-amd64
uptime: 22 hours, 44 minutes
pkgs: 2102
memory: 3.1Gi / 7.8Gi
wm: Mutter
shell: /bin/bash
editor: /usr/bin/gedit
Offline
Thanks Marjorie, ill see if i can get rid of that dependency on wmctrl.
Offline
Works here on my beowulf. I didn't feel like installing wmctrl, so I changed that line to
printf $titles "wm:" ; basename $(cat /etc/X11/default-display-manager)
Offline
Works here on my beowulf. I didn't feel like installing wmctrl, so I changed that line to
printf $titles "wm:" ; basename $(cat /etc/X11/default-display-manager)
Thanks fsmithred, that would work nicely for display managers i will add that in. cheers
Offline
printf $titles "os:" ; cat /etc/os-release | awk 'NR==1' | sed 's/............//;s/.//;s/.$//g'
You don't need cat:
printf $titles "os:" ; awk 'NR==1' /etc/os-release | sed 's/............//;s/.//;s/.$//g'
Or with awk alone:
printf $titles "os:" ; awk -F'"' '/PRETTY/{print $2}' /etc/os-release
printf $titles "pkgs:" ; dpkg -l | wc -l
That will return a slightly larger number because the dpkg output prints an information section and also lists some non-installed packages, try this instead:
printf $titles "pkgs:" ; dpkg -l | grep -c '^ii'
Brianna Ghey — Rest In Power
Offline
Nice, thanks Hoas. I was thinking that cat was not needed.
Offline
Works here. Installed wmctrl to show fluxbox, then saw fsmithred's edit and tried it. The difference: wmctrl capitalizes the 'F' in fluxbox, default-display-manager doesn't.
-------------------------------------
os: Devuan GNU/Linux 4 (chimaera/ceres)
kernel: 5.4.0-0.bpo.2-rt-amd64
uptime: 10 days, 2 hours, 22 minutes
pkgs: 865
memory: 93Mi / 3.7Gi
wm: fluxbox
shell: /bin/bash
editor: nano
Offline
Thanks fanderal, ive installed xdm display manager and tried that command of fsmithred but only get xdm (i have dwm as wm), must only work for lxdm, lightdm, gdm etc, what display manager are you using?
Last edited by HevyDevy (2020-06-14 09:58:34)
Offline
Pages: 1