| Hadoop different Commands used in HDFS
Below are the different commands which is used in Hadoop. Before this i have mention the different syntax used in below commands.
"< path>" This mean file or directory name.
"< path>..." This means 1 or more file or directory names.
"< file>" This means any filename.
"< src>" and "< dest>" These are path names in a directed operation.
"< localSrc>" and "< localDest>" These are paths as above placed on the local file system.
Now the list of commands
(1)-ls < path>:-Lists the contents of the directory specified by path and shows the names, permissions, owner, size and modification date for each entry placed in the path.
(2)-lsr < path>:-This is same as -ls but r will helps in recursively displays entries in all subdirectories of path.
(3)-du < path>:-This will shows Shows disk usage, in bytes, for all the files given in the match path. And filenames are reported with the full HDFS protocol prefix.
(4)-dus < path>:-It is same as -du but will prints summary of dis usage of all files directories in the given path.
(5)-mv < src>< dest>:-This command will moves the file or directory from defined src to dest in HDFS.
(6)-cp < src>< dest>:-This will copies the files or directory with given src to dest in HDFS.
(7)-rm < path>:-This command will Removes the file or empty directory at given path.
(8)-rmr < path>:-This will do the same as above command but will delete files rom subdirectory too.
(9)-put < localSrc> < dest>:-This will copies the files or directory from local file system which is define in localSrc to dest in HDFS.
(10)-copyFromLocal < localSrc> < dest>:-This is same as -put
(11)-moveFromLocal < localSrc> < dest>:-This will copies the files or directory from local file system which is define in localSrc to dest in HDFS in addition will deletes the local copy on success.
(12)-get [-crc] < src> < localDest>:-This will copies the file or directory in HDFS identified by src to the local file system path identified by localDest.
(13)-getmerge < src> < localDest>:-This will retrieves all files that match the path src in HDFS, and copies them to a single, merged file in the local file system identified by localDest.
(14)-cat < filen-ame>:-This will display the contents of filename on stdout.
(15)-copyToLocal < src> < localDest>:-This is same as command no 12.
(16)-moveToLocal < src> < localDest>:-This will do the same as -get but will deletes the HDFS copy on success.
(17)-mkdir < path>:-This will creates directory named path in HDFS.
(18)-setrep [-R] [-w] rep < path>:-This will sets the target replication factor for files identified by the path to rep.
(19)-touchz < path>:-This will creates a file at path containing the current time as a timestamp. Fails if a file already exists at path, unless the file is already size 0.
(20)-test -[ezd] < path>:-This will used to chec the path exists or not if returns 1 if it is exists. If this have zero length or is a directory. 0 otherwise.
(21)-stat[format]< path>:-This will prints information about path. Format is a string which accepts file size in blocks (%b), filename (%n), block size (%o), replication (%r), and modification date (%y, %Y).
(22)-tail [-f] < file2name>:-This shows the last 1KB of file on stdout.
(23)-chmod [-R] mode,mode,... < path>...:-This will Change the file permissions associated with one or more objects identified by path.Performs changes recursively with R. mode is a 3-digit octal mode
(24)-chown [-R] [owner][:[group]] < path>...:-Sets the owning user and/or group for files or directories identified by path.... Sets owner recursively if -R is specified.
(25)-chgrp [-R] group < path>...:-Sets the owning group for files or directories identified by path.... Sets group recursively if -R is specified.
(26)-help < cmd-name>:-This will returns usage information for one of the commands listed above. we must omit the leading '-' character in cmd. | | |