./ bash shell

I have just installed Fedora :smile:, i am trying to do the following command:
$ sudo ./<file-name>
but terminal keeps writing: sudo: ./<filename>: command not found
why is that? Thanks

Hi,

I think you need to set the execution permission on the file

$ chmod +x <file-name>.sh

Thanks Tom.

1 Like

Thanks, but that didn’t work

1 Like

Can you please tell us the full command you are running? I expect you’re not literally using <filename> for example. So, what is this file that you’d like to run? Can you also please post the output of ls, so we can confirm that the file you are trying to run is in that particular directory?

2 Likes

i was trying to install vmware workstation and one of the tutorials i was following wrote this command to type name of pack:
sudo ./VMware-Player-16.1.2-17966106.x86_64.bundle
the terminal shows:
sudo: ./VMware-Player-16.1.2-17966106.x86_64.bundle: command not found
then to ensure that its not the package i made a java file: great.java give the following:

sudo ./great.java
./great.java: line 1: class: command not found
./great.java: line 2: syntax error near unexpected token `('
./great.java: line 2: `	public static void main(String[] args) {'

Thanks

You may need to use sudo chmod a+x VMware-Player-16.1.2-17966106.x86_64.bundle and then sudo ./VMware-Player-16.1.2-17966106.x86_64.bundle.

1 Like

If you want to use ./ like that there are two conditions:

  1. You need to cd into the directory containing the file
  2. It needs to be made executable as others have already pointed out
2 Likes

You cannot run a java file using ./. You need to run it using java. ./ only works for executables—so binaries or shell scripts.

Can you post the output of ls -lash please? As others have noted, you need to have downloaded the file, entered the directory that it was downloaded to, and it should be executable before you can run the command.

Try to set the execute file mode bit on the file first:

chmod +x ./VMware-Player-16.1.2-17966106.x86_64.bundle
sudo ./VMware-Player-16.1.2-17966106.x86_64.bundle

or make sure to run the bundle through a shell:

sudo sh ./VMware-Player-16.1.2-17966106.x86_64.bundle