查看指令参数:
[root@bigdata2 bin]# ./hadoop fs --help [-lsr <path>] [-du <path>] [-dus <path>] [-count[-q] <path>] [-mv <src> <dst>] [-cp <src> <dst>] [-rm [-skipTrash] <path>] [-rmr [-skipTrash] <path>] [-expunge] [-put <localsrc> ... <dst>] [-copyFromLocal <localsrc> ... <dst>] [-moveFromLocal <localsrc> ... <dst>] [-get [-ignoreCrc] [-crc] <src> <localdst>] [-getmerge <src> <localdst> [addnl]] [-cat <src>] [-text <src>] [-copyToLocal [-ignoreCrc] [-crc] <src> <localdst>] [-moveToLocal [-crc] <src> <localdst>] [-mkdir <path>] [-setrep [-R] [-w] <rep> <path/file>] [-touchz <path>] [-test -[ezd] <path>] [-stat [format] <path>] [-tail [-f] <file>] [-chmod [-R] <MODE[,MODE]... | OCTALMODE> PATH...] [-chown [-R] [OWNER][:[GROUP]] PATH...] [-chgrp [-R] GROUP PATH...] [-help [cmd]]
做一些尝试
[root@bigdata2 bin]# ./hadoop fs -ls Warning: $HADOOP_HOME is deprecated. Found 1 items drwxr-xr-x - root supergroup 0 2014-11-27 16:20 /user/root/testhdfs [root@bigdata2 bin]# ./hadoop fs -mkdir in Warning: $HADOOP_HOME is deprecated. [root@bigdata2 bin]# ./hadoop fs -lsr Warning: $HADOOP_HOME is deprecated. drwxr-xr-x - root supergroup 0 2014-11-27 17:07 /user/root/in -rw-r--r-- 3 root supergroup 12 2014-11-27 17:07 /user/root/in/helloword.txt drwxr-xr-x - root supergroup 0 2014-11-27 17:09 /user/root/out drwxr-xr-x - root supergroup 0 2014-11-27 17:08 /user/root/out/helloword_20141127170832 -rw-r--r-- 3 root supergroup 0 2014-11-27 17:08 /user/root/out/helloword_20141127170832/_SUCCESS -rw-r--r-- 3 root supergroup 12 2014-11-27 17:08 /user/root/out/helloword_20141127170832/part-r-00000 drwxr-xr-x - root supergroup 0 2014-11-27 17:09 /user/root/out/helloword_20141127170921 -rw-r--r-- 3 root supergroup 0 2014-11-27 17:09 /user/root/out/helloword_20141127170921/_SUCCESS -rw-r--r-- 3 root supergroup 12 2014-11-27 17:09 /user/root/out/helloword_20141127170921/part-r-00000 drwxr-xr-x - root supergroup 0 2014-11-27 16:20 /user/root/testhdfs [root@bigdata2 bin]# ./hadoop fs -du Warning: $HADOOP_HOME is deprecated. Found 3 items 12 hdfs://bigdata2:9000/user/root/in 24 hdfs://bigdata2:9000/user/root/out 0 hdfs://bigdata2:9000/user/root/testhdfs [root@bigdata2 bin]# ./hadoop fs -dus Warning: $HADOOP_HOME is deprecated. hdfs://bigdata2:9000/user/root 36 [root@bigdata2 bin]# ./hadoop fs -mv /ussr/root/testhdfs /user/root/out Warning: $HADOOP_HOME is deprecated. mv: /ussr/root/testhdfs: No such file or directory [root@bigdata2 bin]# ./hadoop fs -mv hdfs://bigdata2:9000/user/root/testhdfs hdfs://bigdata2:9000/user/root/out Warning: $HADOOP_HOME is deprecated. [root@bigdata2 bin]# ./hadoop fs -lsr Warning: $HADOOP_HOME is deprecated. drwxr-xr-x - root supergroup 0 2014-11-27 17:07 /user/root/in -rw-r--r-- 3 root supergroup 12 2014-11-27 17:07 /user/root/in/helloword.txt drwxr-xr-x - root supergroup 0 2014-11-27 17:15 /user/root/out drwxr-xr-x - root supergroup 0 2014-11-27 17:08 /user/root/out/helloword_20141127170832 -rw-r--r-- 3 root supergroup 0 2014-11-27 17:08 /user/root/out/helloword_20141127170832/_SUCCESS -rw-r--r-- 3 root supergroup 12 2014-11-27 17:08 /user/root/out/helloword_20141127170832/part-r-00000 drwxr-xr-x - root supergroup 0 2014-11-27 17:09 /user/root/out/helloword_20141127170921 -rw-r--r-- 3 root supergroup 0 2014-11-27 17:09 /user/root/out/helloword_20141127170921/_SUCCESS -rw-r--r-- 3 root supergroup 12 2014-11-27 17:09 /user/root/out/helloword_20141127170921/part-r-00000 drwxr-xr-x - root supergroup 0 2014-11-27 16:20 /user/root/out/testhdfs [root@bigdata2 bin]# ./hadoop fs -cp hdfs://bigdata2:9000/user/root/out/testhdfs hdfs://bigdata2:9000/user/root/ Warning: $HADOOP_HOME is deprecated. [root@bigdata2 bin]# ./hadoop fs -lsr Warning: $HADOOP_HOME is deprecated. drwxr-xr-x - root supergroup 0 2014-11-27 17:07 /user/root/in -rw-r--r-- 3 root supergroup 12 2014-11-27 17:07 /user/root/in/helloword.txt drwxr-xr-x - root supergroup 0 2014-11-27 17:15 /user/root/out drwxr-xr-x - root supergroup 0 2014-11-27 17:08 /user/root/out/helloword_20141127170832 -rw-r--r-- 3 root supergroup 0 2014-11-27 17:08 /user/root/out/helloword_20141127170832/_SUCCESS -rw-r--r-- 3 root supergroup 12 2014-11-27 17:08 /user/root/out/helloword_20141127170832/part-r-00000 drwxr-xr-x - root supergroup 0 2014-11-27 17:09 /user/root/out/helloword_20141127170921 -rw-r--r-- 3 root supergroup 0 2014-11-27 17:09 /user/root/out/helloword_20141127170921/_SUCCESS -rw-r--r-- 3 root supergroup 12 2014-11-27 17:09 /user/root/out/helloword_20141127170921/part-r-00000 drwxr-xr-x - root supergroup 0 2014-11-27 16:20 /user/root/out/testhdfs drwxr-xr-x - root supergroup 0 2014-11-27 17:16 /user/root/testhdfs [root@bigdata2 bin]# ./hadoop fs -rmr /user/root/testhdfs Warning: $HADOOP_HOME is deprecated. Deleted hdfs://bigdata2:9000/user/root/testhdfs [root@bigdata2 bin]# [root@bigdata2 bin]# ./hadoop fs -copyFromLocal /root/software/hadoop-1.0.1/bin/start-all.sh /user/root/out/testhdfs Warning: $HADOOP_HOME is deprecated. [root@bigdata2 bin]# ./hadoop fs -lsr Warning: $HADOOP_HOME is deprecated. drwxr-xr-x - root supergroup 0 2014-11-27 17:07 /user/root/in -rw-r--r-- 3 root supergroup 12 2014-11-27 17:07 /user/root/in/helloword.txt drwxr-xr-x - root supergroup 0 2014-11-27 17:15 /user/root/out drwxr-xr-x - root supergroup 0 2014-11-27 17:08 /user/root/out/helloword_20141127170832 -rw-r--r-- 3 root supergroup 0 2014-11-27 17:08 /user/root/out/helloword_20141127170832/_SUCCESS -rw-r--r-- 3 root supergroup 12 2014-11-27 17:08 /user/root/out/helloword_20141127170832/part-r-00000 drwxr-xr-x - root supergroup 0 2014-11-27 17:09 /user/root/out/helloword_20141127170921 -rw-r--r-- 3 root supergroup 0 2014-11-27 17:09 /user/root/out/helloword_20141127170921/_SUCCESS -rw-r--r-- 3 root supergroup 12 2014-11-27 17:09 /user/root/out/helloword_20141127170921/part-r-00000 drwxr-xr-x - root supergroup 0 2014-11-27 17:19 /user/root/out/testhdfs -rw-r--r-- 1 root supergroup 1166 2014-11-27 17:19 /user/root/out/testhdfs/start-all.sh [root@bigdata2 bin]# ./hadoop fs -copyToLocal /user/root/in/helloword.txt /root/ Warning: $HADOOP_HOME is deprecated. [root@bigdata2 bin]# ls -l /root total 128 -rw-------. 1 root root 1556 Feb 22 2014 anaconda-ks.cfg drwxr-xr-x. 2 root root 4096 Mar 10 2014 bea drwxr-xr-x. 2 root root 4096 Feb 23 2014 Desktop drwxr-xr-x. 2 root root 4096 Feb 22 2014 Documents drwxr-xr-x. 2 root root 4096 Feb 23 2014 Downloads -rw-r--r-- 1 root root 12 Nov 27 17:21 helloword.txt -rw-r--r--. 1 root root 49565 Feb 22 2014 install.log -rw-r--r--. 1 root root 10033 Feb 22 2014 install.log.syslog drwxr-xr-x. 2 root root 4096 Feb 22 2014 Music drwxr-xr-x. 3 root root 4096 Mar 10 2014 Oracle drwxr-xr-x. 2 root root 4096 Feb 22 2014 Pictures drwxr-xr-x. 2 root root 4096 Feb 22 2014 Public drwxr-xr-x. 6 root root 4096 Nov 27 16:07 software drwxr-xr-x. 2 root root 4096 Feb 22 2014 Templates drwxr-xr-x 3 root root 4096 Nov 26 17:25 u drwxr-xr-x. 2 root root 4096 Feb 22 2014 Videos drwxr-xr-x 5 root root 4096 Nov 27 15:57 workspace [root@bigdata2 bin]#