How to make custom command in linux

sometimes we don’t want to type long commands every time. we want to create scripts and run custom scripts easily. today I will show you How to create commands in linux.

This is the command I will you how to create today, hello-command. we can type the hello command and pass one parameter when we run this command it will print hello followed by text that you insert in the parameter.

first, we create a script file name “”


before we write a file let’s take a look at file permission. the file has read and write permission.

we will change file permission to make the file can execute. use chmod command to change permission.

chmod +x

let list permission to see again, the file can have execute permission

I like to use vscode to edit script use can use other editors you want


the script reads an argument and print output Hello followed by the argument we insert when running the script.

#!bin/bashecho Hello $1

test the script to make it can execute correctly.

./ everyone

now we can create a custom script but can’t run it everywhere. when we change the directory and run the script again. it not working.

so, we will make it can run on everywhere. first, move to the directory where we create a script and move the file to /bin and remove suffix file to look prettier when we run the command.

cd <your-directory>
sudo mv /bin/hello-command

reopen your terminal and run the command again.

now, you can create your own custom script to reduce repetitive tasks and make your day more productive.

Thank you for reading & enjoy your coding :)




Software engineer & freelancer fromThailand. for work blog :

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium


More JavaScript Notions

Effective Testing at Merit

Setting up React Router in Your Project (quick beginner version)

Web framework: React continues to shine through in 2021

Install Node.js on Windows

Change Detection in Angular

AngularJS + Webpack = lazyLoad

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Software engineer & freelancer fromThailand. for work blog :

More from Medium

Dear Developers, Check Your Ego

Arrogant man with arms crossed looking into the camera

The Most Popular Computer Programming Languages of 2022

6 essential commands to get better at Linux system, you should know

Five Linux commands to make Web Developer’s Life Easy