Tuesday, 22 March 2022

Hadoop: ls: print the files by modification time stamp

‘hadoop fs -ls -t’ command print the files by modification time stamp.

[cloudera@quickstart ~]$ hadoop fs -ls -t /
Found 6 items
drwxr-xr-x   - hbase supergroup          0 2022-03-22 02:36 /hbase
drwxrwxrwt   - hdfs  supergroup          0 2022-03-22 02:20 /tmp
drwxr-xr-x   - solr  solr                0 2017-10-23 09:18 /solr
drwxr-xr-x   - hdfs  supergroup          0 2017-10-23 09:17 /user
drwxr-xr-x   - hdfs  supergroup          0 2017-10-23 09:17 /var
drwxrwxrwx   - hdfs  supergroup          0 2017-10-23 09:15 /benchmarks

As you see the output, file which is modified recently come at top.

 

Use the option -r to print the files in descending order of modified time.

[cloudera@quickstart ~]$ hadoop fs -ls -t -r /
Found 6 items
drwxrwxrwx   - hdfs  supergroup          0 2017-10-23 09:15 /benchmarks
drwxr-xr-x   - hdfs  supergroup          0 2017-10-23 09:17 /var
drwxr-xr-x   - hdfs  supergroup          0 2017-10-23 09:17 /user
drwxr-xr-x   - solr  solr                0 2017-10-23 09:18 /solr
drwxrwxrwt   - hdfs  supergroup          0 2022-03-22 02:20 /tmp
drwxr-xr-x   - hbase supergroup          0 2022-03-22 02:36 /hbase


Previous                                                 Next                                                 Home

No comments:

Post a Comment