I want to run my scripts from anywhere on my Linode, is it possible?

Linode Staff

I would like to run scripts without having to cd to the directory every time.

1 Reply

To run a script from anywhere on your Linode you'll first need to find out where your machine is storing it's executable files. You can do this by running:

$ echo $PATH

Once you know the path(e.g. /usr/local/bin) you will then need to move the file into the directory and make sure it has the correct permissions-- like so:

$ chmod 700 example-script.sh && mv /usr/local/bin

Now that the script is in the $PATH you can run the command without ./:

$ example-script.sh

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct