I would like to put up a batch script that include a step where I want to output the results of command "top" in Linux to a text file. There is one catch here though, I would like to rank the top results by memory usage. I know it is easy when you have the command windows (Shift+F and n will do the trick) but I have not found any possible solution to do so in a bash script.
Could you help? Many thanks in advance.