Javascript – Why is there a ‘js’ command on Node JS for Linux?

Why is there a ‘js’ command on Node JS for Linux?… here is a solution to the problem.

Why is there a ‘js’ command on Node JS for Linux?

I have installed the software Node.js: on XUbuntu 13.10 via the package manager

xxx@xxx:/$ sudo apt-get install nodejs

Everything seems fine, but I found a js executable besides the nodejs executable.

Both, if called with the -v option, shows v0.10.15 and I’ve successfully used them both as Javascript interpreters.

My question is: is there any difference between nodejs commands and js commands? Is js just an alias for the nodejs command?


It is related to /etc/alternatives, the Ubuntu/Debian alternative mechanism.


  • usr/bin/js — is the link to which it points
  • /

  • etc/alternatives/js — is the link to it
  • /usr/bin/node

So if you have /usr/bin in your PATH, running js is actually exactly the same as running node (except you have to traverse two symbolic links, which is not a big cost). Using js in a script (for example) will allow the system to be configured to use an alternative version of the installed version of Node – perhaps a different version, or a version built with some experimental features.

You can update in >update-alternatives man page to read more about this

Related Problems and Solutions