Hadoop Commands(Part-1)
- To check whether all the daemons are working or not.
Command: jps
2. To know the contents or list of contents.
Command: hadoop fs -ls à to know list of contents in the hadoop home directory.
Command : hadoop fs -ls / àto know list of contents in the hadoop root directory.
Output 1:
Output 2:
3. If we want to list the contents of a particular directory.
Command: hadoop fs -ls /directoryname
Output:
4. If we want to create a directory.
Command: hadoop fs -mkdir directoryname
Output:
5. To create an empty file of any format.
Command: hadoop fs -touchz filename
Output:
6. To Copy data from the local system
Command: hadoop fs -copyFromLocal filelocation to hadoop system(location)
(OR)
hadoop fs -put filelocation hadoop system(location)
Output:
7. To copy files from Hadoop file system to the local system.
Command: hadoop fs -copyToLocal filelocation to required location. (OR)
hadoop fs -get filelocation to required location.
Output:
8. To display the contents of the file.
Command: hadoop fs -cat filelocation
9. To move files from one directory to another directory or between local and Hadoop systems.
Command: hadoop fs -mv filelocation(to be transferred) location(file to be saved)
10. To check the disk usage of any directory.
Command: hadoop fs -du directoryname
Output:
11.To check the disk usage of the entire directories at one place.
Command: hadoop fs -dus directoryname
Output :