1) Hadoop fs –: Even hadoop CLI Command should start this command only.
Syntax:- root @local host # hadoop fs – command
2) Hadoop fs –ls/ To see all the directories and files in the hadoop file system.
Syntax:- root @local host # hadoop fs – ls/
3) Hadoop Fs –ls/ user: To see all the directories and files of user in the hadoop file system.
Syntax:- root @local host # hadoop fs – ls/users
4) Hadoop fs –ls/ user/root: To see the list of directories and files of /user/root directory in hadoop file system
Syntax:- root @local host # hadoop fs – ls/user/root
5) Hadoop fs –mkdir: To create a new directory in the hadoop file system
a) Syntax:- root @local host # hadoop fs – mkdir test.
The directory fest will be created in default directory of hadoop file system i.e/user/root
To check, the command is
root @local host # hadoop fs – ls/user/root
Output will be:
Drwar-xr-x –root supergroup 0 2011-07-29 12:25
b) Syntax:- root @local host # hadoop fs – mkdir/user/root/test1/user/root/fest
The new directory will be crested in the specified pash.
6) Hadoop Fs –ls/user/root /grcp di name: Used to return the lines which has the name specified after grcp
Example:- root @local host # hadoop fs –ls/user/root / frcp test
Output: drwxr-xr-x-root super group 2011-07-09 12:25 /user/root / test
drwxr-xr-x-root super group 2011-07-09 12:32 /user/root / test
7) Hadoop fs –put: To more the file from local system to Hadoop file system.
8) Hadoop fs –move ToLocal: Is not possible, because there are many replicas of the file is present on HDFS. so moving is not possible.
9) Hadoop Fs –rm: To remove the files from directory i.e same as in local
Ex: a. #hadobp fs –rm hdfs test/*-*
Remove all files from the directory
b. #hadobp fs –rm hdfs test/file1.txt
Remove the files 1.true from the directory.
10) Hadoop fs –rmv: To remove the dir.
Ex: #hadobp fs –rmv hdfs test
11) Hadoop fs –mv: Used to move files from one directory to other directory in hdfs. i.e files not available in source directory.
12) Hadoop fs –cp: To copy the files from one directory to another directory.
Ex: #hadobp fs –cp hdfs test1/* hdfstest
13) Hadoop fs –touch z: It will create the dummy file with
Ex: #hadobp fs –touch z hdfs test/file1.txt
File1 is created
|Big Data On AWS||Informatica Big Data Integration|
|Bigdata Greenplum DBA||Informatica Big Data Edition|
|Hadoop Testing||Apache Mahout|
Ravindra Savaram is a Content Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.