The above results show that it has printed the memory details thrice with a one-second delay. Let’s look at a sample usage: $ sar -o memory.log -r 1 3 -human Unlike the other two commands we saw earlier, this prints more information about memory usage. In order to show the swap memory usage, we used the -A1 option in the grep command to print one line below the matching line. We need to press ctrl-c to quit out of the command. As a result, we can see that it has printed the main memory and swap memory usage. In addition to that, we used the grep command to filter the memory-related information. Here, we’ve used the same top command we tried before. ![]() Let’s see how that works: $ top -b -d1 -o +%MEM | grep -A1 'KiB Mem' On the other hand, if we just wanted to log the overall memory consumption, we can use the grep command to filter just that. With this, we can also see the process which uses more memory. This command will log details of all processes to the memory.log file. ![]() -o +%MEM: override the default sort option to use the %MEM column value the + sign is used to sort in descending order.-d1: set a delay of 1 second between each result. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |