Running multiple commands in terminal
It indeed are multiple commands which get run here. If you look up man env
you'll find
SYNOPSIS
env [-iv] [-P altpath] [-S string] [-u name] [name=value ...] [utility [argument ...]]
which explains that env
does, among other things,
- assign values to variables (the
[name=value ...]
bit which in your case isPATH=$PATH:/usr/local/bin /usr/local/lib/node_modules/pm2/bin/pm2
) - and then runs another program passed as an argument (the
[utility [argument ...]]
bit, in your case the call tonpm
).
The intention here is to extend the search PATH of the command run through sudo
in order to have npm
find all the executables it needs.
This is purely a feature of env
, other commands like sudo
or xargs
have similar capabilities. OTOH A;B
, A && B
or A || B
are shell features.