Create Your Own Linux Command

January 24, 2017

Create your custom command in Linux is very simple. I will take a specific case and use it to explain the process.

I have a Linux machine which is used as a Jenkins slave that is configured to work with windows slaves. I can’t change this configuration so my workaround is replace the command “C:\Program File\Git\cmd\git.exe” for the “git” command. To achieve this I’ll create a command called “C:\Program File\Git\cmd\git.exe” that will be used to run git commands.

 

1. Create a Bash Script which will run your command

CreateYourOwnLinuxCommand_1.png

 

2. Make the command executable

CreateYourOwnLinuxCommand_2.png

 

3. Copy your script to the path “/usr/bin”

CreateYourOwnLinuxCommand_3.png

 

4. Test your new Linux Command

CreateYourOwnLinuxCommand_4.png

 

Note: To delete your command just move to the path “/usr/bin” and remove the script

CreateYourOwnLinuxCommand_5.png

 

Add comment
facebook linkedin twitter email

Leave a Reply