5

I'm new to Ubuntu, and trying to start opening and running programs directly from the terminal. I've tried this multiple times with different programs, and always get the same error -- "command not found". I've tried running programs both from the main directory and from the sub-folder the program is in, but neither work.

Any tips?

Here's what I've been getting:

When I try running in the folder:

Julia@a-capella: ~Documents/events_adc$ nuetrino_s1_1
nuetrino_s1_1: command not found

When I try running from the main directory:

ulia@a-capella: ~$ nuetrino_s1_1
nuetrino_s1_1: command not found

Oddly enough, firefox (and no other programs I've tried) will run from here.

Thanks!

  • 4
    If you type the command echo $PATH it will display your command path; ie. where commands are searched. Your current directory would be shown as a "." if its there (i very much doubt it) which is what you're probably missing. The easiest way to run commands in your current directory is "./nuetrino_s1_1" (the './ ' part tells the system to look for it in the current directory {or $PWD]) – guiverc Feb 8 '18 at 22:18
  • My guess is that - the file must have executable permissions to be executed. – pa4080 Feb 8 '18 at 22:44
4

If you type the command

echo $PATH

it will display your command path, or where commands are searched for. Your current directory would be shown as a "." if its there (i very much doubt it) which is what you're probably missing.

The easiest way to run commands in your current directory is:

./nuetrino_s1_1

The ./ part tells the system to look for the command in the current directory [or $PWD, or present.working.directory].

  • You can add "." to your $PATH (so it searches your present.working.directory for commands) which at first feels great as you no longer have to type "./command", but in my experience you'll keep tripping over it on other machines that don't do it; so you'll end up typing "./command" even if "." is in path. ie. my 2c is just learn to type ./command – guiverc Feb 8 '18 at 22:32
  • 1
    Adding "." to $PATH is a really BAD idea. It allows all kind of attacks to happen (for exemple : if you put it first, anyone can hijack your session by having a "ls" or other program in a directory you happen to be in. Or even if you put it last, having common typos program there ("sl" "gerp" etc). And there are many other bad security side effects in addition to those. Do NOT put "." in your $PATH. – Olivier Dulac Mar 23 '18 at 17:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.