Skip to content

Instantly share code, notes, and snippets.

@icedmoca
Last active September 3, 2023 08:20
Show Gist options
  • Save icedmoca/35241ec2f20366d8b12679f075c3605f to your computer and use it in GitHub Desktop.
Save icedmoca/35241ec2f20366d8b12679f075c3605f to your computer and use it in GitHub Desktop.
Neofetch Installation and Startup Guide

Neofetch Installation and Startup Guide

This guide outlines how to install neofetch and configure it to run on startup across various environments.

Linux Distributions

1. Ubuntu & Debian

Installation:

sudo apt update
sudo apt install neofetch

Run on Startup:

  • Regular User: Add neofetch to the end of ~/.bashrc.
  • Admin (root): Add neofetch to the end of /root/.bashrc.

2. Fedora

Installation:

sudo dnf install neofetch

Run on Startup:

  • Regular User: Add neofetch to the end of ~/.bashrc.
  • Admin (root): Add neofetch to the end of /root/.bashrc.

3. CentOS

Installation:

sudo yum install epel-release
sudo yum install neofetch

Run on Startup:

  • Regular User: Add neofetch to the end of ~/.bashrc.
  • Admin (root): Add neofetch to the end of /root/.bashrc.

4. Arch Linux & Manjaro

Installation:

sudo pacman -S neofetch

Run on Startup:

  • Regular User: Add neofetch to the end of ~/.bashrc or ~/.zshrc (based on your shell).
  • Admin (root): Add neofetch to the end of /root/.bashrc or /root/.zshrc.

5. openSUSE

Installation:

sudo zypper install neofetch

Run on Startup:

  • Regular User: Add neofetch to the end of ~/.bashrc.
  • Admin (root): Add neofetch to the end of /root/.bashrc.

6. Linux Mint, elementary OS, Pop!_OS

These distributions are based on Ubuntu/Debian, so the installation and setup instructions are the same as Ubuntu.

Windows (PowerShell & CMD)

PowerShell

Installation:

Install-Module -Name windows-screenfetch -Force -SkipPublisherCheck

Run on Startup:

  • Add screenfetch to your PowerShell profile, typically located at $PROFILE.

notepad.exe $PROFILE

Command Prompt (CMD)

For CMD, you can use a batch file to invoke PowerShell and run windows-screenfetch.

Run on Startup:

  • Create a .bat file containing the command to invoke PowerShell and run windows-screenfetch.
  • Add the path to this .bat file to the AutoRun key in the Windows Registry under HKEY_CURRENT_USER\Software\Microsoft\Command Processor.

macOS

Installation:

brew install neofetch

Run on Startup:

  • Add neofetch to the end of ~/.zshrc.

This guide provides a quick and straightforward approach to installing and setting up neofetch for various environments. Always ensure to check the official documentation or repositories of your operating system for the most up-to-date and detailed instructions.

Issues & Troubleshoot:

There could be several reasons why neofetch isn't running on startup even after adding it to ~/.bashrc.

Ensure neofetch is Installed and Accessible:

Open a terminal and simply run:

neofetch

If you get an error stating command not found, it means neofetch is not installed or not in your $PATH.

Check if .bashrc is Sourced:

Not all terminals source ~/.bashrc by default. As a test, after opening your terminal, you can manually source the .bashrc file:

source ~/.bashrc

If neofetch runs after this command, it indicates your terminal isn't sourcing .bashrc by default.

Terminal Settings:

Depending on the terminal emulator you're using (e.g., Alacritty, GNOME Terminal, Termite, etc.), the configuration might be set to launch a login shell by default, which doesn't source ~/.bashrc. Instead, it sources ~/.bash_profile or ~/.profile.

To address this:

  • Open your ~/.bash_profile (or create it if it doesn't exist).
  • Add the following lines to ensure .bashrc is sourced:
if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

Save and exit. Alternatively, you can check your terminal emulator's settings/preferences to ensure it's not launching a login shell by default.

Mistakes in .bashrc:

An error or exit command earlier in your .bashrc might prevent subsequent commands from running. Look through your ~/.bashrc to ensure there's no exit command before the neofetch line and that there are no syntax errors that might terminate the script early.

Profile File Ownership and Permissions:

It's possible that .bashrc has incorrect ownership or permissions. Check it with:

ls -l ~/.bashrc

Ensure that the file is owned by your user and has at least read and execute permissions for the owner.

If none of the above solutions work, let me know. It would also be helpful if you could provide more information about your setup, such as which terminal emulator you're using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment