“get”
command is used to copy files from HDFS to local system.
Usgae:
hadoop fs [generic options] -get [-p] [-ignoreCrc] [-crc] <src> ... <localdst>
hadoop fs [generic options] -get [-p] [-ignoreCrc] [-crc] <src> ... <localdst>
Example
hadoop fs -get /user/cloudera/demo1/atlas.docx /user/cloudera/demo1/atlasClient.docx ./testData/
Above
command copies atlas.docx, atlasClient.docx to local file system folder testData.
$ls -lart ./testData/
total 16
-rw-r--r-- 1 cloudera cloudera 35 Mar 23 03:02 b.txt
-rw-r--r-- 1 cloudera cloudera 55 Mar 23 03:02 c.txt
drwxrwxr-x 6 cloudera cloudera 4096 Mar 23 09:49 ..
drwxrwxr-x 2 cloudera cloudera 4096 Mar 23 10:08 .
$
$hadoop fs -ls /user/cloudera/demo1
Found 5 items
-rw-r--r-- 1 cloudera cloudera 2 2022-03-22 23:58 /user/cloudera/demo1/a.txt
-rw-r--r-- 1 cloudera cloudera 6166736 2022-03-22 23:57 /user/cloudera/demo1/atlas.docx
-rw-r--r-- 1 cloudera cloudera 9147128 2022-03-22 23:57 /user/cloudera/demo1/atlasClient.docx
-rw-r--r-- 1 cloudera cloudera 6988969 2022-03-22 23:58 /user/cloudera/demo1/gradle.docx
-rw-r--r-- 1 cloudera cloudera 8986359 2022-03-22 23:58 /user/cloudera/demo1/maven.docx
$
$
$hadoop fs -get /user/cloudera/demo1/atlas.docx /user/cloudera/demo1/atlasClient.docx ./testData/
$
$ls -lart ./testData/
total 14976
-rw-r--r-- 1 cloudera cloudera 35 Mar 23 03:02 b.txt
-rw-r--r-- 1 cloudera cloudera 55 Mar 23 03:02 c.txt
drwxrwxr-x 6 cloudera cloudera 4096 Mar 23 09:49 ..
-rw-r--r-- 1 cloudera cloudera 6166736 Mar 23 10:09 atlas.docx
-rw-r--r-- 1 cloudera cloudera 9147128 Mar 23 10:09 atlasClient.docx
drwxrwxr-x 2 cloudera cloudera 4096 Mar 23 10:09 .
No comments:
Post a Comment