list all globally installed modules with one command in ubuntu

The below command will list all your globally installed modules on Linux, Mac, and Windows.

npm ls -g --depth 0

My preferred method is to use the npmlist package, which can be installed using npm i -g npmlist. Then you just use the npmlist command to get a formatted and color listing with versions of all global packages.

$ npmlist

Installed npm packages: (global)

@vue/cli.................[3.5.1]
browser-sync............[2.26.3]
degit....................[2.1.3]
eslint..................[5.15.3]
eslint-plugin-vue........[5.2.2]
jsonlint.................[1.6.3]
npm......................[6.9.0]
npmlist..................[3.1.2]
prettier................[1.16.4]
serverless..............[1.39.1]

To list all globally installed modules run:

npm ls -g --depth 0

or yarn

yarn global ls --depth 0

Extras:

To get a short module description run:

npm ll -g --depth 0

To see the path of where the global modules are installed run:

npm ls -gp --depth 0