Home > database >  difference between -ls and hdfs dfs -ls
difference between -ls and hdfs dfs -ls

Time:06-10

i want to know what's the difference between :

hdfs@hdfs-namenode-0:/ $ ls and hdfs@hdfs-namenode-0:/ $ hdfs dfs -ls /

enter image description here

Meanwhile i want to read a csv file which is on tmp but i get always no such file or directory :

enter image description here

So this work is all in kubernetes(minikube).

Thanks for help !

CodePudding user response:

ls is like dir in windows. It shows you the content of a specific folder. hdfs is Hadoop Distributed File System. In your example the output is like a ls -l

For your 2nd question: Your file isn't in your hdfs. If you do this:

hdfs dfs -ls

There shouldn't be a titles.csv file. In fact, you have done this in your first picture. There are no files at all (except maybe there are invisible files).

If you do this:

hdfs dfs -ls titles.csv

The output would be: "No such file or directory" You should use just:

cat -n /tmp/titles.csv

For Further informationen:

https://man7.org/linux/man-pages/man1/ls.1.html

https://hadoop.apache.org/docs/r2.7.0/hadoop-project-dist/hadoop-common/FileSystemShell.html#ls

  • Related