The simplest solution without any 3rd party tools is to enable globstar in ksh and let ls sorts by itself
set -o globstar
ls -dlrt /home/sk/ostechnix/** | head -5
-dlrt is POSIX-compliant so this works in all POSIX environments, not only AIX, as long as your shell supports globstar
** in this snippet will expand to all files and folders in the specified path. -d will prevent folder contents from being expanded; and -rt will sort all the entries in the argument, oldest first. But this includes directories in the list so if you want to get oldest files only use this
ls -dlrt /home/sk/ostechnix/** | egrep -v '^d' | head -5
Also it won't work for hidden files. It's much easier in zsh where you can control the globbing at call site, but in ksh you'll need to do expand them explicitly
dirpath=/home/sk/ostechnix
# Get all files and folders
ls -dlrt "$dirpath"/** "$dirpath"/**/.* | egrep -v '/\.?\.$' | head -5
# Get only files
ls -dlrt "$dirpath"/** "$dirpath"/**/.* | egrep -v '^d' | head -5
The former command has a tiny downside: the . and .. entry of $dirpath will be shown if you run without a path before ** like ls -dlrt ** **/.* | egrep -v '/\.?\.$'. It can be filtered out with grep
ls -dlrt ** **/.* | egrep -v '/\.?\.$| \.?\.$'
# Or
ls -dlrt ** **/.* | egrep -v -e '/\.?\.$' -e ' \.?\.$'
# Or
ls -dlrt ** **/.* | egrep -v -e '/\.$' -e '/\.\.$' -e ' \.\.$' -e ' \.$'
But as always, parsing ls -l output is not reliable so there'll be some files with special names which will be matched unexpectedly. For example your find command and the above alternatives won't work correctly for newlines in filenames
You can remove -l if you don't want the long format but to filter out folders and get files only you'll need to use a different way
ls -dprt /home/sk/ostechnix/** | egrep -v '/$' | head -5
Or ls -dprt ** **/.* | egrep -v '/$' | head -5 to get hidden files
AIX also includes csh which seems to also support globstar. If you have bash you can enable the same option with shopt -s globstar and in zsh you can use GLOB_STAR_SHORT with setopt globstarshort or set per-glob globbing options. Similarly in tcsh use set globstar
For more details about globstar in each shell please read The result of ls *, ls ** and ls ***