ps-nvm
List processes using numeric user/group IDs
TLDR
View documentation for Get-NodeInstallLocation, a tool to get the current Node.js install location
View documentation for Get-NodeVersions, a tool to list all available and currently-installed Node.js versions
View documentation for Install-NodeVersion, a tool to install Node.js runtime versions
View documentation for Remove-NodeVersion, a tool to uninstall an existing Node.js version
View documentation for Set-NodeInstallLocation, a tool to set the Node.js install location
View documentation for Set-NodeVersion, a tool to set the default version of Node.js
SYNOPSIS
ps-nvm
PARAMETERS
None
No standard command-line parameters are typically used with ps-nvm. It is primarily invoked without arguments to list all detected Node.js processes. Its behavior is implicitly determined by the active NVM environment and the paths of running Node.js executables.
DESCRIPTION
ps-nvm is not a standard Linux command. It is a utility, typically provided as a shell function or script within the Node Version Manager (NVM) ecosystem. Its primary purpose is to help users identify and monitor running Node.js processes, specifically indicating which NVM-managed version of Node.js (if any) each process is utilizing.
In environments where multiple Node.js versions are installed via NVM, it can be challenging to determine which specific version a running application or script is using. ps-nvm addresses this by querying active processes, filtering for Node.js executables, and then attempting to resolve the executable path back to its corresponding NVM installation directory. This provides valuable insights for debugging, version management, and ensuring applications run with the intended Node.js runtime. It helps differentiate between NVM-managed and unmanaged Node.js installations.
CAVEATS
NVM Dependency: ps-nvm is not a standalone utility; it requires NVM (Node Version Manager) to be installed and sourced in your shell environment to function correctly. Its availability and exact behavior depend on your NVM installation and version.
Non-Standard Command: It is not a universally available Linux command and is specific to the NVM ecosystem. Users without NVM installed will not have this command.
Path Resolution Reliance: Its ability to link processes to specific NVM versions relies on successfully resolving the executable path of the Node.js process. This can sometimes be inaccurate or challenging for processes running in unusual environments, containers, or those started with non-standard paths.
Performance: On systems with a very large number of running processes, the underlying ps and grep operations performed by ps-nvm might take a noticeable amount of time.
HOW IT WORKS
ps-nvm typically operates by first executing a ps command to list all running processes. It then filters this output to find processes whose command line or executable path contains "node". For each identified Node.js process, it attempts to determine its full executable path. This path is then compared against the known installation directories of NVM-managed Node.js versions (e.g., `~/.nvm/versions/node/vX.Y.Z`). By matching the path, it can report the specific NVM version being used by that process. If the path doesn't match an NVM version, it may indicate an "unmanaged" process.
PS-NVM-UNMANAGED
A closely related helper (often a separate script or function) is ps-nvm-unmanaged. While ps-nvm lists all Node.js processes and attempts to identify their NVM version, ps-nvm-unmanaged specifically focuses on listing Node.js processes that are not managed by NVM (e.g., system-installed Node.js or those installed via other means). This can be useful for identifying potential conflicts or ensuring all desired Node.js processes are under NVM control.
HISTORY
The ps-nvm utility, often implemented as the `nvm_ps_nvm` shell function or a related script, emerged as a practical diagnostic tool within the NVM project. As NVM gained popularity for managing multiple Node.js versions, users faced challenges in identifying which specific Node.js runtime was powering their running applications. ps-nvm was developed to address this visibility gap, providing a quick way to list Node.js processes and their associated NVM versions, or to identify processes that were not managed by NVM. It has evolved with the NVM project, becoming a valuable helper for developers and system administrators working with complex Node.js environments.