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

HDFS Commands PDF

hadoop
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)
43 views2 pages

HDFS Commands PDF

hadoop
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

### HDFS Command Questions and Answers

1. **What command is used to list all files and directories in a specific location in HDFS?**
- `hdfs dfs -ls /`

2. **How can you create a new directory in HDFS?**


- `hdfs dfs -mkdir /myDir`

3. **What command is used to remove an empty directory in HDFS?**


- `hdfs dfs -rmdir /myDir`

4. **What command is used to copy a file from the local filesystem to HDFS?**
- `hdfs dfs -put /local/path/to/file.txt /hdfs/path`

5. **What is the command for copying a file using `-copyFromLocal`?**


- `hdfs dfs -copyFromLocal /local/path/to/file.txt /hdfs/path`

6. **How can you read the content of a file stored in HDFS?**


- `hdfs dfs -cat /hdfs/path/to/file.txt`

7. **What command is used to delete a file from HDFS?**


- `hdfs dfs -rm /hdfs/path/to/file.txt`

8. **What command is used to move a file from the local filesystem to HDFS?**
- `hdfs dfs -moveFromLocal /local/path/to/file.txt /hdfs/path`

9. **What command is used to copy a file from one directory to another within HDFS?**
- `hdfs dfs -cp /hdfs/source/path/file.txt /hdfs/destination/path`

10. **What command is used to move a file from one directory to another in HDFS?**
- `hdfs dfs -mv /hdfs/source/path/file.txt /hdfs/destination/path`

11. **What command checks the size of individual files and directories?**
- `hdfs dfs -du /hdfs/path`

12. **What command checks the size of an entire directory?**


- `hdfs dfs -dus /hdfs/path`

13. **What command creates an empty file in HDFS?**


- `hdfs dfs -touchz /hdfs/path/newFile.txt`

14. **What command is used to copy a file from HDFS to the local filesystem?**
- `hdfs dfs -get /hdfs/path/to/file.txt /local/path`

15. **What command appends content to a file in HDFS?**


- `hdfs dfs -appendToFile /local/path/to/file.txt /hdfs/path/to/targetFile.txt`
16. **What command retrieves the last 1KB of a file in HDFS?**
- `hdfs dfs -tail /hdfs/path/to/file.txt`

17. **What command retrieves the first 1KB of a file in HDFS?**


- `hdfs dfs -head /hdfs/path/to/file.txt`

18. **What command provides statistical information about a file in HDFS?**


- `hdfs dfs -stat /hdfs/path/to/file.txt`

19. **What command lists files and directories recursively?**


- `hdfs dfs -ls -R /hdfs/path`

20. **What command recursively deletes all files and directories in HDFS?**
- `hdfs dfs -rm -r /hdfs/path`

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy