<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Whoami &#8211; Hostry Help Center</title>
	<atom:link href="https://help.hostry.com/article-tags/whoami/feed/" rel="self" type="application/rss+xml" />
	<link>https://help.hostry.com</link>
	<description>Full information on how to use HOSTRY, provided by 24/7 community based support</description>
	<lastBuildDate>Tue, 20 Jul 2021 07:40:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.12</generator>

<image>
	<url>https://help.hostry.com/wp-content/uploads/cache/2021/01/cropped-apple-icon-180x180-1/836712163.png</url>
	<title>Whoami &#8211; Hostry Help Center</title>
	<link>https://help.hostry.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How To Use The Whoami Command on Linux</title>
		<link>https://help.hostry.com/knowledge-base/how-to-use-the-whoami-command-on-linux/</link>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Tue, 05 May 2020 07:51:47 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=1673</guid>

					<description><![CDATA[The Whoami command prints the username with a valid user ID. This command is able to display the name of the logged in user. Using whoami Command syntax whoami [OPTION] To display the username, enter the following: whoami Next, you will see the username (example &#8211; user1): user1 The command [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>The <strong>Whoami </strong>command prints the username with a valid user ID. This command is able to display the name of the logged in user.</p>



<h2 id="using-whoami" >Using whoami</h2>



<p>Command syntax</p>



<pre class="wp-block-preformatted">whoami [OPTION]</pre>



<p>To display the username, enter the following:</p>



<pre class="wp-block-preformatted">whoami
</pre>



<p>Next, you will see the username (example &#8211; user1):</p>



<p>user1</p>



<p>The command can be used in scripts to verify the name of the user who ran the script. Below is an example of using the if statement to compare the name of the user who runs the script with the given string</p>



<pre class="wp-block-preformatted">if [[ "$(whoami)" != "any_name" ]]; then
  echo "Только пользователь 'any_name' может запустить этот скрипт."
  exit 1
fi</pre>



<p>If the username does not match the given string, then the script will message echo and exit. <strong>Whoami </strong>does not accept arguments. If you pass an argument, the command displays an error message:</p>



<pre class="wp-block-preformatted">whoami: extra operand ‘anything’
Try 'whoami --help' for more information.</pre>



<p>The whoami command accepts only two options:</p>



<blockquote class="wp-block-quote"><p>-h, –help- Show help and exit.</p><p>-V, –version- Displays version information.</p></blockquote>



<h2 id="alternative-commands" >Alternative Commands</h2>



<p>Running the <strong><em>id </em></strong>command with the -un options gives the same result as running whoami:</p>



<pre class="wp-block-preformatted">/usr/bin/id -un</pre>



<p>Use the <strong><em>id </em></strong>command for more information about this user. The $ USER environment variable contains the name of the logged in user:</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
