What is the HDFS command to list all the files in HDFS according to the timestamp?

0 votes
What is the command to list the directories in HDFS as per timestamp? I tried hdfs dfs ls -l which provides the list of directories with their respective permissions. I tried a workaround with hdfs -dfs -ls /tmp | sort -k6,7. Is there an inbuilt hdfs command for this?
Apr 10, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
6,179 views

5 answers to this question.

0 votes

The following arguments are available with hadoop ls command:

Usage: hadoop fs -ls [-d] [-h] [-R] [-t] [-S] [-r] [-u] <args>

Options:

-d: Directories are listed as plain files.
-h: Format file sizes in a human-readable fashion (eg 64.0m instead of 67108864).
-R: Recursively list subdirectories encountered.
-t: Sort output by modification time (most recent first).
-S: Sort output by file size.
-r: Reverse the sort order.
-u: Use access time rather than modification time for display and sorting.

You can sort the files using following command:

hdfs dfs -ls -t -R (-r) /tmp 
answered Apr 10, 2018 by Shubham
• 13,110 points
0 votes
ls -R -t (-r) should do the job
answered Dec 7, 2018 by Shravan
0 votes

hdfs dfs -ls /test | sort -k6,7 is simple and easy. I dont see a reason why you want to use something else.

answered Dec 7, 2018 by Pachit
0 votes
hdfs dfs -ls -t1
answered Dec 7, 2018 by Pratam
This does not list files by timestamp. It only lists files by time
0 votes

You can try filter using value in ls.

ls -ltr | awk '$6 == "<Month of the year>" && $7 == <day of the month> {print $9}
answered Dec 7, 2018 by Lenny

Related Questions In Big Data Hadoop

0 votes
1 answer

What is the standard way to create files in your hdfs file-system?

Well, it's so easy. Just enter the below ...READ MORE

answered Sep 22, 2018 in Big Data Hadoop by Frankie
• 9,810 points
66 views
0 votes
1 answer

What is the command to count number of lines in a file in hdfs?

hadoop fs -cat /example2/doc1 | wc -l READ MORE

answered Nov 22, 2018 in Big Data Hadoop by Omkar
• 67,120 points
193 views
0 votes
10 answers
0 votes
1 answer
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,030 points
2,037 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
10,340 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
758 views
0 votes
1 answer
0 votes
1 answer

What is the command to navigate in HDFS?

First of all there is no command ...READ MORE

answered Apr 27, 2018 in Big Data Hadoop by Shubham
• 13,110 points
338 views
0 votes
1 answer

What is the command to find the free space in HDFS?

You can use dfsadmin which runs a ...READ MORE

answered Apr 29, 2018 in Big Data Hadoop by Shubham
• 13,110 points
120 views