If you are a Linux administrator, your top priority clearly is to know what is going on with your system. Not only has that, optimizing your system’s performance also topped the list. That said, here are six lesser known tips that will help you get more out of your system and also be more aware of what is going on inside it!
1. Run top in batch mode: What would you do if you wanted to monitor the usage of your system resources while it is unattended? You would use the cron command or you could run a shell script that runs every few seconds. Or you could use the much simpler method and run the top command in batch mode.
This way you can configure the time delay and number of iterations of the command, which will allow you to control the data collection the way you want. For example, if you want to run top in batch mode (using –b) and refresh it every 10 seconds (using –d) and for three iterations (using –n).
top -b -d 10 -n 3 >> top-file
2. Write to more than one file at once with tee: Using the tee command is a faster option in this case. It duplicates the pope content and also allows you to append data to the existing files. This makes it all the more useful for putting periodic data (like log information) into multiple files.
ps | tee file1 file2 file3
3. Unleash the accounting power with pact: In Linux, the administrator can log the completion of every process running on their machine. This is done for a variety of purposes, including security, statistical and load optimisational purposes. If you start the process accounting option, then every detail will be logged.
Start it by,
The logs can be found under,
The log though is in binary form, which means that you will have to convert it into a readable form by dumping it into such an utility.
4. Dump utmp and wtmp logs: The login records for the host that you get from utmp and wtmp can also be dumped. You can use the dump-utmp utility for dumping the content of both.
5. Monitor CPU and disk usage with iostat: If you want to find out how well your hard disk is behaving or how much the CPU usage is, then the iostat utility is a good one. It reports statistics from your I/O devices and the CPU.
6. Combine the power of iostat and vmstat with dstat: The dstat command is aimed at replacing the vmstat, ifstat and iostat commands put together. In addition, you can also use this command to export data into .csv files, which you can analyse as spreadsheets later.
This article copy paste from www.efytimes.com