Hadoop File System
Interface
Command Line Interface is the primary tool used to interact directly with HDFS from a terminal. It provides a file system shell that allows you to perform basic operations like creating directories, moving files, viewing file contents, and altering permissions.
The Command Line Interface
(CLI) in Hadoop is a text-based interface used to interact with the Hadoop
system by typing commands in a terminal or command prompt.
It allows users to manage
files in HDFS (Hadoop Distributed File System), run Hadoop applications, and
monitor Hadoop operations.
Advantages of Hadoop CLI
Easy to execute Hadoop
commands.
Supports file management in
HDFS.
Helps upload and download
large datasets.
Allows users to run Hadoop
jobs and administer the cluster.
Useful for automation through
shell scripts.
Hadoop CLI is a command-based
interface that helps users interact with Hadoop and perform HDFS file
operations, run jobs, and manage the cluster.
HDFS
Commands
1. You have to start first Hadoop
2.
Give following commands
Start-all.cmd
3.
Then Give command(check all are running
properly)
Jps
4.
Run the derby server-Use command
StartNetworkServer
-h 0.0.0.0
ls:
This command
is used to list all the files.
Use lsr for recursive approach.
It is useful when we want a hierarchy of a folder.
Syntax:
hdfs dfs -ls <path>
Example:
hdfs dfs -ls /
It will print
all the directories present in HDFS.
mkdir: To create a directory. In Hadoop dfs there is no home directory by default. So let's first create it.
Syntax:
hdfs dfs -mkdir
<folder name>
Example:
put — this
command is used to copy the
data from the local file system to HDFS.
get
— this command is used to copy the data from HDFS to the local file system.
This command is the reverse of the ‘put’ command.
1. CopyFromLocal
-same as put command
Ex: hdfs dfs -copyFromLocalsourcepath destinationpath
1. copyToLocal- same as get command
Ex: hdfs dfs -copyToLocalsourcepath destinationpath
Cat- to view contents of a file
Ex: hdfs dfs -cat /Shree/sample.txt
cp- to copy files from one location to another
Ex: hdfs dfs -cp sourcepath destinationpath









0 comments:
Post a Comment