Create Custom Command in Linux

Need more accurate results? Got a big list to verify?

Click the banner below to go to our recommended premium email verification service, Email Checker.


Advertise on Leopathu


Linux Operating System allows custom commands, So anyone can write their own commands for their needs. That’s the power of Linux. I am going to show you how to create custom commands ( now - to shows current time) in Linux System,

Create Bash Script :

The First thing is to create bash script in /usr/bin/ Directory which will run your commands,

$ cd /usr/bin
$ sudo vim now

Write the following code in the file,

now=$(date +"%T")
echo "Current time : $now"

Save the file and get back to terminal.

Make as Executable :

The Second thing is to make the file as executable and readable with the following command,

$ sudo chmod 777 now
$ sudo chmod -x now

Thats all, your “ now “ command is ready now. Test the command by typing “ now “ in your terminal, it should show the current time in that !

$ now
Current time : 12:18:45

This is the sample to create custom command in Linux system, we can use the procedure to create more complex command too, if you have good knowledge in shell script.