The Hadoop commands follow a similar structure and hence are easy to implement. The command structure is:
shellcommand [SHELL_OPTIONS] [COMMAND] [GENERIC_OPTIONS] [COMMAND_OPTIONS]
Also Read: Hadoop Environment Setup
The shellcommand defines the command of a project that is being executed. HDFS framework uses hdfs as shellcommand and the YARN framework uses yarn as the shellcommand and the Hadoop common uses Hadoop as shellcommand.
This contains the options that the shell script has to process before executing Java. Most of the shell commands have a common option set. For executing some commands these options can be ignored. Few Shell options are:
1. –buildpaths: used to enable Java version.
2. –config confdir: used to change the default config directory.
3. –debug: provides debugging information
4. –help: provides support documents for Shell script.
5. –loglevel loglevel: used to override the log levels.
6.–hostname: define the hostnames to run a multi-host command.
These are the common set of configuration options supported by many commands.
1. –archives: user can give a comma separated archive list to unarchive on the server.
2. -conf <configuration file>: used to specify the configuration file.
3. -files <comma separated list of files>: to specify comma separated files to be copied to map reduce cluster.
4. -jt <local> or <resourcemanager:port>: to define a resource manager.
Basic user commands
1. ls <path>: Displays the contents of the folder or directory with details like name, permissions, size etc.
2. du <path>: Displays the disk usage in bytes for the specified directory.
4. mv <src><dest>: Moves a file indicated by src to dest.
5. cp <src> <dest>: Copies a file indicated by src to dest.
6. rm <path>: Removes a file from a location.
7. mkdir <path>: creates a directory in the defined path.
8. test -[ezd] <path>: If path exists the command returns 1, else 0.
19. touchz <path>: creates a file with the current time as a timestamp in the path location.