10

I installed this python script scdl to download audio from soundcloud. The script is installed to ~/.local/bin How can I run this script in a terminal like a programm? So I don't enter the whole path to this script. I would like to run it like this:

scdl - l <link>

2 Answers 2

17

Add the path ~/.local/bin to the PATH environment.

Open the file .bashrc in a terminal

nano ~/.bashrc

and add

:$HOME/.local/bin

at the end of the PATH definition

e.g.

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$HOME/bin:$HOME/.local/bin

and add the line:

alias my_app="scdl - l <link>"

to start your command scdl - l <link> with the alias my_app.

Replace my_app with a name of your choice.

Start the command to read the configuration

source ~/.bashrc

That's all.

2
  • 1
    Closing the terminal window and reopening another one also works to reload the .bashrc file. Not that yours is wrong, just another option. Good answer btw.
    – Byte Commander
    May 18, 2015 at 19:38
  • 1
    there was no path enviroment so i added this line at the end of the file. now it works fine! Thanks!
    – Nick
    May 18, 2015 at 21:04
3

Or simpler way... Just create a symlink to it in /usr/local/bin/

eg.

sudo ln -s /home/user/.local/bin/scdl /usr/local/bin/scdl

Then its automatically added to the default PATH

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .