1、hive -h



    显示帮助






2、hive -h hiveserverhost -p port



     连接远程hive服务器



3、hive

--define a=1

--hivevar b=1

--hiveconf hive.cli.print.current.db=true


    见《Hive设置变量 》






4、hive -e



    直接执行hivesql语句






    hive -e "show tables;" > a.txt;



    将执行结果(覆盖)输出到a.txt文件里,>>是追加






5、hive -f a.hql



    执行hsql文件,可以是hdfs上的文件



    hive -f /path/to/dir/a.hql;



    hive -f hdfs://vm1:8020/path/to/dir/a.hql;






6、hive -S



    -S 静默执行






7、hive -i



    hive会话刚启动后,立即执行hql里的内容


[hive@vm1 conf]$ hive -h
Missing argument for option: h
usage: hive
-d,--define <key=value> Variable subsitution to apply to hive
commands. e.g. -d A=B or --define A=B
--database <databasename> Specify the database to use
-e <quoted-query-string> SQL from command line
-f <filename> SQL from files
-H,--help Print help information
-h <hostname> connecting to Hive Server on remote host
--hiveconf <property=value> Use value for given property
--hivevar <key=value> Variable subsitution to apply to hive
commands. e.g. --hivevar A=B
-i <filename> Initialization SQL file
-p <port> connecting to Hive Server on port number
-S,--silent Silent mode in interactive shell
-v,--verbose Verbose mode (echo executed SQL to the
console)