The above command returned the following output: 13:42:40.0000000000 /home/sk/ostechnix/Absolute FreeBSD_ 2nd Edition.pdfĪs you see in the above output, Absolute FreeBSD_ 2nd Edition.pdf is the oldest file in /home/sk/ostechnix/ directory. Here, -n 1 indicates only one file i.e oldest file.Īs you might already know, Explainshell helps you to find what each part of a Linux command does. sort | head -n 1 - The sort command sorts the output and sends the output to head command to display the oldest file.-printf '%T %p\n' - Prints the file’s last modification date and time in separated by symbol.type -f - Searches only the regular files.find - Search for files in a directory hierarchy.Let us break down this command and see what each command line argument does. $ find /home/sk/ostechnix/ -type f -printf '%T %p\n' | sort | head -n 1
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |