Hadoop-HDFS-commands
Hadoop-HDFS-commands
hdfs dfs -put -f /home/ubuntu/sample Copies the file from local file system to HDFS, and in case the local already exists in
/hadoop the given destination path, using -f option with put command will overwrite it FILESYSTEM
hdfs dfs -put -l /home/ubuntu/sample Copies the file from local file system to HDFS. Allow DataNode to lazily persist the hdfs dfs -df /hadoop Shows the capacity, free and used space of the filesystem
/hadoop file to disk. Forces replication factor of 1 hdfs dfs -df -h /hadoop Shows the capacity, free and used space of the filesystem. -h parameter
hdfs dfs -put -p /home/ubuntu/sample Copies the file from local file system to HDFS. Passing -p preserves access and Formats the sizes of files in a human-readable fashion
hdfs dfs -du /hadoop/file Show the amount of space, in bytes, used by the files that match the specified
/hadoop modification times, ownership and the mode
file pattern
hdfs dfs -get /newfile /home/ubuntu/ Copies the file from HDFS to local file system hdfs dfs -du -s /hadoop/file Rather than showing the size of each individual file that matches the pattern,
hdfs dfs -get -p /newfile /home/ubuntu/ Copies the file from HDFS to local file system. Passing -p preserves access and shows the total (summary) size
modification times, ownership and the mode hdfs dfs -du -h /hadoop/file Show the amount of space, in bytes, used by the files that match the
hdfs dfs -get /hadoop/*.txt Copies all the files matching the pattern from local file system to HDFS specified file pattern. Formats the sizes of files in a human-readable fashion
/home/ubuntu/
hdfs dfs -copyFromLocal Works similarly to the put command, except that the source is restricted to a local
ADMINISTRATION
/home/ubuntu/sample /hadoop file reference hdfs balancer -threshold 30 Runs a cluster balancing utility. Percentage of disk capacity. This overwrites the
hdfs dfs -copyToLocal /newfile Works similarly to the put command, except that the destination is restricted to a default threshold
/home/ubuntu/ local file reference hadoop version To check the version of Hadoop
hdfs dfs -moveFromLocal Works similarly to the put command, except that the source is deleted after it's hdfs fsck / It checks the health of the Hadoop file system
/home/ubuntu/sample /hadoop copied hdfs dfsadmin -safemode leave The command to turn off the safemode of NameNode
hdfs dfsadmin -refreshNodes Re-read the hosts and exclude files to update the set of Datanodes that are
allowed to connect to the Namenode and those that should be
FILE MANAGEMENT decommissioned or recommissioned
hdfs dfs -cp /hadoop/file1 /hadoop1 Copies file from source to destination on HDFS. In this case, copying file1 from hdfs namenode -format Formats the NameNode
hadoop directory to hadoop1 directory
hdfs dfs -cp -p /hadoop/file1 /hadoop1 Copies file from source to destination on HDFS. Passing -p preserves access and
modification times, ownership and the mode
For more resources visit-
https://www.datacademy.ai/