{"id":3267,"date":"2023-01-09T07:10:02","date_gmt":"2023-01-09T07:10:02","guid":{"rendered":"https:\/\/linuxsimply.com\/?p=3267"},"modified":"2024-03-31T10:39:15","modified_gmt":"2024-03-31T10:39:15","slug":"env-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxsimply.com\/env-command-in-linux\/","title":{"rendered":"The \u201cenv\u201d Command in Linux [9 Practical Examples]"},"content":{"rendered":"<p style=\"text-align: justify;\">The <strong>env<\/strong> command in <strong>Linux <\/strong>is a<strong> shell<\/strong> command that stands for <strong>ENV<\/strong>ironment. It is used to display the list of all the current environment <strong>variables<\/strong> or to run a program in an adjusted environment without modifying the current one. Also, sometimes the <strong>shell<\/strong> scripts use the <strong>env<\/strong> command to commence the correct <strong>interpreter<\/strong>. In this article, I will talk about the usage of the <strong>env<\/strong> command by showing some practical examples with several <strong>options<\/strong>. So stick to the end!<\/p>\n<div class=\"su-youtube su-u-responsive-media-yes\"><iframe width=\"600\" height=\"400\" src=\"https:\/\/www.youtube.com\/embed\/z1oKKgt72kw?\" frameborder=\"0\" allowfullscreen allow=\"autoplay; encrypted-media; picture-in-picture\" title=\"\"><\/iframe><\/div>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#A_Description\" >A. Description<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#B_Syntax\" >B. Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#C_Options\" >C. Options<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Practical_Examples_of_the_%E2%80%9Cenv%E2%80%9D_Command_in_Linux\" >Practical Examples of the \u201cenv\u201d Command in Linux<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_1_Use_the_%E2%80%9Cenv%E2%80%9D_Command_in_Linux_to_View_All_the_Current_Shell_Variables\" >Example 1: Use the \u201cenv\u201d Command in Linux to View All the Current Shell Variables<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_2_Empty_the_Environment_to_Start_a_New_Shell_Environment\" >Example 2: Empty the Environment to Start a New Shell Environment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_3_Set_an_Environment_Variable_Using_the_%E2%80%9Cenv%E2%80%9D_Command_in_Linux\" >Example 3: Set an Environment Variable Using the \u201cenv\u201d Command in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_4_Remove_a_Variable_From_the_Environment\" >Example 4: Remove a Variable From the Environment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_5_Change_an_Environment_Variable\" >Example 5: Change an Environment Variable<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_6_Start_Each_Output_Line_with_NUL_No_New_Line\" >Example 6: Start Each Output Line with NUL (No New Line)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_7_Check_the_Version_of_the_%E2%80%9Cenv%E2%80%9D_Command\" >Example 7: Check the Version of the \u201cenv\u201d Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_8_Display_the_Help_Message_for_the_%E2%80%9Cenv%E2%80%9D_Command\" >Example 8: Display the Help Message for the \u201cenv\u201d Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Example_9_Specify_an_Interpreter_to_Use_for_the_Shell_Scripts\" >Example 9: Specify an Interpreter to Use for the Shell Scripts<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Learn_to_Read_the_Error_Status_Based_On_the_%E2%80%9Cenv%E2%80%9D_Command_in_Linux\" >Learn to Read the Error Status Based On the \u201cenv\u201d Command in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"A_Description\"><\/span>A. Description<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/types\/environment-variables\/\" target=\"_blank\" rel=\"noopener\"><strong>environment<\/strong> <strong>variables<\/strong><\/a> are a list of dynamic named values stored in the system to define the behavior of the environment. They can affect the executed programs of the environment too. By using the <strong>env<\/strong> command, these <strong>variables<\/strong> can be added or removed. The <strong>env<\/strong> command can also change or modify the existing <strong>variables<\/strong> by assigning new values to them.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"B_Syntax\"><\/span>B. Syntax<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The <strong>env<\/strong> command is a very useful command to view and modify the shell environment <strong>variables<\/strong>. The<strong> syntax <\/strong>of the command is quite simple. Type the<strong> env<\/strong> command and then the <strong>variable<\/strong> name with the newly assigned <strong>value <\/strong>followed by any <strong>command<\/strong> and its <strong>arguments<\/strong> you want to provide. If no <strong>command<\/strong> is added, then it prints the resulting environment.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env [options]... [NAME=value]... [command[arg]...]<\/code><\/pre>\n<div class=\"su-note\"  style=\"border-color:#cedfe2;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#E8F9FC;border-color:#ffffff;color:#333333;\"><strong>Note: <\/strong>Whatever is enclosed by a square bracket in the above <strong>syntax<\/strong> is not mandatory. Moreover, those enclosed by square brackets and followed by <strong>3 dots<\/strong> represent that multiple <strong>options, variables,<\/strong> and <strong>command arguments<\/strong> can be used or modified at a time. <\/div><\/div>\n<h3><span class=\"ez-toc-section\" id=\"C_Options\"><\/span>C. Options<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The <strong>env<\/strong> command without any <strong>options <\/strong>shows the list of all environmental <strong>variables<\/strong>. Also, there are several <strong>options<\/strong> to modify the usage of this command. I will list some of the most useful ones with their purposes here. You can check the <strong>man<\/strong> page to read more about them.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">man env<\/code><\/pre>\n<p><span style=\"color: #800080;\"><strong>Useful Options<\/strong><\/span><\/p>\n<div class=\"su-list\" style=\"margin-left:20px\">\n<ul>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-i<\/strong> or<strong> &#8211;<\/strong>,<strong> &#8211;ignore <\/strong>(to start with an empty environment)<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-0, &#8211;null<\/strong> (to end each output line with <strong>NUL<\/strong> (No New Line))<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-u, &#8211;unset=NAME <\/strong>( to remove the named variable from the environment)<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-C, &#8211;chdir=DIR <\/strong>(to change the working directory to DIR)<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>-S, &#8211;split-string=S<\/strong> (to pass multiple arguments on shebang lines)<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>&#8211;version<\/strong> (to output version information and exit)<\/li>\n<\/ul>\n<\/div>\n<div class=\"su-note\"  style=\"border-color:#cedfe2;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#E8F9FC;border-color:#ffffff;color:#333333;\"><strong>Note:<\/strong> The <strong>options<\/strong> in Linux <a href=\"https:\/\/linuxsimply.com\/cli-in-linux\/\" target=\"_blank\" rel=\"noopener\"><strong>CLI(Command Line Interface)<\/strong><\/a> are all <strong>case-sensitive<\/strong>, So be cautious while using them.<\/p>\n<\/div><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Practical_Examples_of_the_%E2%80%9Cenv%E2%80%9D_Command_in_Linux\"><\/span>Practical Examples of the \u201cenv\u201d Command in Linux<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">The <strong>env <\/strong>command is a very useful command in <strong>Linux<\/strong>. You can easily check all your environment <strong>variables<\/strong>. Moreover, to modify or change, this command is an efficient<strong> tool<\/strong>. Below I will talk about the usage of this command with some practical examples.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_1_Use_the_%E2%80%9Cenv%E2%80%9D_Command_in_Linux_to_View_All_the_Current_Shell_Variables\"><\/span>Example 1: Use the \u201cenv\u201d Command in Linux to View All the Current Shell Variables<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">When you will use the <strong>env<\/strong> command only, without any <strong>options<\/strong> or <strong>arguments<\/strong>, it will print out all the environment <strong>variables<\/strong>. The syntax is:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env<\/code><\/pre>\n<p>Follow the below steps to check yourself.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <a href=\"https:\/\/linuxsimply.com\/what-is-terminal-in-linux\/\" target=\"_blank\" rel=\"noopener\"><strong>Ubuntu Terminal<\/strong><\/a>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">From the output image, you can see a list of all the <strong>environment variables<\/strong>. As it is a long list, all of them did not fit on one page. So you have to scroll down to check them all.<img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-3269\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1.png\" alt=\"env command in linux to view all environment variables.\" width=\"700\" height=\"466\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-300x200.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-1024x682.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-768x511.png 768w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-1536x1023.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-2048x1363.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-225x150.png 225w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-100x67.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-526x350.png 526w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-1-788x524.png 788w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<hr \/>\n<p><strong><span style=\"font-size: 18pt; color: #000080;\"><a style=\"color: #000080;\" href=\"https:\/\/linuxsimply.com\/wp-admin\/edit.php?post_type=post&amp;author=314897\">Similar Readings<\/a><\/span><\/strong><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/time-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201ctime\u201d Command in Linux [4 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/tty-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201ctty\u201d Command in Linux [4 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/uptime-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cuptime\u201d Command in Linux [5 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/vmstat-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cvmstat\u201d Command in Linux [6 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/uname-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cuname\u201d Command in Linux [11 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/apt-get-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201capt-get\u201d Command in Linux [10 Practical Examples]<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<h3><span class=\"ez-toc-section\" id=\"Example_2_Empty_the_Environment_to_Start_a_New_Shell_Environment\"><\/span>Example 2: Empty the Environment to Start a New Shell Environment<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">You can clear out an environment and then start a command in that empty environment. No existing <strong>variables<\/strong> of the environment will be there in the new <strong>shell<\/strong>. To clear an environment use the<strong> long option &#8211;ignore <\/strong>or<strong> short option -i <\/strong>or<strong> &#8211; <\/strong>(only) with the<strong> env <\/strong>command. The syntax is:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env -i \/bin\/sh<\/code><\/pre>\n<p>Clear your current environment by following the below steps.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env -i \/bin\/sh<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p>\u278d Now to check all the current environment variables, type the following command.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env<\/code><\/pre>\n<p>\u278e After that, tap the<strong> ENTER <\/strong>key.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">From the output image, you can see it clears out all the environment <strong>variables <\/strong>and then sets the new <strong>shell variable PWD<\/strong>. Then we run the command <strong>env <\/strong>to check the list of environment <strong>variables<\/strong>, where we will only see the <strong>PWD variable <\/strong>as the output.<img decoding=\"async\" class=\"aligncenter size-full wp-image-3270\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2.png\" alt=\"Ignore environment using the env command in linux.\" width=\"379\" height=\"151\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2.png 379w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-300x120.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-1024x408.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-766x305.png 766w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-1536x612.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-2048x816.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-376x150.png 376w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-100x40.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-878x350.png 878w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-2-788x313.png 788w\" sizes=\"(max-width: 379px) 100vw, 379px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_3_Set_an_Environment_Variable_Using_the_%E2%80%9Cenv%E2%80%9D_Command_in_Linux\"><\/span>Example 3: Set an Environment Variable Using the \u201cenv\u201d Command in Linux<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Environment <strong>variables<\/strong> are specific to a certain environment. You can set an environment <strong>variable<\/strong> for the current <strong>shell<\/strong> using the <strong>env<\/strong> command temporarily. By convention, these variables should have<strong> upper-case<\/strong> names as they are <strong>case-sensitive<\/strong>. You can assign multiple values to a<strong> variable<\/strong>, just separate them using the <strong>colon (:) sign<\/strong>. To set an environment <strong>variable<\/strong> type the<strong> env <\/strong>command followed by the<strong> variable<\/strong> name and then its assigned <strong>value<\/strong> using an <strong>equal sign (=) <\/strong>before that. The syntax is:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env VARIABLE=Value<\/code><\/pre>\n<p>Follow the below steps to create an environment <strong>variable<\/strong>.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a Start by opening the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt to set a value to a<strong> variable<\/strong> called <strong>HOME<\/strong>:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env HOME=safe place<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">From the output display, you will a list of your current <strong>shell variables<\/strong>. And you can find your newly created <strong>environment variable HOME<\/strong> and its assigned value <strong>\u2018safe place\u2019<\/strong> in there.<img decoding=\"async\" class=\"aligncenter size-full wp-image-3271\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3.png\" alt=\"Set variable using env command in linux.\" width=\"647\" height=\"414\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3.png 647w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-300x192.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-1024x655.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-767x491.png 767w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-1536x983.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-2048x1310.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-234x150.png 234w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-100x64.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-547x350.png 547w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-3-788x504.png 788w\" sizes=\"(max-width: 647px) 100vw, 647px\" \/><\/p>\n<hr \/>\n<p><strong><span style=\"font-size: 18pt; color: #000080;\"><a style=\"color: #000080;\" href=\"https:\/\/linuxsimply.com\/wp-admin\/edit.php?post_type=post&amp;author=314897\">Similar Readings<\/a><\/span><\/strong><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/free-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cfree\u201d Command in Linux [8 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/getent-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cgetent\u201d Command in Linux [11 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/groupadd-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cgroupadd\u201d Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/addgroup-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201caddgroup\u201d Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/groups-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cgroups\u201d Command in Linux [6 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/firewall-cmd-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cfirewall-cmd\u201d Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<h3><span class=\"ez-toc-section\" id=\"Example_4_Remove_a_Variable_From_the_Environment\"><\/span>Example 4: Remove a Variable From the Environment<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Now after you learn to set a <strong>variable<\/strong> from the previous example, you ought to know how to unset one too. As I already mentioned these are <strong>variables<\/strong> that are only valid for the running <strong>shell<\/strong>, they will disappear as soon as you empty your environment or you close your <strong>terminal<\/strong>. But if you want to unset one while you are still in the same<strong> shell <\/strong>environment then use the <strong>env<\/strong> command with the <strong>long option &#8211;unset<\/strong>, followed by the <strong>variable<\/strong> name you want to unset. The syntax is:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env -u VARIABLE_NAME<\/code><\/pre>\n<p>Follow the below steps to unset the<strong> variable HOME <\/strong>we set in the <strong>previous example<\/strong>.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a Begin by opening the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env -u HOME<\/code><\/pre>\n<p>\u278c Now, hit the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>Check the output display, the <strong>variable HOME<\/strong> is absent from the list of current environment <strong>variable<\/strong> list.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3272\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4.png\" alt=\"Unset variable using the env command in linux.\" width=\"657\" height=\"326\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4.png 657w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-300x149.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-1024x508.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-768x381.png 768w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-1536x762.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-2048x1016.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-302x150.png 302w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-100x50.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-705x350.png 705w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-4-788x391.png 788w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_5_Change_an_Environment_Variable\"><\/span>Example 5: Change an Environment Variable<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">You can change the assigned<strong> value<\/strong> of a <strong>variable <\/strong>for any command. For that, use the <strong>env <\/strong>command then the<strong> variable <\/strong>name with the new <strong>value<\/strong> for it, and then the command name, whose <strong>variable value<\/strong> you are changing. The syntax is:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env VARIABLE=value command_name<\/code><\/pre>\n<p>Check the below example. Where I will change the<strong> TZ variable<\/strong> of the <strong>date<\/strong> command.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the date command just to check its default output.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">date<\/code><\/pre>\n<p>\u278b Now, type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env TZ=MST7MDT date<\/code><\/pre>\n<p>\u278c Then press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">From the output of the <strong>date <\/strong>command, you can see the time format is set to the time format of the operating system. I changed the <strong>variable<\/strong> to set the time format to standard time <strong>MST<\/strong>. Now compare the change in the format from the <strong>output <\/strong>after running the command again.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3273\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5.png\" alt=\"Modify variables of command.\" width=\"344\" height=\"127\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5.png 344w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-300x111.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-1024x378.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-767x283.png 767w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-1536x567.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-2048x756.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-406x150.png 406w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-100x37.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-948x350.png 948w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-5-788x290.png 788w\" sizes=\"(max-width: 344px) 100vw, 344px\" \/><\/p>\n<hr \/>\n<p><strong><span style=\"font-size: 18pt; color: #000080;\"><a style=\"color: #000080;\" href=\"https:\/\/linuxsimply.com\/wp-admin\/edit.php?post_type=post&amp;author=314897\">Similar Readings<\/a><\/span><\/strong><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/groupmod-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cgroupmod\u201d Command in Linux [5+ Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/id-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cid\u201d Command in Linux [7+ Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/service-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cservice\u201d Command in Linux [6 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/sestatus-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201csestatus\u201d Command in Linux [4 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/shutdown-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cshutdown\u201d Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/finger-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cfinger\u201d Command in Linux [6 Practical Examples]<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<h3><span class=\"ez-toc-section\" id=\"Example_6_Start_Each_Output_Line_with_NUL_No_New_Line\"><\/span>Example 6: Start Each Output Line with NUL (No New Line)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">You can display the <strong>output<\/strong> of the<strong> env <\/strong>command in a way where all the output lines will be displayed without any line break. There will be no new line. You have to use the<strong> long option &#8211;null<\/strong> or <strong>-0 <\/strong>with the <strong>env<\/strong> command. The syntax is:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env -0<\/code><\/pre>\n<p>To check practically, follow the below steps.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a First, begin the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env -0<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">From the output display, you can see all the <strong>environment variables<\/strong>. But they are all in one line. No new lines were added.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3274\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6.png\" alt=\"Output with no no line break in between them.\" width=\"825\" height=\"161\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-300x59.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-1024x200.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-764x149.png 764w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-1536x300.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-2048x400.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-769x150.png 769w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-100x20.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-1793x350.png 1793w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-6-788x153.png 788w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_7_Check_the_Version_of_the_%E2%80%9Cenv%E2%80%9D_Command\"><\/span>Example 7: Check the Version of the \u201cenv\u201d Command<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">You can check the version of the <strong>env <\/strong>command installed in your <strong>ubuntu<\/strong>. To check use the <strong>&#8211;version option<\/strong> with the <strong>env<\/strong> command. The syntax is:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env --version<\/code><\/pre>\n<p>Follow the below steps.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env --version<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>From the output image, you will see the <strong>version <\/strong>of your <strong>env <\/strong>command. Check mine from the below image.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3275\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7.png\" alt=\"Check the version of the env command in linux.\" width=\"825\" height=\"203\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-300x74.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-1024x252.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-764x188.png 764w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-1536x378.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-2048x504.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-610x150.png 610w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-100x25.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-1422x350.png 1422w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-7-788x193.png 788w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/p>\n<hr \/>\n<p><strong><span style=\"font-size: 18pt; color: #000080;\"><a style=\"color: #000080;\" href=\"https:\/\/linuxsimply.com\/wp-admin\/edit.php?post_type=post&amp;author=314897\">Similar Readings<\/a><\/span><\/strong><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/dmesg-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cdmesg\u201d Command in Linux [7+ Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/install-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cinstall\u201d Command in Linux [6+ Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/reboot-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201creboot\u201d Command in Linux [3 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/sync-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201csync\u201d Command in Linux [8 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/chage-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cchage\u201d Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/top-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The &#8220;top&#8221; Command in Linux [8 Practical Examples]<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<h3><span class=\"ez-toc-section\" id=\"Example_8_Display_the_Help_Message_for_the_%E2%80%9Cenv%E2%80%9D_Command\"><\/span>Example 8: Display the Help Message for the \u201cenv\u201d Command<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Learn more about the <strong>env<\/strong> command with the help of the <strong>option &#8211;help<\/strong>. Just like the <strong>man <\/strong>page, it will display all the important information about the command. Just type the <strong>env<\/strong> command then the <strong>long option &#8212; help<\/strong>. The syntax is:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env --help<\/code><\/pre>\n<p>Follow the below steps.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following command in the command prompt:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">env --help<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p>From the output image, you will see all the information such as the <strong>options list <\/strong>with a short description, <strong>syntax<\/strong>, and more <strong>online help links<\/strong> about the <strong>env<\/strong> command.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3276\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8.png\" alt=\"Help message for the env command.\" width=\"700\" height=\"517\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-300x222.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-1024x756.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-768x567.png 768w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-1536x1134.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-2048x1513.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-203x150.png 203w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-100x74.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-474x350.png 474w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-8-788x581.png 788w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_9_Specify_an_Interpreter_to_Use_for_the_Shell_Scripts\"><\/span>Example 9: Specify an Interpreter to Use for the Shell Scripts<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">You can specify the name of an <strong>interpreter<\/strong> to be used for your <strong>shell<\/strong> <strong>scripts<\/strong>. For that, you have to use the <strong>env<\/strong> command with the <strong>shebang <\/strong>in the first line of the <strong>script<\/strong> followed by the <strong>path<\/strong> of the specific <strong>interpreter<\/strong>. This way the <strong>interpreter<\/strong> is searched for and located along with the execution of the <strong>script<\/strong>. This makes the<strong> script<\/strong> more portable. But it also has some risks of selecting the wrong <strong>interpreter<\/strong> as it searches for a match in every <strong>directory<\/strong> on the <strong>executable path<\/strong>. So be careful while you are using it.<\/p>\n<p>Check the below example to learn how to do it practically.<\/p>\n<p><span style=\"color: #800080;\"><strong>Steps to Follow &gt;<\/strong><\/span><\/p>\n<p>\u278a At first open the <strong>Ubuntu Terminal<\/strong>.<\/p>\n<p>\u278b Type the following nano command in the command prompt to write into the script_name:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">nano script_name<\/code><\/pre>\n<p>\u278c Now, press the <strong>ENTER<\/strong> button.<\/p>\n<p>\u278d After that <strong>nano editor<\/strong> will pop up. Write the following line to tell the script_name to select the<strong> bash<\/strong> as an<strong> interpreter<\/strong>. And then write a message inside the<strong> echo<\/strong> command.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/usr\/bin\/env\/bash<\/code><\/pre>\n<pre><code class=\"language-bash\" data-line=\"\">echo \u201dHi there\u201d<\/code><\/pre>\n<p>\u278e After that <strong>save <\/strong>the script by pressing <strong>(CTRL+S)<\/strong> and then <strong>quit<\/strong> by <strong>(CTRL+X).<\/strong><\/p>\n<p>\u278f Now run the following command to execute your script using the <strong>bash interpreter<\/strong>.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">bash script_name<\/code><\/pre>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">At first, after using the <strong>nano<\/strong> command, the editor will pop up where the <strong>shebang path<\/strong> of the correct interpreter will be written as you can see in the below picture. After that, I wrote the message to be delivered using the <strong>echo<\/strong> command.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3277\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9.png\" alt=\"Shebang line in nano editor.\" width=\"463\" height=\"98\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9.png 463w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-300x63.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-1024x217.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-765x162.png 765w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-1536x325.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-2048x433.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-709x150.png 709w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-100x21.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-1654x350.png 1654w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-9-788x166.png 788w\" sizes=\"(max-width: 463px) 100vw, 463px\" \/>After the execution of the<strong> script_name<\/strong>, you will see the message that I wrote inside it as the output.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3278\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10.png\" alt=\"Using bash script as interpreter.\" width=\"426\" height=\"116\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10.png 426w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-300x82.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-1024x279.png 1024w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-768x209.png 768w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-1536x418.png 1536w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-2048x558.png 2048w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-551x150.png 551w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-100x27.png 100w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-1285x350.png 1285w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-10-788x214.png 788w\" sizes=\"(max-width: 426px) 100vw, 426px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Learn_to_Read_the_Error_Status_Based_On_the_%E2%80%9Cenv%E2%80%9D_Command_in_Linux\"><\/span>Learn to Read the Error Status Based On the \u201cenv\u201d Command in Linux<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">The env command produces different <strong>exit codes<\/strong>. From those <strong>codes<\/strong>, you can determine what kind of <strong>error <\/strong>occurred while running the command. Read the below code description to learn about them.<\/p>\n<div class=\"su-list\" style=\"margin-left:20px\">\n<ul>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/strong><strong>\u2192\u00a0\u00a0\u00a0\u00a0 <\/strong>When no command is specified &amp; the output is the environment.<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>1-125\u2192\u00a0\u00a0\u00a0\u00a0 <\/strong>When the command \u2018env\u2019 itself fails.<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>126 \u00a0\u00a0\u2192\u00a0\u00a0\u00a0\u00a0 <\/strong>The command is found but can not be invoked.<\/li>\n<li><i class=\"sui sui-arrow-right\" style=\"color:#000000\"><\/i> <strong>127\u00a0\u00a0 \u2192\u00a0\u00a0\u00a0\u00a0 <\/strong>If command can not be found<strong>.<\/strong><\/li>\n<\/ul>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">In this article, I discussed the <strong>env <\/strong>command and its usage with practical examples. If you go through the examples one by one, hope you will learn most of the stuff related to the command <strong>tool<\/strong>. Hope this article helps you on your way to becoming a power user of <strong>LINUX<\/strong>.<\/p>\n<hr \/>\n<p><strong><span style=\"font-size: 18pt; color: #000080;\"><a style=\"color: #000080;\" href=\"https:\/\/linuxsimply.com\/wp-admin\/edit.php?post_type=post&amp;author=314897\">Similar Readings<\/a><\/span><\/strong><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/passwd-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The &#8220;passwd&#8221; Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/df-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cdf\u201d Command in Linux [11 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/sudo-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201csudo\u201d Command in Linux [8 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/apt-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201capt\u201d Command in Linux [13+ Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/htop-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The &#8220;htop&#8221; Command in Linux [7 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/enable-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">The \u201cenable\u201d Command in Linux [6 Practical Examples]<\/a><\/strong><\/li>\n<\/ul>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;3267&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;The \u201cenv\u201d Command in Linux [9 Practical Examples]&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            <span class=\"kksr-muted\">Rate this post<\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>The env command in Linux is a shell command that stands for ENVironment. It is used to display the list &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"The \u201cenv\u201d Command in Linux [9 Practical Examples]\" class=\"read-more button\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/#more-3267\" aria-label=\"Read more about The \u201cenv\u201d Command in Linux [9 Practical Examples]\">Read more<\/a><\/p>\n","protected":false},"author":314897,"featured_media":3296,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[51],"class_list":["post-3267","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-commands","tag-system-commands","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The \u201cenv\u201d Command in Linux [9 Practical Examples]<\/title>\n<meta name=\"description\" content=\"The env command is a useful command tool in linux to view, add, remove or modify shell environment variables.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/linuxsimply.com\/env-command-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The \u201cenv\u201d Command in Linux [9 Practical Examples]\" \/>\n<meta property=\"og:description\" content=\"The env command is a useful command tool in linux to view, add, remove or modify shell environment variables.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linuxsimply.com\/env-command-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"LinuxSimply\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/moniramunny05\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-09T07:10:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-31T10:39:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-11.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Monira Akter Munny\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Monira Akter Munny\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/\"},\"author\":{\"name\":\"Monira Akter Munny\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/2d8ccee92571d892b55ef5999761fc9e\"},\"headline\":\"The \u201cenv\u201d Command in Linux [9 Practical Examples]\",\"datePublished\":\"2023-01-09T07:10:02+00:00\",\"dateModified\":\"2024-03-31T10:39:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/\"},\"wordCount\":2140,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/env-command-in-linux-11.png\",\"keywords\":[\"system commands\"],\"articleSection\":[\"Linux Commands\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/\",\"name\":\"The \u201cenv\u201d Command in Linux [9 Practical Examples]\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/env-command-in-linux-11.png\",\"datePublished\":\"2023-01-09T07:10:02+00:00\",\"dateModified\":\"2024-03-31T10:39:15+00:00\",\"description\":\"The env command is a useful command tool in linux to view, add, remove or modify shell environment variables.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/#primaryimage\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/env-command-in-linux-11.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/env-command-in-linux-11.png\",\"width\":400,\"height\":400,\"caption\":\"The env command in linux.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/env-command-in-linux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The \u201cenv\u201d Command in Linux [9 Practical Examples]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/\",\"name\":\"LinuxSimply\",\"description\":\"All About Linux\",\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/linuxsimply.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\",\"name\":\"LinuxSimply\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/LinuxSimply-New-Logo-Without-Icon.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/LinuxSimply-New-Logo-Without-Icon.png\",\"width\":355,\"height\":48,\"caption\":\"LinuxSimply\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/2d8ccee92571d892b55ef5999761fc9e\",\"name\":\"Monira Akter Munny\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Monira-Akter-Munny-II-96x96.png\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Monira-Akter-Munny-II-96x96.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Monira-Akter-Munny-II-96x96.png\",\"caption\":\"Monira Akter Munny\"},\"description\":\"Hello!! This is Monira Akter Munny. I'm a Linux content developer executive here, at SOFTEKO company. I have completed my B.Sc. in Engineering from Rajshahi University of Engineering &amp; Technology in the Electrical &amp; Electronics department. I'm more of an online gaming person who also loves to read blogs &amp; write. As an open-minded person ready to learn &amp; adapt to new territory, I'm always excited to explore the Linux world &amp; share it with you! Read Full Bio\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/moniramunny05\",\"https:\\\/\\\/www.instagram.com\\\/monira_munny\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/monira-akter-munny-a76742113\\\/\"],\"url\":\"https:\\\/\\\/linuxsimply.com\\\/author\\\/munny\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The \u201cenv\u201d Command in Linux [9 Practical Examples]","description":"The env command is a useful command tool in linux to view, add, remove or modify shell environment variables.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/linuxsimply.com\/env-command-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"The \u201cenv\u201d Command in Linux [9 Practical Examples]","og_description":"The env command is a useful command tool in linux to view, add, remove or modify shell environment variables.","og_url":"https:\/\/linuxsimply.com\/env-command-in-linux\/","og_site_name":"LinuxSimply","article_author":"https:\/\/www.facebook.com\/moniramunny05","article_published_time":"2023-01-09T07:10:02+00:00","article_modified_time":"2024-03-31T10:39:15+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-11.png","type":"image\/png"}],"author":"Monira Akter Munny","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Monira Akter Munny","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/#article","isPartOf":{"@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/"},"author":{"name":"Monira Akter Munny","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/2d8ccee92571d892b55ef5999761fc9e"},"headline":"The \u201cenv\u201d Command in Linux [9 Practical Examples]","datePublished":"2023-01-09T07:10:02+00:00","dateModified":"2024-03-31T10:39:15+00:00","mainEntityOfPage":{"@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/"},"wordCount":2140,"commentCount":0,"publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"image":{"@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-11.png","keywords":["system commands"],"articleSection":["Linux Commands"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linuxsimply.com\/env-command-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/","url":"https:\/\/linuxsimply.com\/env-command-in-linux\/","name":"The \u201cenv\u201d Command in Linux [9 Practical Examples]","isPartOf":{"@id":"https:\/\/linuxsimply.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-11.png","datePublished":"2023-01-09T07:10:02+00:00","dateModified":"2024-03-31T10:39:15+00:00","description":"The env command is a useful command tool in linux to view, add, remove or modify shell environment variables.","breadcrumb":{"@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linuxsimply.com\/env-command-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/#primaryimage","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-11.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/01\/env-command-in-linux-11.png","width":400,"height":400,"caption":"The env command in linux."},{"@type":"BreadcrumbList","@id":"https:\/\/linuxsimply.com\/env-command-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/linuxsimply.com\/"},{"@type":"ListItem","position":2,"name":"The \u201cenv\u201d Command in Linux [9 Practical Examples]"}]},{"@type":"WebSite","@id":"https:\/\/linuxsimply.com\/#website","url":"https:\/\/linuxsimply.com\/","name":"LinuxSimply","description":"All About Linux","publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/linuxsimply.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/linuxsimply.com\/#organization","name":"LinuxSimply","url":"https:\/\/linuxsimply.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/#\/schema\/logo\/image\/","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/LinuxSimply-New-Logo-Without-Icon.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/LinuxSimply-New-Logo-Without-Icon.png","width":355,"height":48,"caption":"LinuxSimply"},"image":{"@id":"https:\/\/linuxsimply.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/2d8ccee92571d892b55ef5999761fc9e","name":"Monira Akter Munny","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Monira-Akter-Munny-II-96x96.png","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Monira-Akter-Munny-II-96x96.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Monira-Akter-Munny-II-96x96.png","caption":"Monira Akter Munny"},"description":"Hello!! This is Monira Akter Munny. I'm a Linux content developer executive here, at SOFTEKO company. I have completed my B.Sc. in Engineering from Rajshahi University of Engineering &amp; Technology in the Electrical &amp; Electronics department. I'm more of an online gaming person who also loves to read blogs &amp; write. As an open-minded person ready to learn &amp; adapt to new territory, I'm always excited to explore the Linux world &amp; share it with you! Read Full Bio","sameAs":["https:\/\/www.facebook.com\/moniramunny05","https:\/\/www.instagram.com\/monira_munny\/","https:\/\/www.linkedin.com\/in\/monira-akter-munny-a76742113\/"],"url":"https:\/\/linuxsimply.com\/author\/munny\/"}]}},"_links":{"self":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/3267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/users\/314897"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/comments?post=3267"}],"version-history":[{"count":0,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/3267\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media\/3296"}],"wp:attachment":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media?parent=3267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/categories?post=3267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/tags?post=3267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}