the env command and its examples

This command can give you the list of all the environment variables set under the system. It is used to run a program in a modified environment. Command comes from “coreutils” package.

Examples:

1. To run a program to ignore environment

$ env -i myprog.sh
$ env –ignore-environment myprog.sh

2. To end each output line with 0 byte rather than newline

$ env -0 myprog.sh
$ env –null myprog.sh 

3. To remove a variable from the environment

$ env -u NAME
$ env –unset=NAME

4. To display the help

$ env –help

5. To display the version

$ env –version

Leave a Reply

Your email address will not be published. Required fields are marked *