How to use the Valgrind tool in Ubuntu

The 30 best tips for Ubuntu and Linux Mint

Hermann Apfelböck

When Ubuntu or Linux Mint meets reasonably up-to-date hardware, these systems are quick and comfortable after the standard installation. With the following 30 system tips, however, you gain additional performance, control and ease of use.

EnlargeGnome disks and the KDE partition management read out the SMART values ​​from data carriers.

The following 30 system tips relate to standards and standard programs under Debian-based distributions and in particular Ubuntu and Linux Mint. In principle, however, they should also apply to other distributions, although the practical implementation and program names may differ.

1. The state of hard disks (SMART)

Modern hard drives follow the SMART standard (Self Monitoring, Analysis and Reporting Technology) and can provide information about their state of health. The relevant graphical tools Gnome Disks ("drives") and the KDE partition manager display the SMART values ​​of internal hard drives. The KDE tool expresses itself very briefly under “Device -› Status ”, but a positive“ Overall rating: Healthy ”and the indication of the defective sectors are in principle sufficient. Gnome-Disks should show the statement after “General Assessment”: “The drive is OK”. With SSDs there is an important value behind “wear-leveling-count” in the “Normalized” column: New SSDs start at “100” and the value is reduced over time. If it approaches "0", you must replace the drive immediately.

The KDE tool also takes into account hard drives connected via USB, but not Gnome disks. Here you need the package "smartmontools" (sudo apt install smartmontools) and then the following terminal command:

If the health test is answered with "PASSED", the suitability of the drive has already been proven. Further details are available after entering

and even more detailed with the parameter "-a". An important value is "Reallocated_ Sectors_Ct", which shows the number of defective sectors and, ideally, should offer a "0".

The same applies to "Spin_Retry_Count", because the failed start-up attempts counted here indicate mechanical defects. Measured values ​​such as seek and read errors are hardly relevant.

Know-how:Configuration files on Linux

2. The condition of the notebook battery

EnlargeThe energy statistics show the reference value “energy (design)” or “energy (draft)”, which should not deviate too far from “full charge”.

The battery is the number one wear part in a notebook. Many Linux desktops can determine the status of the component in great detail with the “energy statistics” tool (gnome-power-statistics, matepower-statistics, etc.). Usually the inconspicuous applet in the system bar leads directly to this tool. In addition to irrelevant information, “Laptop battery -› Details ”shows the values“ Energy (design) ”and“ Energy when fully charged ”. The first is an ideal reference value, the second shows the real battery charge capacity. If the difference is serious, you should consider buying a new battery.

If a desktop does not have the graphical statistics tool, these values ​​can also be entered on the command line

ask. Upower is usually standard or quickly installed with the package name of the same name.

3. Switch off the swap file completely

The observation of the RAM usage in the task manager shows on newer hardware (and also on older hardware with a suitable Linux) that no RAM is swapped out on the hard drive. This is permanent on computers with eight or 16 GB. As a result, you can completely switch off the swap file there. This is done in a few simple steps: these two terminal commands end while the system is running

the paging and delete the paging file. Finally, deactivate the line in the “/ etc / fstab” file

with the comment character "#".

Note that the "Suspend to RAM" mode still works. "Hibernation" (Suspend to Disk) is currently no longer provided in the current Ubuntu variants since Ubuntu switched from the swap partition to the swap file.

4. Compressed swapping with Zram

EnlargeZram reserves a considerable amount of memory depending on the RAM and CPU.

Zram is an interesting alternative to swapping on hard disk. The kernel module reserves part of the main memory in order to create several RAM disks there, which serve as compressed swap memory in the event of bottlenecks. In the standard settings, Zram reserves half of the available RAM, divides it by the number of available CPU cores and sets up a block device for each core. With a CPU with four cores, four swap devices are created with the designation "/ dev / zram0", / "dev / zram1" etc. The memory is allocated dynamically: As long as nothing is to be swapped out, Zram does not use anything. Only when outsourcing is required, RAM is removed from the physically available RAM as required. Zram is located in Ubuntu's package sources and can be set up with minimal effort:

This means that the module is immediately active, as you can with

can easily control.

We recommend Zram as a replacement for the swap file on computers with good RAM equipment. However, Zram is also said to have advantages on computers with little memory (Raspberry & Co.), since it is much faster to move to RAM and efficient compression ensures minimal consumption. Zram can be switched off again by deinstalling zram-config.

Power tip 1: Standby mode for data drives

For drives that only contain data, you can significantly improve power consumption and service life by switching off the device to standby. For internal data hard disks, the system tool Gnome-Disks ("drives") can set the timer for the sleep state via "Drive settings -› Standby ". There is a slider, from which period of inactivity the device should be switched to standby mode.

With USB hard drives you can only reach your goal manually with the hdparm tool. First determine in the terminal with

the drives, labels and UUIDs. For example, if the desired hard disk is "/ dev / sdb", activate the hibernation state with the following command:

If that works in principle, you can set an automatic shutdown:

The value after "-S" stands for "180 x 5 seconds", ie 15 minutes. However, this configuration is only effective until the system is restarted. For a permanent change edit the "hdparm" configuration file:

Add the following line to the end of the file in the editor:

/ dev / disk / by-uuid / [UUID] {spindown_time = 180}