View ASCII Art System Info with Neofetch

📅 August 24, 2017
Have you opened a terminal, such as RetroPie for the Raspberry Pi, and admired the RetroPie ASCII art logo adjacent to a brief system information listing?

Wouldn’t it be fun to do the same in a desktop Linux installation?

You can!

With a program called neofetch, you can view the ASCII art logo for your current distribution complete with a synopsis of system information.

Installation

Neofetch is not available in the repositories. For Linux Mint 18.2 and other Ubuntu-based distributions, you can install the PPA.

sudo add-apt-repository ppa:dawidd0811/neofetch
sudo apt-get update
sudo apt-get install neofetch

However, I downloaded the .deb package directly from http://ppa.launchpad.net/dawidd0811/neofetch/ubuntu/pool/main/n/neofetch/ to avoid adding yet another PPA to the system.

For Linux Mint 18.2 and Xubuntu 16.04.3, the 16.04.1 version was downloaded.

It is a 65K file, so the download is quick. Next, install it by double-clicking the .deb file or using dpkg in a terminal.

sudo dpkg -i neofetch_3.2.0-3~ubuntu16.04.1_all.deb

Neofetch installing from Software in Xubuntu 16.04.3. This installation was slower than using dpkg.

Run It!

After neofetch installs, open a terminal and run neofetch.

neofetch

Depending upon the distribution, you should see a different logo. I ran neofetch in two different VirtualBox virtual machines: Xubuntu 16.04.03 and Linux Mint 18.2 XFCE.

neofetch in Xubuntu 16.04.3 running in VirtualBox 5.1.26. The Ubuntu logo is shown since Xubuntu is a derivative.

neofetch in Linux Mint 18.2 XFCE running in VirtualBox 5.1.26. Some hardware information will be different because the two virtual machines are configured differently.

There are a number of options available for neofetch, so check the man pages for details (man neofetch).

You can customize the output. For example, there are various Ubuntu variants, so to display the Xubuntu logo instead of the generic Ubuntu logo, use the –ascii_distro option.

neofetch --ascii_distro xubuntu

Displaying the Xubuntu logo.

For fun, you can pipe the output of neofetch to lolcat, but the result will not be as neatly arranged.

neofetch | lolcat

neofetch | lolccat in Xubuntu 16.04.3 running VirtualBox.

Show neofetch Each Time a Terminal Opens

If you are familiar with earlier versions of Linux Mint, then you will probably remember how cowsay would show a fortune each time a new terminal was opened. We can do the same with neofetch so system information appears when we open a terminal

In your home directory, open the hidden file .bashrc in a text editor, such as gedit.

gedit ~/.bashrc

At the end of the file, add the line neofetch.

~/.bashrc with neofetch added. Now, each time the user opens a terminal, the distribution logo and system information will appear automatically.

This assumes that neofetch is already installed. A more robust script would include a check to see if neofetch is installed as an executable, and, if not, ignore neofetch.

In a terminal, enter whereis neofetch to find the absolute path to its binary. We need this path.

whereis neofetch

This should return a list of paths something like this:

neofetch: /usr/bin/neofetch /etc/neofetch /usr/share/neofetch /usr/share/man/man1/neofetch.1.gz

The main executable is usually the first path listed (/usr/bin/neofetch), so let’s use that.

Open ~/.bashrc, and add the conditional Bash statement to the end of the file as shown:

if [ -x /usr/bin/neofetch ]
then
    /usr/bin/neofetch
fi

If neofetch is installed, then show it when a terminal opens. Otherwise, ignore it.

(Make sure to remove the previous neofetch we added earlier or else neofetch will display twice.)

Each new terminal that opens in Linux Mint 18.2 XFCE automatically displays a brief summary of the system information along with the distribution logo in ASCII art. The alternate colors were produced by changing the terminal colors.

Various terminals in Linux Mint XFCE. Random background colors appear by selecting the “Vary the background color for each tab” checkbox in the terminal color preferences.

neofetch in Xubuntu with alternate terminal colors and randomized background colors.

We edited .bashrc located in the user’s home directory to avoid applying it system-wide. This way, only the user with the edited .bashrc will see the neofetch information. This approach is more user-friendly. Not everyone may want to see a forced neofetch upon opening a terminal.

Have fun!

Advertisements

, ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: