Question: It's hard to explain in the title.

I have a bash script that runs daily to backup one folder into a zip file. The zip files are named **world**`YYYYMMDD`**.zip** with `YYYYMMDD` being the date of backup. What I want to do is delete all but the 5 most recent backups. Sorting the files alphabetically will list the oldest ones first, so I basically need to delete all but the last 5 files when sorted in alphabetical order.

Answer: 
I can't test it right now because I don't have a Linux machine, but I think it should be:

```
rm `ls -A | head -5`

```
`ls world*.zip | sort -r | tail n+5 | xargs rm`

`sort -r` will sort in reversed order, so the newest will be at the top

`tail n+5` will output lines, starting with the 5th

`xargs rm` will remove the files. Xargs is used to pass stdin as parameters to rm.