{"id":84,"date":"2025-05-06T13:23:22","date_gmt":"2025-05-06T13:23:22","guid":{"rendered":"https:\/\/docs.marisabel.nl\/?p=84"},"modified":"2025-05-06T13:27:09","modified_gmt":"2025-05-06T13:27:09","slug":"arch-linux-maintenance-documentation","status":"publish","type":"post","link":"https:\/\/docs.marisabel.nl\/?p=84","title":{"rendered":"Arch Linux Maintenance Documentation"},"content":{"rendered":"\n<p>Generic commands for me to use.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>Check disk usage and free space<\/strong><\/h3>\n\n\n\n<p>To see how much space is used and available on each partition:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>df -h<br><\/code><\/pre>\n\n\n\n<p>For more detailed usage on individual directories:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>du -sh \/*<br><\/code><\/pre>\n\n\n\n<p>To check specific folder usage, like your <strong>home<\/strong> directory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>du -sh \/home\/USER<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>Delete files in Trash<\/strong><\/h3>\n\n\n\n<p>To clear the <strong>Trash<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>rm -rf ~\/.local\/share\/Trash\/files\/*<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>Remove unused packages and clean package cache<\/strong><\/h3>\n\n\n\n<p>To remove <strong>orphaned packages<\/strong> (packages that were installed as dependencies but are no longer required):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo pacman -Rns $(pacman -Qdtq)<br><\/code><\/pre>\n\n\n\n<p>To clean the <strong>pacman<\/strong> package cache, removing old versions of packages:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo pacman -Sc<br><\/code><\/pre>\n\n\n\n<p>To <strong>remove all cached packages<\/strong> (careful with this as it removes <strong>all<\/strong> cached versions):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo pacman -Scc<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>Update the system<\/strong><\/h3>\n\n\n\n<p>To update the system and all packages:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo pacman -Syu<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>List installed packages<\/strong><\/h3>\n\n\n\n<p>To list <strong>all installed packages<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pacman -Q<br><\/code><\/pre>\n\n\n\n<p>To list only <strong>explicitly installed packages<\/strong> (packages you manually installed):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pacman -Qe<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>Check for broken packages<\/strong><\/h3>\n\n\n\n<p>Sometimes, an update might break something. To check if there are any broken or incomplete packages:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo pacman -Qk<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. <strong>Remove unnecessary logs<\/strong><\/h3>\n\n\n\n<p>Log files can accumulate over time. To remove <strong>systemd logs<\/strong> (be cautious, as this might remove useful logs):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo journalctl --vacuum-size=100M<br><\/code><\/pre>\n\n\n\n<p>To clear all logs, set a retention period (e.g., 1 week):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code>journalctl --vacuum-time=1w<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. <strong>Remove unused dependencies (after uninstalling software)<\/strong><\/h3>\n\n\n\n<p>When you remove software, there may be leftover dependencies that were installed with it but are no longer needed. Clean these up with:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> pacman -Rns $(pacman -Qdtq)<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. <strong>System Cleanup and Optimizing<\/strong><\/h3>\n\n\n\n<p>You can also use <strong>debt of space<\/strong> in hidden configuration files or directories. <strong>This command cleans some space from orphaned packages or unneeded files<\/strong> (it\u2019s safe to run occasionally but make sure to review packages first):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> pacman -Qdtq | sudo pacman -Rns -<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. <strong>Check your system for errors<\/strong><\/h3>\n\n\n\n<p>Sometimes file systems can develop errors. You can check and repair them (if needed):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> fsck -A<br><\/code><\/pre>\n\n\n\n<p>For specific file systems (e.g., if you want to check <strong>\/home<\/strong>):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> fsck \/dev\/sda3<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">11. <strong>Remove old kernels<\/strong><\/h3>\n\n\n\n<p>If you&#8217;re using <strong><code>linux-lts<\/code><\/strong> or <strong>other kernel versions<\/strong>, they can take up a lot of space. Remove unused or older kernels:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> pacman -R linux-lts linux-lts-headers<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">12. <strong>Rebuild package database<\/strong><\/h3>\n\n\n\n<p>Sometimes, the package database can become corrupt. If you face issues with package installation or updates, rebuild it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> pacman -Syyu<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">13. <strong>Clear the font cache<\/strong><\/h3>\n\n\n\n<p>To clear <strong>font cache<\/strong> and refresh it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> fc-cache -f -v<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">14. <strong>Check running processes<\/strong><\/h3>\n\n\n\n<p>To view the running processes and resource usage on your system:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>top<br><\/code><\/pre>\n\n\n\n<p>Or for a more detailed view:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>htop<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">15. <strong>Uninstall a package<\/strong><\/h3>\n\n\n\n<p>If you need to remove a package completely (including dependencies that were installed with it):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> pacman -Rns &lt;package_name><br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">16. <strong>View system logs<\/strong><\/h3>\n\n\n\n<p>To see detailed logs of system activities, including errors or other logs:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> journalctl -xe<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">17. <strong>Check for available system updates<\/strong><\/h3>\n\n\n\n<p>To check if there are updates without actually installing them:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> pacman -Qu<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">18. <strong>Checking and cleaning memory usage (swap)<\/strong><\/h3>\n\n\n\n<p>To view swap usage:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>swapon --show<br><\/code><\/pre>\n\n\n\n<p>To turn off swap (useful for troubleshooting or cleanup):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> swapoff -a<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">19. <strong>Free up system memory (clear cache)<\/strong><\/h3>\n\n\n\n<p>To clear cached memory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo<code> sysctl vm.drop_caches=3<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Generic commands for me to use. 1. Check disk usage and free space To see how much space is used and available on each partition: df -h For more detailed usage on individual directories: du -sh \/* To check specific folder usage, like your home directory: du -sh \/home\/USER 2. Delete files in Trash To clear the Trash: rm -rf ~\/.local\/share\/Trash\/files\/* 3. Remove unused packages and clean package cache To remove orphaned packages (packages that were installed as dependencies but are no longer required): sudo pacman -Rns $(pacman -Qdtq) To clean the pacman package cache, removing old versions of packages:&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/docs.marisabel.nl\/?p=84\">Continue reading<span class=\"screen-reader-text\">Arch Linux Maintenance Documentation<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[41,6,31],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-commands","category-linux","tag-archlinux","tag-commands","tag-linux","entry"],"_links":{"self":[{"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=84"}],"version-history":[{"count":3,"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=\/wp\/v2\/posts\/84\/revisions"}],"predecessor-version":[{"id":89,"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=\/wp\/v2\/posts\/84\/revisions\/89"}],"wp:attachment":[{"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.marisabel.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}