Bash start-up working fine but annoying No such file or directory

Any suggestions? When I run my little program
$ ./updater
./updater: line 1: #!/bin/bash: No such file or directory
Hit:2 Index of /debian bookworm-updates InRelease

can you show that little program, updater?

1 Like

Guessing think you are running a script. If so can you try in terminal the command in the image below and see if your output matches the shebang line 1 in your script. Just a thought without further information. The output shows the shebang for my system used in the script.


Hi, kinda think I understand more the information you provided. As I see it you are using ./(relative path)updater(your script to update something) and then the error message pops up. (imagine the Hit:2 is part of possibly a sudo apt update command and might be followed by a sudo apt upgrade command just guessing) Did come across another cause of the error message caused by wrong file encoding such as carriage return line feed but think it is more of a Windows issue. Just another thought. Just a rookie, picked up a couple of things along the way to add to my calc sheet.


I created a script called cav (because I have another file updater)

echo "running cav script"
sleep 5
echo "done"
user@cw:~$ chmod +x cav
user@cw:~$ ./cav
running cav script


-x to put tracing on your script for faults in code

cat-n or nano -l to show line numbers

#Show line numbers nano -l
cd ~
sudo apt update -yy
sudo apt upgrade -yy
sudo apt dist-upgrade
sudo apt clean
sudo apt autoclean
sudo apt autoremove -yy
sudo apt --purge autoremove -yy
sudo apt update -yy
sudo updatedb
flatpack update
sudo snap refresh --list
sudo deb-get update -yy
sudo deb-get upgrade
sudo deb-get clean
sudo update-grub
sudo dpkg --configure -a
sudo apt --fix-broken install
sudo apt --fix-missing update
sudo apt install -f

sudo apt full-upgrade

sudo do-release-upgrade

sudo ./
linuxlogo #sudo apt install linuxlogo
sleep 2s
sleep 3s
neofetch --ascii_distro windows
sleep 3s
neeofetch --ascii "$(fortune | cowsay -W 30)"
echo "--------------------"
echo "- Update Complete! -"
echo "--------------------"

two issues:

  • fix the first line as #!/usr/bin/bash
  • if apt update fails, the script will continue to the next line. Read about the && operator where the second command executes conditionally if the first succeeded.
    Example: sudo apt update -y && sudo apt upgrade -y
    The upgrade will happen if and only if the update was without errors.



All my scripts are starting with the #!/bin/bash line and work perfectly
so there is actually only two possible reasons for this error:
You must have one or more invisible stray characters on that line.

If you, for example, edited this file on ms-windows, you will have an invisible '\r' at the end of the line which is the cause of this error.

Don't use a standards incompatible system like ms-windows to edit Linux files (or any POSIX compliant OS files for that matter).

To see 'invisible' characters, please post the output of:

hd ./updater |head

The other possible (but unlikely) reason is a missing /bin/bash

b.t.w. to make shure /bin/bash exists and is working, you can enter /bin/bash at the commandline. If you don't get an error it means that it is ok, available and working


Thank you tkn. Yes, you are right. I did $ cat -v on the file and it showed up some hidden characters before the #!/bin/bash so I've sorted that out and now its working fine. Not sure how else to show hidden characters in a text file?
Ok, I tried your hd ./updater |head and that was interesting, showed M-oM-;M-?#!/bin/bash
Regards and Thanks