$HIVE_HOME, $HOME/.hiverc

How can we see below directories/files -
$HIVE_HOME
$HOME/.hiverc

To find where any command is located, you can use which command.

$ which hive
/usr/bin/hive

hive is located in /usr/bin. It could be a link. Let us check that with ls command.

$ ls -la /usr/bin/hive
lrwxrwxrwx 1 root root 37 Jun  7  2019 /usr/bin/hive -> /usr/hdp/current/hive-client/bin/hive

So, hive command is actually in a different directory and it’s home directory is /usr/hdp/current/hive-client. Let us further check if there is any redirection.

$ ls -l /usr/hdp/current/hive-client
lrwxrwxrwx 1 root root 25 Dec  8 12:06 /usr/hdp/current/hive-client -> /usr/hdp/2.6.2.0-205/hive

Looks like home directory of hive is /usr/hdp/2.6.2.0-205/hive.

$ ls -l /usr/hdp/2.6.2.0-205/hive
total 103668
drwxr-xr-x 3 root root       222 Jun  7  2019 bin
lrwxrwxrwx 1 root root        23 Jun  7  2019 conf -> /etc/hive/2.6.2.0-205/0
drwxr-xr-x 3 root root        94 Jun  7  2019 doc
-rw-r--r-- 1 root root 106142308 Aug 26  2017 hive.tar.gz
drwxr-xr-x 2 root root        59 Jun  7  2019 jdbc
drwxr-xr-x 5 root root      8192 Jun  7  2019 lib
drwxr-xr-x 3 root root        27 Jun  7  2019 log
drwxr-xr-x 2 root root        49 Jun  7  2019 man
drwxrwxrwt 2 hive hive         6 Aug 26  2017 metastore
drwxr-xr-x 3 root root        23 Jun  7  2019 scripts

These are the steps to find out the home directory of anything.

Here $HOME shell variable points to your home directory. Please login in the console and check it.

$ echo $HOME
/home/sandeep

.hiverc would be the file in which you keep all the settings. It will not be existing by default. You will have to create it.

Thanks Sandeep for quick reply.

but why does below command not return anything -

$ echo $HIVE_HOME

That variable is not set.