Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 08-22-2016 02:02 PM
Hi,
I am trying to run a very simple command
hdfs dfs -ls -t /
However, it prompts me saying that -t is an illegal option. However, when I look for documentation it says -t is supported. FYI, I am using Hadoop 2.7.1 version. Any idea how to list the files / directories in HDFS sorted by time?
Created on 08-22-2016 02:07 PM - edited 08-19-2019 04:05 AM
From below screenshot we see that the "-t" is not more with current version of hadoop.
You can try - hdfs dfs -ls -R / | sort -k6,7
Created 08-22-2016 02:04 PM
Please check option as below .
hdfs dfs -ls /tmp | sort -k6,7hadoop 2.7.x ls command , the below following options available :
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.
Created 08-22-2016 02:05 PM
As per this jira : https://issues.apache.org/jira/browse/HADOOP-8934
-t option is supported from hadoop 2.8.
Possibly a doc bug in apache doc here.
Created on 08-22-2016 02:07 PM - edited 08-19-2019 04:05 AM
From below screenshot we see that the "-t" is not more with current version of hadoop.
You can try - hdfs dfs -ls -R / | sort -k6,7
Created 08-22-2016 02:18 PM
-t option seems to not available in 2.7.1 version which is included with HDP 2.4.2.
This option is included in hadoop 2.7.3 which is available with HDP 2.5 Tech preview .
[hdfs@hdp1 ~]$ hadoop version Hadoop 2.7.3.2.5.0.0-1133 Subversion [email protected]:hortonworks/hadoop.git -r 93bf28063ef319be6833d3d6f117d44e0b6b8fa9 Compiled by jenkins on 2016-08-03T11:38Z Compiled with protoc 2.5.0 From source with checksum 1aed9e48ca6f7cd4ada3a36b1cd5feb This command was run using /usr/hdp/2.5.0.0-1133/hadoop/hadoop-common-2.7.3.2.5.0.0-1133.jar [hdfs@hdp1 ~]$ hdfs dfs -ls -t -help -ls: Illegal option -help Usage: hadoop fs [generic options] -ls [-C] [-d] [-h] [-q] [-R] [-t] [-S] [-r] [-u] [<path> ...] [hdfs@hdp1 ~]$ hdp-select versions 2.5.0.0-1133