Accueil·Commandes du terminal

env

Processus et système

Syntaxe

env [VAR=value] [command]

Affiche tout l'environnement, ou lance une commande avec des variables supplementaires ; celles-ci ne valent que pour cette execution et ne laissent rien dans votre shell.

Options courantes

OptionSignification
envWith no arguments, print the whole environment.
VAR=value <command>Run the command with that variable added, for this run only.
-iStart from an empty environment, inheriting nothing.
-u <VAR>Unset one variable for the child process.

Exemples

env | sort | grep -i proxy

Find the proxy variables that are breaking a download.

env NODE_ENV=production node app.js

Set a variable for one run without touching your shell.

env -i bash --noprofile --norc

A shell with nothing inherited, for reproducing a cron failure.

Ce qui tourne et ce qui mange la machine. Identifier vient avant tuer.

Comment lire

  • Les crochets [ ] marquent une partie facultative.
  • Les points de suspension … signifient qu’on peut en mettre plusieurs.
  • Les options sont sensibles à la casse : sur certaines commandes, -r et -R ne font pas la même chose.

Questions fréquentes

Q. Que fait env ?

Affiche tout l'environnement, ou lance une commande avec des variables supplementaires ; celles-ci ne valent que pour cette execution et ne laissent rien dans votre shell.

Q. Comment l’écrire ?

env [VAR=value] [command] — les crochets marquent ce qui est facultatif.

Q. Combien d’options valent la peine ?

Il y en a 4 ici ; la liste complète est dans man env. Cette commande relève de Processus et système.

Commandes liées

page man: man env