EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials Hadoop Tutorial Hadoop Commands
Secondary Sidebar
Hadoop Tutorial
  • Commands
    • Hadoop Commands
    • Hadoop fs Commands
    • Hadoop FS Command List
    • HDFS Commands
    • HDFS ls
    • Hadoop Stack
    • HBase Commands
  • Basics
    • What is Hadoop
    • Career in Hadoop
    • Advantages of Hadoop
    • Uses of Hadoop
    • Hadoop Versions
    • HADOOP Framework
    • Hadoop Architecture
    • Hadoop Configuration
    • Hadoop Components
    • Hadoop WordCount
    • Hadoop Database
    • Hadoop Ecosystem
    • Hadoop Tools
    • Install Hadoop
    • Is Hadoop Open Source
    • What is Hadoop Cluster
    • Hadoop Namenode
    • Hadoop data lake
    • Hadoop fsck
    • HDFS File System
    • Hadoop Distributed File System
  • Advanced
    • What is Yarn in Hadoop
    • Hadoop?Administrator
    • Hadoop DistCp
    • Hadoop Administrator Jobs
    • Hadoop Schedulers
    • Hadoop Distributed File System (HDFS)
    • Hadoop Hue
    • Hadoop Streaming
    • Apache Hadoop Ecosystem
    • Distributed Cache in Hadoop
    • Hadoop Ecosystem Components
    • Hadoop YARN Architecture
    • HDFS Architecture
    • What is HDFS
    • HDFS Federation
    • Apache HBase
    • HBase Architecture
    • What is Hbase
    • HBase Shell Commands
    • What is MapReduce in Hadoop
    • Mapreduce Combiner
    • MapReduce Architecture
    • MapReduce Word Count
    • Impala Shell
    • HBase Create Table
  • Interview Questions
    • Hadoop Admin Interview Questions
    • Hadoop Cluster Interview Questions
    • Hadoop developer interview Questions
    • HBase Interview Questions

Hadoop Commands

By Priya PedamkarPriya Pedamkar

Hadoop-Commands

Introduction of Hadoop Commands

Hadoop commands are mainly used to execute several operations. HDFS operations and supervise the file available in the HDFS cluster. Hadoop HDFS is a distributed file system that provides redundant storage for large-sized files to be stored. It is used to store petabyte files in the terabyte range. HDFS is the primary or main component of this ecosystem that is responsible for storing large data sets of structured or unstructured data across various nodes and thus maintaining the metadata in the form of log files. All the commands are executed by the bin shell scripts.

HDFS Commands

Here we discussed various HDFS commands which are used for HDFS File Operations.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

  • version
  • mkdir
  • ls
  • put
  • copy from local
  • get
  • copyTOLocal
  • cat
  • mv
  • cp
  • move from local
  • move to local
  • tail
  • rm
  • expunge
  • chown
  • chgrp
  • setrep
  • du
  • df
  • touchz
  • append to file
  • count
  • checksum

1. version

That command is used to check the Hadoop version.

Command:

hdfs dfs version

2. mkdir

This Hadoop command is used to make new directories and takes the URI path as parameters

Command:

hdfs dfs -mkdir /usr/local/firstdir?

3. ls

This Hadoop Command is used to displays the list of the contents of a particular directory given by the user. It also contents name, permission, size and owner and last edit date.

Command:

hdfs dfs -ls /usr/local/firstdir

4. put

This Hadoop Command is used to copies the content from the local file system to the other location within DFS.

Command:  

hdfs dfs -put  source_dir   destination_dir

5. copyFromLocal

This Hadoop command is the same as put command but here one difference is here like in case this command source directory is restricted to local file reference.

Command: 

hdfs dfs -copyFromLocal  local_src  destination_dir

6. get

This Hadoop Command fetches all files that match the src dir which is entered by the user in HDFS and generates a copy of them in the local file system.

Command: 

hdfs dfs -get  source_dir  local_dir?

7. copyTOLocal

This Hadoop Command is using the same as getting command but one difference is that in this the destination is limited to a local file path.

Command:

hdfs -dfs  -copyToLocal  src_dir  local_dir

8. cat

This Hadoop Command displays the content of the file name on the console.

Command:

hdfs dfs -cat  dir_path

9. mv

This Hadoop Command moves the file and directory one location to another location within hdfs.

Command:

hdfs fs -mv source_dir_filename  destination_dir

10. cp

This Hadoop command copies the file and directory one location to other locations within hdfs.

Command:

hdfs fs -cp source_dir_filename  destination_dir

11. moveFromLocal

It copies content from the local file system to a destination within HDFS but the copy is a success then deletes content from the local file system.

Command:

hdfs dfs -move from local local_src  destination_dir

12. move to local

This Hadoop command runs as -get commands but one difference is that when the copy operation is a success then delete the file from HDFS location.

Commands

move to local source_dir  local_dir

13. tail

It displays 1 KB content on the console of the file.

Command:

hdfs dfs -tail file_path

14. rm

It removes files and directory from the specified path.

Command:

hdfs dfs -rm dir_name

15. expunge

This is used to empty the trash.

Command:

hdfs dfs -expunge

16. chown

It used to change the owner of files. We can also use it by -R for recursively.

Command:

hdfs dfs -chown  owner_name  dir_name

17. chgrp

This is used to change the group of files. We can also use it by -R for recursively.

Command:

hdfs dfs -chgrp  group_name  dir_name

18. du

This displays disk usage for all files available in the present directory with the path given by the user and prints information in bytes format.

Command:

hdfs dfs -du  dir_name

19. df

This Hadoop Command displays free space.

Command:

hdfs dfs -df -h

20. touchz

This is used to create a file with a path and includes current time as timestamp and is also the path is exiting if exits then fail to create process.

Command:

hdfs dfs -touchz dir_name

21. appendToFile

It appends one and multiple sources from the local file system to the destination.

Command:

hdfs dfs -append to file local_src….  Destination_dir_name

22. count

This is used to counts the number of directories and files.

Command:

hdfs dfs -count dir_name

23. checksum

It returns checksum information of a particular file.

Command:

hdfs dfs -checksum file_name

Recommended Articles

This is a guide to Hadoop Commands. Here we discuss the introduction, various HDFS Commands in Hadoop that are used for HDFS File Operations. You can also go through our other suggested articles to learn more –

  1. Hadoop Administrator
  2. Install Hadoop
  3. HBase Commands
  4. Hadoop Tools
Popular Course in this category
Hadoop Training Program (20 Courses, 14+ Projects, 4 Quizzes)
  20 Online Courses |  14 Hands-on Projects |  135+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Data Scientist Training (85 Courses, 67+ Projects)4.9
Machine Learning Training (20 Courses, 29+ Projects)4.8
MapReduce Training (2 Courses, 4+ Projects)4.7
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more