Introduction
Neofetch is a versatile command-line tool that displays a concise and customizable summary of your Linux system information. This tool is popular among Linux users for sharing screenshots of their desktop setups. In this lab, you will learn how to install Neofetch, run it with different options, customize its configuration, and resolve common issues you might encounter.
By the end of this lab, you will be able to customize Neofetch to display exactly the information you want in a visually appealing format that suits your preferences.
Installing Neofetch and Running it for the First Time
Neofetch is a command-line system information tool that displays information about your operating system, software, and hardware in an aesthetic way. In this step, we will install Neofetch and run it to see what information it provides by default.
Installing Neofetch
To install Neofetch on your Ubuntu 22.04 system, follow these steps:
Open a terminal window by clicking on the terminal icon in the application menu or pressing
Ctrl+Alt+T.Update your package lists to ensure you get the latest version of the software:
sudo apt updateYou might see output similar to this:
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB] Get:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB] Get:4 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Fetched 337 kB in 1s (337 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done All packages are up to date.Install Neofetch using the apt package manager:
sudo apt install neofetch -yThe output will show the installation progress:
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: neofetch 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 97.9 kB of archives. After this operation, 394 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 neofetch all 7.1.0-3 [97.9 kB] Fetched 97.9 kB in 0s (215 kB/s) Selecting previously unselected package neofetch. (Reading database ... 186774 files and directories currently installed.) Preparing to unpack .../neofetch_7.1.0-3_all.deb ... Unpacking neofetch (7.1.0-3) ... Setting up neofetch (7.1.0-3) ...
Running Neofetch
After installing Neofetch, you can run it by simply typing the command in the terminal:
neofetch
This will display a colorful output with information about your system, including:
- Ubuntu logo in ASCII art
- Operating system name and version
- Kernel version
- Uptime
- Package count
- Shell
- Resolution
- Desktop Environment
- Window Manager
- Terminal
- CPU information
- Memory usage
- And more
The output should look similar to this:
.-/+oossssoo+/-. labex@ubuntu
`:+ssssssssssssssssss+:` ------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 22.04.2 LTS x86_64
.ossssssssssssssssssdMMMNysssso. Host: KVM Virtual Machine
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 5.15.0-73-generic
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 15 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 754 (dpkg)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: zsh 5.8.1
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Terminal: /dev/pts/0
ossyNMMMNyMMhsssssssssssssshmmmhssssssso CPU: AMD EPYC-Milan (2) @ 2.394GHz
ossyNMMMNyMMhsssssssssssssshmmmhssssssso Memory: 231MiB / 3921MiB
+sssshhhyNMMNyssssssssssssyNMMMysssssss+
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
+sssssssssdmydMMMMMMMMddddyssssssss+
/ssssssssssshdmNNNNmyNMMMMhssssss/
.ossssssssssssssssssdMMMNysssso.
-+sssssssssssssssssyyyssss+-
`:+ssssssssssssssssss+:`
.-/+oossssoo+/-.
Understanding the Basic Neofetch Output
The Neofetch display is divided into two main parts:
Logo: On the left side, Neofetch displays the logo of your Linux distribution (Ubuntu in this case) using ASCII art.
System Information: On the right side, Neofetch shows various details about your system, such as:
- OS name and version
- Host name
- Kernel version
- Uptime
- Package count
- Shell
- Terminal
- CPU information
- Memory usage
This default output provides a good overview of your system, but Neofetch can be customized extensively to show exactly the information you want, which we will explore in the next steps.
Understanding and Configuring Neofetch
Now that you have Neofetch installed and have seen what it displays by default, it is time to explore how to configure it to display different information according to your preferences.
Where is the Neofetch Configuration File
Neofetch stores its configuration in a file called config.conf in the .config/neofetch directory in your home folder. Let's check if this file exists and create it if necessary:
First, let's check if the configuration directory exists:
ls -la ~/.config/neofetchIf you have already run Neofetch, the directory and configuration file should exist, and you will see output similar to:
total 40 drwxrwxr-x 2 labex labex 4096 Jul 20 12:34 . drwxr-xr-x 9 labex labex 4096 Jul 20 12:34 .. -rw-rw-r-- 1 labex labex 31535 Jul 20 12:34 config.confIf the directory doesn't exist, Neofetch will create it along with a default configuration file when you run the command for the first time. Let's make sure it's created:
neofetchNow check again for the configuration file:
ls -la ~/.config/neofetchLet's open the configuration file to examine it:
nano ~/.config/neofetch/config.confThis will open the configuration file in the nano text editor, where you can see all the available options.
Understanding the Configuration File
The Neofetch configuration file is quite extensive and contains many options that you can customize. Some of the key sections include:
- Print Info: This section defines what information is displayed and in what order.
- Text Options: Controls how text is formatted and displayed.
- Color Options: Defines the colors used in the output.
- ASCII Options: Controls the logo/art displayed on the left side.
- Image Options: If using image mode instead of ASCII art.
- Config Options: Miscellaneous configurations like the backend used for gathering information.
Let's examine the print_info() function in the configuration file, which controls what information is displayed:
print_info() {
info title
info underline
info "OS" distro
info "Host" model
info "Kernel" kernel
info "Uptime" uptime
info "Packages" packages
info "Shell" shell
info "Resolution" resolution
info "DE" de
info "WM" wm
info "WM Theme" wm_theme
info "Theme" theme
info "Icons" icons
info "Terminal" term
info "Terminal Font" term_font
info "CPU" cpu
info "GPU" gpu
info "Memory" memory
## info "GPU Driver" gpu_driver ## Linux/macOS only
## info "CPU Usage" cpu_usage
## info "Disk" disk
## info "Battery" battery
## info "Font" font
## info "Song" song
## info "Local IP" local_ip
## info "Public IP" public_ip
## info "Users" users
## info "Locale" locale ## This only works on glibc systems.
info cols
}
In this function, each line that begins with info displays a piece of information in the Neofetch output. Lines that are commented out (those starting with #) do not display any information.
Running Neofetch with Different Options
Neofetch can also be run with various command-line options to temporarily override the configuration settings. Let's try a few of them:
Display Neofetch with only specific information:
neofetch --os --kernel --memoryThis will display only the OS, kernel, and memory information. The output will be more concise:
.-/+oossssoo+/-. `:+ssssssssssssssssss+:` OS: Ubuntu 22.04.2 LTS x86_64 -+ssssssssssssssssssyyssss+- Kernel: 5.15.0-73-generic .ossssssssssssssssssdMMMNysssso. Memory: 231MiB / 3921MiB /ssssssssssshdmmNNmmyNMMMMhssssss/ +ssssssssshmydMMMMMMMNddddyssssssss+ /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ .ssssssssdMMMNhsssssssssshNMMMdssssssss. +sssshhhyNMMNyssssssssssssyNMMMysssssss+ ossyNMMMNyMMhsssssssssssssshmmmhssssssso ossyNMMMNyMMhsssssssssssssshmmmhssssssso +sssshhhyNMMNyssssssssssssyNMMMysssssss+ .ssssssssdMMMNhsssssssssshNMMMdssssssss. /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ +sssssssssdmydMMMMMMMMddddyssssssss+ /ssssssssssshdmNNNNmyNMMMMhssssss/ .ossssssssssssssssssdMMMNysssso. -+sssssssssssssssssyyyssss+- `:+ssssssssssssssssss+:` .-/+oossssoo+/-.Display Neofetch with a different ASCII art:
neofetch --ascii_distro debianThis will display the Debian logo instead of the Ubuntu logo:
_,met$$$$$gg. labex@ubuntu ,g$$$$$$$$$$$$$$$P. ------------ ,g$$P" """Y$$.". OS: Ubuntu 22.04.2 LTS x86_64 ,$$P' `$$$. Host: KVM Virtual Machine ',$$P ,ggs. `$$b: Kernel: 5.15.0-73-generic `d$$' ,$P"' . $$$ Uptime: 30 mins $$P d$' , $$P Packages: 754 (dpkg) $$: $$. - ,d$$' Shell: zsh 5.8.1 $$; Y$b._ _,d$P' Terminal: /dev/pts/0 Y$$. `.`"Y$$$$P"' CPU: AMD EPYC-Milan (2) @ 2.394GHz `$$b "-.__ Memory: 231MiB / 3921MiB `Y$$ `Y$$. `$$b. `Y$$b. `"Y$b._ `"""Display Neofetch without ASCII art:
neofetch --offThis will display only the system information without any ASCII art:
labex@ubuntu ------------ OS: Ubuntu 22.04.2 LTS x86_64 Host: KVM Virtual Machine Kernel: 5.15.0-73-generic Uptime: 30 mins Packages: 754 (dpkg) Shell: zsh 5.8.1 Terminal: /dev/pts/0 CPU: AMD EPYC-Milan (2) @ 2.394GHz Memory: 231MiB / 3921MiB
These examples show how you can quickly customize the Neofetch output using command-line options without modifying the configuration file. In the next step, we will make permanent changes to the configuration file to customize Neofetch according to your preferences.
Customizing Neofetch Output
Now that you understand the Neofetch configuration file, let's make some permanent changes to customize the output according to your preferences.
Editing the Configuration File
Let's make the following customizations to Neofetch:
- Change which information is displayed
- Modify the colors used in the output
- Use a different ASCII art
Follow these steps to edit the configuration file:
Open the Neofetch configuration file in nano:
nano ~/.config/neofetch/config.confFirst, let's modify the information displayed by editing the
print_info()function. Locate this function in the file (it should be near the top). We'll create a simplified version that shows only the most essential information and adds a custom field:Find the
print_info()function and change it to:print_info() { info title info underline info "OS" distro info "Kernel" kernel info "Uptime" uptime info "Shell" shell info "CPU" cpu info "Memory" memory info "Disk" disk ## Add a custom line with your name info "User" users prin "Lab Completed" "Yes" info cols }This modified function will display fewer items and add a custom line indicating that you completed this lab.
Next, let's change the color scheme. Scroll down to find the
Colorssection. Look for the## Text Colorssubsection, and modify the colors to use green:Find:
## Text Colors # ## Default: 'distro' ## Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' ## Flag: --colors # ## Each number represents a different part of the text in ## this order: 'title', '@', 'underline', 'subtitle', 'colon', 'info' # ## Example: ## colors=(distro) - Text is colored based on Distro colors. ## colors=(4 6 1 8 8 6) - Text is colored in the order above. colors=(distro)Change it to:
## Text Colors colors=(2 2 2 2 2 7)This sets most of the text to green (color code 2) with the info text in white (color code 7).
Finally, let's change the ASCII art by changing the
ascii_distrooption. Find:## ASCII Distro ## Which distro's ascii art to display. # ## Default: 'auto' ## Values: 'auto', 'distro_name' ## Flag: --ascii_distro ## NOTE: AIX, Alpine, Anarchy, Android, Antergos, antiX, "AOSC OS", ## "AOSC OS/Retro", Apricity, ArcoLinux, ArchBox, ARCHlabs, ## ArchStrike, XFerience, ArchMerge, Arch, Artix, Arya, Bedrock, ## Bitrig, BlackArch, BLAG, BlankOn, BlueLight, bonsai, BSD, ## BunsenLabs, Calculate, Carbs, CentOS, Chakra, ChaletOS, ## Chapeau, Chrom*, Cleanjaro, ClearOS, Clear_Linux, Clover, ## Condres, Container_Linux, CRUX, Cucumber, Debian, Deepin, ## DesaOS, Devuan, DracOS, DarkOs, DragonFly, Drauger, Elementary, ## EndeavourOS, Endless, EuroLinux, Exherbo, Fedora, Feren, FreeBSD, ## FreeMiNT, Frugalware, Funtoo, GalliumOS, Garuda, Gentoo, Pentoo, ## gNewSense, GNOME, GNU, GoboLinux, Grombyang, Guix, Haiku, Huayra, ## Hyperbola, janus, Kali, KaOS, KDE_neon, Kibojoe, Kogaion, ## Korora, KSLinux, Kubuntu, LEDE, LFS, Linux_Lite, ## LMDE, Lubuntu, Lunar, macos, Mageia, MagpieOS, Mandriva, ## Manjaro, Maui, Mer, Minix, LinuxMint, MX_Linux, Namib, ## Neptune, NetBSD, Netrunner, Nitrux, NixOS, Nurunner, ## NuTyX, OBRevenge, OpenBSD, openEuler, OpenIndiana, openmamba, ## OpenMandriva, OpenStage, OpenWrt, osmc, Oracle, OS Elbrus, PacBSD, ## Parabola, Pardus, Parrot, Parsix, TrueOS, PCLinuxOS, Peppermint, ## popos, Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, ## Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, ## Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, ## Septor, SereneLinux, SharkLinux, Siduction, Slackware, SliTaz, ## SmartOS, Solus, Source_Mage, Sparky, Star, SteamOS, SunOS, ## openSUSE_Leap, openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, ## Trisquel, Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, ## Ubuntu, Venom, Void, Obarun, windows10, Windows7, Xubuntu, Zorin, ## and IRIX have ascii logos ## NOTE: Arch, Ubuntu, Redhat, and Dragonfly have 'old' logo variants. ## Use '{distro name}_old' to use the old logos. ## NOTE: Ubuntu has flavor variants. ## Change this to Lubuntu, Kubuntu, Xubuntu, Ubuntu-GNOME, ## Ubuntu-Studio, Ubuntu-Mate or Ubuntu-Budgie to use the flavors. ## NOTE: Arcolinux, Dragonfly, Fedora, Alpine, Arch, Ubuntu, ## CRUX, Debian, Gentoo, FreeBSD, Mac, NixOS, OpenBSD, android, ## Antrix, CentOS, Cleanjaro, ElementaryOS, GUIX, Hyperbola, ## Manjaro, MXLinux, NetBSD, Parabola, POP_OS, PureOS, ## Slackware, SunOS, LinuxLite, OpenSUSE, Raspbian, ## postmarketOS, and Void have a smaller logo variant. ## Use '{distro name}_small' to use the small variants. ascii_distro="auto"Change it to:
ascii_distro="arch_small"This will display the small Arch Linux logo instead of the default Ubuntu logo.
Save the file by pressing
Ctrl+O, thenEnter, and exit nano by pressingCtrl+X.
Testing Your Customized Neofetch
Now let's run Neofetch to see our customized output:
neofetch
You should see output similar to this, with a small Arch Linux logo, green text, and only the information you selected to display:
/\ labex@ubuntu
/ \ ------------
/\ \ OS: Ubuntu 22.04.2 LTS x86_64
/ \ Kernel: 5.15.0-73-generic
/ ,, \ Uptime: 45 mins
/ | | -\ Shell: zsh 5.8.1
/_-'' ''-_\ CPU: AMD EPYC-Milan (2) @ 2.394GHz
Memory: 250MiB / 3921MiB
Disk: 2.0G / 77G (3%)
User: labex
Lab Completed: Yes
Creating a Custom Neofetch Configuration
Let's create a simplified custom configuration file that we can easily switch to. This can be useful when you want different configurations for different purposes:
Create a new directory to store your custom configuration:
mkdir -p ~/custom_configsCreate a simplified Neofetch configuration file:
nano ~/custom_configs/simple_neofetch.confAdd the following content to the file:
## Simple Neofetch configuration print_info() { info title info underline info "OS" distro info "Uptime" uptime info "CPU" cpu info "Memory" memory info cols } ## Colors colors=(4 4 4 4 4 7) ## ASCII ascii_distro="ubuntu_small"Save the file by pressing
Ctrl+O, thenEnter, and exit nano by pressingCtrl+X.Run Neofetch with your custom configuration file:
neofetch --config ~/custom_configs/simple_neofetch.confThe output should be a very simplified version with a blue color scheme and the small Ubuntu logo:
_ labex@ubuntu ---(_) ------------ _/ --- \ OS: Ubuntu 22.04.2 LTS x86_64 (_) | | Uptime: 50 mins \ --- _/ CPU: AMD EPYC-Milan (2) @ 2.394GHz ---(_) Memory: 250MiB / 3921MiB
You now have two different Neofetch configurations: your modified main configuration and a simplified custom configuration. You can switch between them as needed or create additional configurations for different purposes.
Creating Aliases and Troubleshooting Neofetch
In this step, we'll create aliases to make running Neofetch with different configurations easier and troubleshoot some common issues you might encounter.
Creating Aliases for Neofetch
Aliases are shortcuts for commands that allow you to execute complex commands with just a few keystrokes. Let's create aliases for our different Neofetch configurations:
Open your shell configuration file. Since you're using zsh, open the
.zshrcfile:nano ~/.zshrcAdd the following aliases at the end of the file:
## Neofetch aliases alias nf='neofetch' alias nfs='neofetch --config ~/custom_configs/simple_neofetch.conf' alias nfm='neofetch --memory --cpu --os'These aliases create three shortcuts:
nf: Runs Neofetch with your default configurationnfs: Runs Neofetch with your simple configurationnfm: Runs Neofetch showing only memory, CPU, and OS information
Save the file by pressing
Ctrl+O, thenEnter, and exit nano by pressingCtrl+X.Apply the changes to your current session:
source ~/.zshrcTest your aliases:
nfThis should run Neofetch with your default configuration.
nfsThis should run Neofetch with your simple configuration.
nfmThis should run Neofetch showing only memory, CPU, and OS information.
Troubleshooting Common Neofetch Issues
Let's explore some common issues that you might encounter when using Neofetch and how to resolve them:
Issue 1: Missing or Incorrect Information
Sometimes Neofetch might display incorrect or missing information. This could be due to various reasons, such as unsupported hardware or software configurations.
To fix this, you can try the following solutions:
Update Neofetch to the latest version:
sudo apt update && sudo apt upgrade neofetch -yCheck if your system information can be detected manually:
For CPU information:
cat /proc/cpuinfo | grep "model name"For memory information:
free -hCompare these outputs with what Neofetch displays.
Issue 2: Slow Neofetch Startup
If Neofetch is taking a long time to start, it might be because it's trying to gather information that's slow to retrieve. You can speed it up by disabling certain information gathering:
Create a performance-optimized configuration:
nano ~/custom_configs/fast_neofetch.confAdd the following content to disable some of the slower information gathering:
## Fast Neofetch configuration print_info() { info title info underline info "OS" distro info "Kernel" kernel info "CPU" cpu info "Memory" memory } ## Disable slow info gathering disk_show=() music_player="off" disable_gpu=trueSave the file by pressing
Ctrl+O, thenEnter, and exit nano by pressingCtrl+X.Create an alias for this fast configuration:
nano ~/.zshrcAdd the following alias:
alias nff='neofetch --config ~/custom_configs/fast_neofetch.conf'Save the file by pressing
Ctrl+O, thenEnter, and exit nano by pressingCtrl+X.Apply the changes to your current session:
source ~/.zshrcTest your new alias:
nffThis should run Neofetch much faster, as it's gathering less information.
Issue 3: ASCII Art Not Displaying Correctly
Sometimes the ASCII art might not display correctly in your terminal. This could be due to font issues or terminal settings. To fix this:
Try using a different ASCII art that might be more compatible with your terminal:
neofetch --ascii_distro ubuntu_smallIf you're still having issues, try disabling ASCII art completely:
neofetch --offYou can also create a no-ASCII configuration file:
nano ~/custom_configs/no_ascii_neofetch.confAdd the following content:
## No ASCII Neofetch configuration print_info() { info title info underline info "OS" distro info "Kernel" kernel info "Uptime" uptime info "CPU" cpu info "Memory" memory } ## Disable ASCII art ascii="off"Save the file by pressing
Ctrl+O, thenEnter, and exit nano by pressingCtrl+X.Create an alias for this configuration:
nano ~/.zshrcAdd the following alias:
alias nfna='neofetch --config ~/custom_configs/no_ascii_neofetch.conf'Save the file by pressing
Ctrl+O, thenEnter, and exit nano by pressingCtrl+X.Apply the changes to your current session:
source ~/.zshrcTest your new alias:
nfnaThis should run Neofetch without any ASCII art.
By following these troubleshooting steps, you can resolve most common issues with Neofetch and optimize it for your specific needs.
Summary
In this lab, you have learned how to work with Neofetch, a versatile command-line system information tool for Linux. You have accomplished the following tasks:
- Installed Neofetch and learned how to run it with default settings
- Explored the Neofetch configuration file and understood its structure
- Customized Neofetch to display specific information with your preferred colors and ASCII art
- Created multiple custom configuration files for different purposes
- Set up aliases to make running Neofetch with different configurations easier
- Learned how to troubleshoot common Neofetch issues
These skills allow you to:
- Quickly view detailed information about your Linux system
- Customize the output to focus on the information that matters most to you
- Create different configurations for different use cases
- Optimize Neofetch performance when needed
As you continue your Linux journey, you can further enhance your Neofetch setup by:
- Exploring more customization options in the configuration file
- Creating more specialized configurations for specific purposes
- Sharing your Neofetch screenshots with the Linux community
- Incorporating Neofetch into your system monitoring workflow
Neofetch is not just a tool for displaying system information but also a way to personalize your Linux experience and make it more enjoyable.



