You don't need to run it with cron, it keeps running the way you have run it and will keep filling the file. By default, it updates every three seconds, which will soon be a lot of data. You can change this with -d.
BTW, top runs as a user, you don't need to use sudo.
You may be better off using a combination of swapon and watch
- Code: Select all
watch /sbin/swapon -s
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)