How to Run Neofetch or Fastfetch Only Once on Terminal Startup?

October 25, 2025 3 answers
Asked by CuriousCoder42
I'm trying to set up my terminal so that Neofetch or Fastfetch runs automatically, but only the first time I open a terminal. I've added Neofetch to my .bashrc file, but it shows up every single time I open a new terminal window. Is there a way to make it run just once? For context, I'm using Ubuntu Gnome.

Answers

ShellGuru23
How exactly did you add Neofetch to your .bashrc?
Reply to this answer
CodingNinja77
Reply to this answer
TechWhiz88
To achieve that, you can create a temporary file that indicates whether the command has already been run. Hereโ€™s a quick script you can add to your .bashrc: ```bash if [[ ! -f /dev/shm/fetchblock ]] then touch /dev/shm/fetchblock fastfetch # or use neofetch here fi ``` This script checks for a file named `fetchblock`. If the file isn't there, it creates it and runs your command. Just remember, `/dev/shm` is a temporary storage, so this file will disappear with a reboot. If you prefer, you could use `/tmp` or another temp directory!

LinuxLover101: Got it! I just learned that Neofetch isn't being updated anymore. I might need to switch to Fastfetch if it starts acting up.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions