http://www.linuxformat.com http://www.techradar.com/pro/linux December 2019 LXF257 33
Lightweight Linux
hile a rolling stone gathers no moss, the
more you use your distro the more files it’ll
accumulate. Over time these unnecessary files
clog up your partitions and slow down disk operations.
The first thing you need to do is find out which files are
consuming the bulk of the storage space on your hard
disk. Most Gnome-based distros, including Ubuntu,
bundle the Disk Usage Analyser app that will help you
visualise the contents of your disk.
Launch the app and select the partition you want
analysed. Depending on the size of the partition and the
number of files, it might take some time to draw up a
visual map of your disk. Once you have determined the
files that are taking up a lot of storage space, you can
either back them up to an external drive or permanently
delete the ones you don’t need.
Under new management
If you diligently keep your distro updated, chances are
you’ve also accumulated a stack of older kernels that
you no longer need. These are kept in case you are
unable to boot into your distro with the updated kernel.
You can remove old kernels with a simple autoremove
command in a terminal:
sudo apt-get autoremove --purge
If you are using Fedora, the easiest way to remove
old kernels automatically is to set the kernel limit in the
/etc/dnf/dnf.conf file, such as:
installonly_limit=2 #keep only last 2 kernels
Save and close the file, and update the installation with
dnf upgrade --refresh , which will remove all older
kernels except the two most recent ones.
As you know, the installation of some packages
depends on others packages or libraries in order to
work. Ubuntu’s autoremove option will also remove the
libraries that are usually left behind after you’ve
uninstalled the parent app.
In addition, use sudo apt clean all to clean the
apt cache on Ubuntu, and sudo dnf clean all for
the same purpose under Fedora. A good practice to
avoid any leftover packages and libraries is to use the
autoremove option whenever you want to uninstall
an application, such as:
sudo apt autoremove <application-name>.
Jump start
Usually autoremove will remove any orphaned
packages, but it won’t catch them if you installed the
dependencies manually. DebOrphan is the command
line tool that allows you to see orphaned packages in
your Linux system. Head to the terminal and install the
utility with sudo apt install deborphan. Use the
deborphan command to list the orphaned packages.
To remove all the orphaned packages, use sudo apt
remove --purge `deborphan`.
SPRING-CLEAN
YOUR INSTALLATION
W
You can install
Baobab in non-
Gnome desktops
as well, though
KDE users can use
the Filelight app.
Talking of improvements to apt, use the apt-fast
wrapper to fetch packages faster via simultaneous
downloads from multiple connections. First add its PPA
with sudo add-apt-repository ppa:apt-fast/stable , then
update the repositories with sudo apt update before
installing the script with sudo apt install apt-fast.
One of the major causes of longer boot times is that
your system starts unnecessary apps and services
during startup. Ubuntu ships with the Startup
Applications tool that lets you add and remove any apps
that you’d like the distro to launch when it boots up.
However, it doesn’t show the complete list of startup
apps and services. To display them, run the following:
sudo sed -i ‘s/NoDisplay=true/NoDisplay=false/g’ /etc/
xdg/autostart/*.desktop
Now launch Startup Application and disable any
application by unticking its box. Make sure you read
through their descriptions and disable any you don’t
require (rather than using the Remove option).
UPGRADE HARDWARE
It might sound like a lazy approach to speeding up machines, but
a little amount of newer hardware can sometimes lead to a big
performance boost. Our best advice to anyone looking for a speed
bump is to install more RAM.
Use the free -m command to display the total and available
amounts of RAM. Low figures in both the column might be the issue
for your dismal performance. Before you go shopping, figure out the
type of RAM installed in your machine and its clock speed with the
sudo lshw -c memory command. Also remember that your computer
has a certain number of RAM slots or banks into which you can
insert chips.
Another piece of hardware that’ll have a significant impact on the
performance of your installation is a solid state drive (SSD). These
drives allow for much faster access and writing times than traditional
mechanical hard drives. Although SSDs still cost more per gigabyte
than regular hard drives, they will make for a much more efficient
system. Again, just as with RAM, figure out the correct size for your
machine before you go shopping.
LEVEL 1
3332Decmbr rb2c0194b095678 December 2019LXF257 33
Lightweight Linux
hilearollingstonegathersnomoss,the
moreyouuseyourdistrothemorefilesit’ll
accumulate.Overtimetheseunnecessaryfiles
clogupyourpartitionsandslowdowndiskoperations.
Thefirstthingyouneedtodoisfindoutwhichfilesare
consumingthebulkofthestoragespaceonyourhard
disk.MostGnome-baseddistros,includingUbuntu,
bundletheDiskUsageAnalyserappthatwillhelpyou
visualisethecontentsofyourdisk.
Launchtheappandselectthepartitionyouwant
analysed.Dependingonthesizeofthepartitionandthe
numberoffiles,itmighttakesometimetodrawupa
visualmapofyourdisk.Onceyouhavedeterminedthe
filesthataretakingupalotofstoragespace,youcan
eitherbackthemuptoanexternaldriveorpermanently
deletetheonesyoudon’tneed.
Undernewmanagement
Ifyoudiligentlykeepyourdistroupdated,chancesare
you’ve also accumulated a stack of older kernels that
you no longer need. These are kept in case you are
unable to boot into your distro with the updated kernel.
You can remove old kernels with a simple autoremove
command in a terminal:
sudo apt-get autoremove --purge
If you are using Fedora, the easiest way to remove
old kernels automatically is to set the kernel limit in the
/etc/dnf/dnf.conf file, such as:
installonly_limit=2 #keep only last 2 kernels
Save and close the file, and update the installation with
dnf upgrade --refresh , which will remove all older
kernels except the two most recent ones.
As you know, the installation of some packages
depends on others packages or libraries in order to
work. Ubuntu’s autoremove option will also remove the
libraries that are usually left behind after you’ve
uninstalled the parent app.
In addition, use sudo apt clean all to clean the
apt cache on Ubuntu, and sudo dnf clean all for
the same purpose under Fedora. A good practice to
avoid any leftover packages and libraries is to use the
autoremove option whenever you want to uninstall
an application, such as:
sudo apt autoremove
Jump start
Usually autoremove will remove any orphaned
packages, but it won’t catch them if you installed the
dependencies manually. DebOrphan is the command
line tool that allows you to see orphaned packages in
your Linux system. Head to the terminal and install the
utility with sudo apt install deborphan. Use the
deborphan command to list the orphaned packages.
To remove all the orphaned packages, use sudo apt
remove --purge deborphan
.
SPRING-CLEAN
YOUR INSTALLATION
W
You can install
Baobab in non-
Gnome desktops
as well, though
KDE users can use
the Filelight app.
Talking of improvements to apt, use the apt-fast
wrapper to fetch packages faster via simultaneous
downloads from multiple connections. First add its PPA
with sudo add-apt-repository ppa:apt-fast/stable , then
update the repositories with sudo apt update before
installing the script with sudo apt install apt-fast.
One of the major causes of longer boot times is that
your system starts unnecessary apps and services
during startup. Ubuntu ships with the Startup
Applications tool that lets you add and remove any apps
that you’d like the distro to launch when it boots up.
However, it doesn’t show the complete list of startup
apps and services. To display them, run the following:
sudo sed -i ‘s/NoDisplay=true/NoDisplay=false/g’ /etc/
xdg/autostart/*.desktop
Now launch Startup Application and disable any
application by unticking its box. Make sure you read
through their descriptions and disable any you don’t
require (rather than using the Remove option).
UPGRADEHARDWARE
Itmightsoundlikealazyapproachtospeedingupmachines,but
alittleamountofnewerhardwarecansometimesleadtoabig
performanceboost.Ourbestadvicetoanyonelookingforaspeed
bumpistoinstallmoreRAM.
Usethe free-mcommandtodisplaythetotalandavailable
amountsofRAM.Lowfiguresinboththecolumnmightbetheissue
foryourdismalperformance.Beforeyougoshopping,figureoutthe
typeofRAMinstalledinyourmachineanditsclockspeedwiththe
sudolshw-cmemorycommand.Alsorememberthatyourcomputer
hasacertainnumberofRAMslotsorbanksintowhichyoucan
insertchips.
Anotherpieceofhardwarethat’llhaveasignificantimpactonthe
performanceofyourinstallationisasolidstatedrive(SSD).These
drivesallowformuchfasteraccessandwritingtimesthantraditional
mechanicalharddrives.AlthoughSSDsstillcostmorepergigabyte
thanregularharddrives,theywillmakeforamuchmoreefficient
system.Again,justaswithRAM,figureoutthecorrectsizeforyour
machinebeforeyougoshopping.
LEVEL 1