I want to create a quick shorcut to a file wich is: file.py it is located in "/myfiles/folder1/file.py"

I want to access just typing in the the terminal: "file" this file has a working directory so I have to especify the path to. in this case the working directory is /myfiles/folder1


What you are looking for is call alias.

In your case it would be:

alias file="/myfiles/folder1/file.py"

However it will only be for this sesion. To make it permanent you have to add the command to the .bashrc file in your home directory.

  • Thanks it works great but the the thing is the file could not load the the content on the working folder so I need to especify the working directory – xc0d3r Sep 13 '18 at 4:03
  • Just change the alias to cd to the working directory first, then execute the command. Something like alias file="cd /myfiles/folder1/ && file.py" – Daniel Pajaro Sep 13 '18 at 5:25
  • excellent my friend you're the best .. God bless you – xc0d3r Sep 13 '18 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.