I can get the latest modified/created file in a directory using the command
ls -Art | tail -n 1
I would like to rename the file returned by the above command. How could i do that ?
I also tried something very rudimentary like this
ls -rt | xargs | awk {'print $1'} | xargs cat >> newfile.txt
Sometimes it works but mostly it just writes an empty file