How to Make Your Scripts Executable Everywhere in Linux

Create a Bash script and save it in a folder so that you can run the script only when you are in that folder. ls imagemagick apache and Squid are installed in different directories but do you know how to access them from anywhere? This is because individual paths have been added to the "paths" variable. Adding more paths allows the script to run anywhere.

Add a Route to Bash

Before you begin, you should explain that you can adjust routes at three different levels because of the way that Linux security works. Bash is the first one. Everything you see here affects Bash and everything running inside it, but not "outside Bash".

Suppose you have a collection of scripts in a folder that you want to access anywhere.

  Add Directories To Path Script Folder

You can add a path to “~ / .bashrc” to free it. You can open the ".bashrc" file (in your home directory but hidden by default) in your favorite text editor, like gedit.

Go to the end of the file and add the following:

  Add a directory to the path bash path

For example, run scripts If you keep the "/ home / myname / scripts" folder, the command is:

Please Note: This content is provided and hosted by a 3rd party server. Sometimes these servers may include advertisements. does not host or upload this material and is not responsible for the content.