0% found this document useful (0 votes)
14 views2 pages

Data Analytics Lab Experiment 2

The document outlines various Hadoop filesystem commands, including their syntax and functionality. Key commands include 'hadoop fs -touchz' for creating files, 'hadoop fs -test' for checking file existence, and 'hadoop fs -ls' for listing directory contents. Additional commands like 'hadoop fs -mkdir', 'hadoop fs -chmod', and 'hadoop fs -getmerge' are also described for managing files and directories in HDFS.

Uploaded by

pikki.pavankumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Data Analytics Lab Experiment 2

The document outlines various Hadoop filesystem commands, including their syntax and functionality. Key commands include 'hadoop fs -touchz' for creating files, 'hadoop fs -test' for checking file existence, and 'hadoop fs -ls' for listing directory contents. Additional commands like 'hadoop fs -mkdir', 'hadoop fs -chmod', and 'hadoop fs -getmerge' are also described for managing files and directories in HDFS.

Uploaded by

pikki.pavankumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

‭1.

Hadoop Touchz‬
‭hadoop fs -touchz /directory/filename‬

‭ his command allows the user to create a new file in the HDFS cluster. The “directory” in the‬
T
‭command refers to the directory name where the user wishes to create the new file, and the‬
‭“filename” signifies the name of the new file which will be created upon the completion of the‬
‭command.‬

‭2. Hadoop Test Command‬


‭hadoop fs -test -[defsz] <path>‬

‭ his particular command fulfils the purpose of testing the existence of a file in the HDFS‬
T
‭cluster. The characters from “[defsz]” in the command have to be modified as needed. Here‬
‭is a brief description of these characters:‬

‭‬
● ‭ -> Checks if it is a directory or not‬
d
‭●‬ ‭e -> Checks if it is a path or not‬
‭●‬ ‭f -> Checks if it is a file or not‬
‭●‬ ‭s -> Checks if it is an empty path or not‬
‭●‬ ‭r -> Checks the path existence and read permission‬
‭●‬ ‭w -> Checks the path existence and write permission‬
‭●‬ ‭z -> Checks the file size‬

‭3. Hadoop Text Command‬


‭hadoop fs -text <src>‬

‭ he text command is particularly useful to display the allocated zip file in text format.‬
T
‭It operates by processing source files and providing its content into a plain decoded‬
‭text format.‬

‭4. Hadoop Find Command‬


‭hadoop fs -find <path> … <expression>‬

‭ his command is generally used for the purpose to search for files in the HDFS‬
T
‭cluster. It scans the given expression in the command with all the files in the cluster,‬
‭and displays the files that match the defined expression.‬

‭5. Hadoop Getmerge Command‬


‭hadoop fs -getmerge <src> <localdest>‬

‭ etmerge command allows merging one or multiple files in a designated directory on‬
G
‭the HDFS filesystem cluster. It accumulates the files into one single file located in the‬
‭local filesystem. The “src” and “localdest” represent the meaning of‬
‭source-destination and local destination.‬
‭6. Hadoop Count Command‬
‭hadoop fs -count [options] <path>‬

‭ s obvious as its name, the Hadoop count command counts the number of files and‬
A
‭bytes in a given directory. There are various options available that modify the output‬
‭as per the requirement. These are as follows:‬

‭‬
● ‭ -> quota shows the limit on the total number of names and usage of space‬
q
‭●‬ ‭u -> displays only quota and usage‬
‭●‬ ‭h -> gives the size of a file‬
‭●‬ ‭v -> displays header‬

‭7. Hadoop AppendToFile Command‬


‭hadoop fs -appendToFile <localsrc> <dest>‬

I‭t allows the user to append the content of one or many files into a single file on the‬
‭specified destination file in the HDFS filesystem cluster. On execution of this‬
‭command, the given source files are appended into the destination source as per the‬
‭given filename in the command.‬

‭8. Hadoop ls Command‬


‭hadoop fs -ls /path‬

‭ he ls command in Hadoop shows the list of files/contents in a specified directory,‬


T
‭i.e., path. On adding “R” before /path, the output will show details of the content,‬
‭such as names, size, owner, and so on for each file specified in the given directory.‬

‭9. Hadoop mkdir Command‬


‭hadoop fs -mkdir /path/directory_name‬

‭ his command’s unique feature is the creation of a directory in the HDFS filesystem‬
T
‭cluster if the directory does not exist. Besides, if the specified directory is present,‬
‭then the output message will show an error signifying the directory’s existence.‬

‭10. Hadoop chmod Command‬


‭hadoop fs -chmod [-R] <mode> <path>‬

‭ his command is used when there is a need to change the permissions to accessing‬
T
‭a particular file. On giving the chmod command, the permission of the specified file is‬
‭changed. However, it is important to remember that the permission will be modified‬
‭when the file owner executes this command.‬

You might also like