help: Get help for HDFS shell command
./hadoop dfs -help /<<HDFS Shell command>>./hadoop dfs -help cat
mkdir: Create a directory on HDFS:
./hadoop dfs -mkdir /<<Folder name>>./hadoop dfs -mkdir /Data
ls: List your directories/Files on HDFS:
./hadoop dfs -ls /<<HDFS Path>>./hadoop dfs -ls /Data
copyFromLocal: Copy data from Local FS to HDFS
./hadoop dfs -copyFromLocal /<<Local Path>> /<<HDFS Path>>./hadoop dfs -copyFromLocal /home/username/Sample.txt /Data
put: Copy file from local filesystem to hdfs
./hadoop dfs -put localfile /dir/file1– Can also use copyFromLocal
copyToLocal: Copy data from HDFS to Local FS
./hadoop dfs -copyToLocal /<<HDFS Path>> /<<Local Path>>./hadoop dfs -copyToLocal /Data/Sample.txt /home/username
get: Copy file to the local filesystem
./hadoop dfs -get /dir/file localfile– Can also use copyToLocal
cp: Copy data from HDFS to HDFS
./hadoop dfs -cp /<<HDFS Path>> /<<HDFS Path>>./hadoop dfs -cp /Data/Sample.txt /Data1
mv: Move data from one folder to another in HDFS
./hadoop dfs -mv /<<HDFS Path>> /<<HDFS Path>>./hadoop dfs -mv /Data/Sample.txt /Data1
cat: View content of a file on HDFS
./hadoop dfs -cat /<<HDFS Path>>./hadoop dfs -cat /Data/Sample.txt
rm: Delete file from HDFS
./hadoop dfs -rm /<<HDFS Path>>./hadoop dfs -rm /Data/Sample.txt
du: Displays length for each file/dir
./hadoop dfs -du /someDir/getmerge: Merge file in HDFS
./hadoop dfs -getmerge <<HDFS Path>> <<Local Path>>./hadoop dfs -getmerge /Data/Sample.txt /home/user/test.txt
No comments:
Post a Comment