[go: up one dir, main page]

0% found this document useful (0 votes)
13 views10 pages

Module2 Assignment 2 Hdfs Commands

The document provides a list of HDFS commands for managing files and directories, including listing contents, creating directories, copying, renaming, moving, and deleting files. It also covers commands for viewing file contents, copying files between local and HDFS, displaying file sizes, and changing file permissions and groups. Each command is accompanied by a brief description of its function and usage.

Uploaded by

yadavchetanya111
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)
13 views10 pages

Module2 Assignment 2 Hdfs Commands

The document provides a list of HDFS commands for managing files and directories, including listing contents, creating directories, copying, renaming, moving, and deleting files. It also covers commands for viewing file contents, copying files between local and HDFS, displaying file sizes, and changing file permissions and groups. Each command is accompanied by a brief description of its function and usage.

Uploaded by

yadavchetanya111
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/ 10

HDFS Commands

1) Listing Directory Contents

hadoop fs -ls /
Display all files and folders in the HDFS root

hadoop fs -ls /user


Display all files and folders in the HDFS /user folder

1
2) Create a directory

hadoop fs -mkdir dezyre


Creates a directory dezyre in the root of HDFS

3) Copy a file

hadoop fs -cp /employee.txt /dezyre/


Copies the file employee.txt from root folder to dezyre folder

2
4) Rename a file

hadoop fs -mv /employee.txt /newemployee.txt


Renames file employee.txt to newemployee.txt

3
5) Move file from one directory to another

hadoop fs -mv /newemployee.txt /dezyre/employee.txt


Moves the file newemployee.txt from current directory into subdirectory dezyre with name employee.txt -
newemployee.txt will no longer exist in the current directory

6) Delete a file/directory

hadoop fs -rm /dezyre/employee.txt


Deletes file employee.txt from dezyre folder

4
hadoop fs -rmr /dezyre/temp
Deletes temp directory from dezyre folder in HDFS

7) Viewing files

cat file1
Will display contents of file1 on screen

5
8) CopyFromLocal

hadoop fs -copyFromLocal sales.txt /dezyre/sales.txt


Will copy the file sales.txt from the local file system into dezyre folder in HDFS file system

9) CopyToLocal

hadoop fs -copyToLocal /dezyre/first.txt localfirst.txt


Will copy the file first.txt from HDFS into the current local file system with the name localfirst.txt

6
10) Put
Similar to copyFromLocal
hadoop fs -put employee.txt /dezyre/employee.txt
Will copy the file employee.txt from local file system into HDFS

7
11) Get
Similar to copyToLocal
hadoop fs -get /dezyre/first.txt first.txt
Will copy the file first.txt from HDFS to local file system

8
12) Display size of files

hadoop fs -du /dezyre/*


Will display the size of files

13) Change group of file/directory

hadoop fs -chgrp -R cloudera /dezyre/


Will change the group from supergroup to cloudera

9
14) Change permissions of file/directory

hadoop fs -chmod -R 777 /dezyre/


You will see initially the files have read permission for other users - we will change to write permission

10

You might also like