Monday, 21 September 2015

Hadoop/HDFS utility commands

# List of file
hadoop fs -ls
hadoop fs -ls lsr

# Disk  space of file
hadoop fs -du

# Print Summary of disk usage
hadoop fs -dus

# Move file or dir. location
hadoop fs -mv

# Copy file or dir.
hadoop fs -cp

# Removes file or dir.
hadoop fs -rm

# Removes file or dir. recursively
hadoop fs -rmr

# Copy file from local dir to hdfs dir.
hadoop fs -put
hadoop fs -copyFromLocal

# Copy file or dir. to hdfs dir.
hadoop fs -moveFromLocal

# Copy file from hdfs to local dir.
hadoop fs -get [-crc]
hadoop fs -moveToLocal
hadoop fs -copyToLocal

# Merge & copy file from hdfs to local dir.
hadoop fs -getmerge

# Display the file
hadoop fs -cat

# Display the Content of file
hadoop fs  -text

# Create dir.
hadoop fs -mkdir

# Sets target replication factor for files
hadoop fs -setrep [-R] [-w] rep

# Create file
hadoop fs -touchz

# Returns 1 if path exists otherwise 0.
hadoop fs -test -[ezd]

# Print Formate path like  fileblocksize (%b),filename (%n),block size (%o),replication (%r), and modification date (%y, %Y).
hadoop fs -stat [format]

# Show last 1kb fle stdout.
hadoop fs -tail [-f]

# Set permission on file & dir.
hadoop fs -chmod [-R] mode

# Change the owner permission
hadoop fs -chown [-R] [owner][:[group]]

# Set the owning group
hadoop fs -chgrp [-R] group

# Provide information about commaond.
hadoop fs -help

No comments: