Americas

  • United States
sandra_henrystocker
Unix Dweeb

Fetching Linux system details with screenfetch and neofetch

How-To
Nov 30, 20205 mins
Linux

Here's how to use screenfetch and neofetch commands to display some of the most important configuration information on your Linux system.

Two very useful tools for extracting essential details on your Linux system OS and hardware are screenfetch and geofetch.

Each of these tools is actually a lengthy bash script that fetches the information from your system for you and presents it in an attractive manner with the distribution logo on the left and details on the right–essentially “screen shots” of your system. Neither is likely to be installed on your system by default, but each can be installed with a single command.

screenfetch

You can install screenfetch with sudo apt install screenfetch or sudo yum install screenfetch. Screenfetch is a script with nearly 6,500 lines. It will automatically detect your distribution and display the distribution, kernel, uptime, number of packages installed, shell you’re using, overall and available disk space, CPU, GPU and memory (in use and available). It also displays an ASCII art rendition of the logo related to whatever distribution it’s run on, but you can turn this off if you want to see just the list of details.

The output from this command will look something like this (on Ubuntu), but in color:

$ screenfetch
                          ./+o+-       shs@dragonfly
                  yyyyy- -yyyyyy+      OS: Ubuntu 20.04 focal
               ://+//////-yyyyyyo      Kernel: x86_64 Linux 5.4.0-52-generic
           .++ .:/++++++/-.+sss/`      Uptime: 25d 23h 44m
         .:++o:  /++++++++/:--:/-      Packages: 2882
        o:+o+:++.`..```.-/oo+++++/     Shell: bash 5.0.17
       .:+o:+o/.          `+sssoo+/    Disk: 62G / 541G (12%)
  .++/+:+oo+o:`             /sssooo.   CPU: Intel Core2 Duo E8400 @ 2x 2.997GHz
 /+++//+:`oo+o               /::--:.   GPU: AMD/ATI Caicos [Radeon HD 6450/7450/8450
 +/+o+++`o++o               ++////.   RAM: 915MiB / 5944MiB
  .++.o+++oo+:`             /dddhhh.
       .+.o+oo:.          `oddhhhh+
        +.++o+o``-````.:ohdhhhhh+
         `:o+++ `ohhhhhhhhyo++os:
           .o:`.syhhhhhhh/.oo++o`
               /osyyyyyyo++ooo+++/
                   ````` +oo+++o:
                          `oo++.

To omit the ASCII art logo and see just the system details, add a -n option.

$ screenfetch -n
 shs@dragonfly
 OS: Ubuntu 20.04 focal
 Kernel: x86_64 Linux 5.4.0-52-generic
 Uptime: 25d 23h 50m
 Packages: 2882
 Shell: bash 5.0.17
 Disk: 62G / 541G (12%)
 CPU: Intel Core2 Duo E8400 @ 2x 2.997GHz
 GPU: AMD/ATI Caicos [Radeon HD 6450/7450/8450 / R5 230 OEM]
 RAM: 903MiB / 5944MiB

Adding a -v (verbose) option will coax the script into displaying the system information as it uncovers it. After all the “finding” messages, it will display the usual output.

$ screenfetch -v
:: Finding distro...found as 'Ubuntu 20.04'
:: Finding hostname and user...found as 'shs@dragonfly'
:: Finding kernel version...found as 'x86_64 Linux 5.4.0-52-generic'
:: Finding current uptime...found as '25d 23h 54m'
:: Finding current package count...found as '2882'
:: Finding current shell...found as 'bash 5.0.17'
:: Finding current resolution(s)...found as 'No X Server'
:: Finding desktop environment...found as 'Not Present'
:: Finding window manager...found as 'Not Found'
:: Finding window manager theme...found as 'Not Found'
:: Finding GTK2 theme...found as 'Not Found'
:: Finding GTK3 theme...found as 'Adwaita'
:: Finding icon theme...found as 'Not Found'
:: Finding user font...found as 'Not Found'
:: Finding current CPU...found as 'Intel Core2 Duo E8400 @ 2x 2.997GHz'
:: Finding current disk usage...found as '62G / 541G (12%%)'
:: Finding current GPU...found as 'AMD/ATI Caicos [Radeon HD 6450/7450/8450 / R5 230 OEM]'
:: Finding current RAM usage...found as '902MiB / 5944MiB'

The screenfetch script is installed as /usr/bin/screenfetch.

$ ls -l /usr/bin/screenfetch
-rwxr-xr-x 1 root root 244084 Nov 27 15:17 /usr/bin/screenfetch

neofetch

The neofetch script is even lengthier than the screenfetch script. It has over 10,000 lines and displays some additional system information. You can install it with a command such as sudo apt install neofetch or sudo dnf install neofetch. Like screenfetch, neofetch detects the information that it displays and adds an ASCII art depiction of the distribution logo to the display.

$ neofetch
            .-/+oossssoo+/-.               shs@dragonfly
        `:+ssssssssssssssssss+:`           -------------
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.1 LTS x86_64
    .ossssssssssssssssssdMMMNysssso.       Host: Inspiron 530s
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.4.0-52-generic
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 26 days, 21 mins
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 3049 (dpkg), 15 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1920x1080
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   Terminal: /dev/pts/0
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel Core 2 Duo E8400 (2) @ 2.997GHz
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   GPU: AMD ATI Radeon HD 6450/7450/8450 / R5
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Memory: 620MiB / 5944MiB
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.

As you can see, lines for host (system type), screen resolution and terminal are included where they aren’t with screenfetch, but the information on disk capacity and usage is not. By using sudo, I was able to get the disk information included.

Many other options appear to be available as well.

$ sudo neofetch
            .-/+oossssoo+/-.               root@dragonfly
        `:+ssssssssssssssssss+:`           --------------
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.1 LTS x86_64
    .ossssssssssssssssssdMMMNysssso.       Host: Inspiron 530s
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.4.0-52-generic
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 26 days, 1 hour, 21 mins
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 3049 (dpkg), 15 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1920x1080
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel Core 2 Duo E8400 (2) @ 2.997GHz
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   GPU: AMD ATI Radeon HD 6450/7450/8450 / R5
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Memory: 624MiB / 5944MiB
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Disk (/): 20G / 110G (19%) 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Public IP: 204.111.9.145
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.

The neofetch script is installed as /usr/bin/neofetch.

$ ls -l /usr/bin/neofetch
-rwxr-xr-x 1 root root 320947 Nov 27 17:01 /usr/bin/neofetch

Here are some additional comparisons of the tools–script size, length and run time:

$ wc -l /usr/bin/*fetch
 10083 /usr/bin/neofetch
  6469 /usr/bin/screenfetch
$ time screenfetch | tail -1
real    0m0.564s
user    0m0.366s
sys     0m0.164s
$ time neofetch | tail -1
real    0m0.364s
user    0m0.228s
sys     0m0.112s

Wrap-Up

Both the screenfetch and neofetch scripts provide very useful and nicely formatted displays of important system information.

Neofetch is probably the newer tool (suggested by the inclusion of the string “neo” in its name) and provides some additional options. Both tools are as easy to use as typing their names,and they provide important system details.

sandra_henrystocker
Unix Dweeb

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as "USL" (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she's chasing the bears away from her bird feeders.

The opinions expressed in this blog are those of Sandra Henry-Stocker and do not necessarily represent those of IDG Communications, Inc., its parent, subsidiary or affiliated companies.