Skip to main content

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scripts other than 1 ,2 since you may face some issues with that names


UPDATE:

You can do same just create the bin dir in your home then source source ~/.profile instead of ~/.bashrc. Since adding the ~/bin to your PATH is already listed in .profile

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scripts other than 1 ,2 since you may face some issues with that names


UPDATE:

You can do same just create the bin dir in your home then source .profile instead of .bashrc. Since adding the ~/bin to your PATH is already listed in .profile

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scripts other than 1 ,2 since you may face some issues with that names


UPDATE:

You can do same just create the bin dir in your home then source ~/.profile instead of ~/.bashrc. Since adding the ~/bin to your PATH is already listed in .profile

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
added 341 characters in body
Source Link
Maythux
  • 87.9k
  • 58
  • 247
  • 283

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scripts other than 1 ,2 since you may face some issues with that names


UPDATE:

You can do same just create the bin dir in your home then source .profile instead of .bashrc. Since adding the ~/bin to your PATH is already listed in .profile

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scripts other than 1 ,2 since you may face some issues with that names

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scripts other than 1 ,2 since you may face some issues with that names


UPDATE:

You can do same just create the bin dir in your home then source .profile instead of .bashrc. Since adding the ~/bin to your PATH is already listed in .profile

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
added 55 characters in body
Source Link
Maythux
  • 87.9k
  • 58
  • 247
  • 283

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scriptsNote: It's better to rename your scripts other than 1 ,2 since you may face some issues with that names

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scripts

What are my options? Is there another path with the same "run from anywhere" capability, which I can access without sudo, or another way to achieve something equivalent?

How to do it?

Create some dir in your home to hold your scripts normally named as bin as convention.

mkdir ~/bin

Now move your scripts to bin

mv somescript ~/bin

Now how to make it tun from everywhere?!

You have to add the bin to the PATH

open your .bashrc

gedit .bashrc

and add this line:

export PATH=$PATH:/home/username/bin

Don't forget to replace username with your User Name

Save and exit, then source the bashrc

source .bashrc

and now you are fine, you can run your script as you used to do! but you have to notice this is related to your user only.

Note: It's better to rename your scripts other than 1 ,2 since you may face some issues with that names

added 55 characters in body
Source Link
Maythux
  • 87.9k
  • 58
  • 247
  • 283
Loading
Source Link
Maythux
  • 87.9k
  • 58
  • 247
  • 283
Loading