How to make ubuntu know a terminal command for the entire machine? [duplicate]

You can just create symlink. Create it in /usr/local/bin. All you need is to run command:

sudo ln -s /full/path/to/your/file /usr/local/bin/name_of_new_command

After that you should make your file executable:

chmod +x /full/path/to/your/file

Now you should be able to run name_of_new_command at any time in your terminal.

Note that this is good solution only for home usage of Linux.


You can add /opt/idea/bin to your PATH variable:

PATH=/opt/idea/bin:"$PATH"

After this you can run it with simply idea.sh.

You probably want to add this line in your ~/.bashrc file.