Command Line Interface :
- The HDFS can be manipulated through a Java API or through a command-line interface.
- The File System (FS) shell includes various shell-like commands that directly interact with the Hadoop Distributed File System (HDFS) as well as other file systems that Hadoop supports.
- Below are the commands supported :
- appendToFile: Append the content of the text file in the HDFS.
- cat: Copies source paths to stdout.
- checksum: Returns the checksum information of a file.
- chgrp : Change group association of files. The user must be the owner of files, or else a super-user.
- chmod : Change the permissions of files. The user must be the owner of the file, or else a super-user.
- chown: Change the owner of files. The user must be a super-user.
- copyFromLocal: This command copies all the files inside the test folder in the edge node to the test folder in the HDFS.
- copyToLocal : This command copies all the files inside the test folder in the HDFS to the test folder in the edge node.
- count: Count the number of directories, files and bytes under the paths that match the specified file pattern.
- cp: Copy files from source to destination. This command allows multiple sources as well in which case the destination must be a directory.
- createSnapshot: HDFS Snapshots are read-only point-in-time copies of the file system. Snapshots can be taken on a subtree of the file system or the entire file system. Some common use cases of snapshots are data backup, protection against user errors and disaster recovery.
- deleteSnapshot: Delete a snapshot from a snapshot table directory. This operation requires the owner privilege of the snapshottable directory.
- df: Displays free space
- du: Displays sizes of files and directories contained in the given directory or the length of a file in case its just a file.
- expunge: Empty the Trash.
- find: Finds all files that match the specified expression and applies selected actions to them. If no path is specified then defaults to the current working directory. If no expression is specified then defaults to -print.
- get Copy files to the local file system.
- getfacl: Displays the Access Control Lists (ACLs) of files and directories. If a directory has a default ACL, then getfacl also displays the default ACL.
- getfattr: Displays the extended attribute names and values for a file or directory.
- getmerge : Takes a source directory and a destination file as input and concatenates files in src into the destination local file.
- help: Return usage output.
- ls: list files
- lsr: Recursive version of ls.
- mkdir: Takes path URI’s as argument and creates directories.
- moveFromLocal: Similar to put command, except that the source localsrc is deleted after it’s copied.
- moveToLocal: Displays a “Not implemented yet” message.
- mv: Moves files from source to destination. This command allows multiple sources as well in which case the destination needs to be a directory.
- put : Copy single src, or multiple srcs from local file system to the destination file system. Also reads input from stdin and writes to destination file system.
- renameSnapshot : Rename a snapshot. This operation requires the owner privilege of the snapshottable directory.
- rm : Delete files specified as args.
- rmdir : Delete a directory.
- rmr : Recursive version of delete.
- setfacl : Sets Access Control Lists (ACLs) of files and directories.
- setfattr : Sets an extended attribute name and value for a file or directory.
- setrep: Changes the replication factor of a file. If the path is a directory then the command recursively changes the replication factor of all files under the directory tree rooted at the path.
- stat : Print statistics about the file/directory at <path> in the specified format.
- tail: Displays the last kilobyte of the file to stdout.
- test : Hadoop fs -test -[defsz] URI.
- text: Takes a source file and outputs the file in text format. The allowed formats are zip and TextRecordInputStream.
- touchz: Create a file of zero length.
- truncate: Truncate all files that match the specified file pattern to the specified length.
- usage: Return the help for an individual command.
0 Comments