I don't exactly know the difference between a script and a few pages mention that there is almost no difference between them but I do wonder why to execute a command all we need to do is type its name and press enter but to execute a script a .sh follwos the name of the file .(If a command is also an executable file why isn't there any need for extensions in case of a command ? ) I think it is possible to create your own commands in shell as I work on a system and the names of few commands seem customized(they match the names of some people). If it is possible to create your own command then how can I view the code for a user made command ? And how can I make my own command ?
You have to make a difference between programs that are compiled to machine code from a compiled language like C and interpreted language like bash. A compiled program consists of machine code that the computer can run with no further help.
With a script, you need to tell the computer, which interpreter it should use. For example, you can run a bash script by putting the line
#!/bin/bash first in the file. It tells the computer, that it should use the bash-shell as the interpreter. If you turn on the executable bit in the file permissions, you can run it from the command line like any other program. You can leave the .sh extension away.