今天我打开电脑,收到一条消息,说我的内存几乎已满。后来发现这是/var/log
目录中的 GDM3 的问题。我不确定这是什么,我是否可以以某种方式清理它或删除文件以恢复一些内存?
uname -a
Linux name 5.8.0-50-generic #56~20.04.1-Ubuntu SMP Mon Apr 12 21:46:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
根据 user535733 的请求,这里是请求的输出
ls -lah /var/log
total 379G
drwxrwxr-x 16 root syslog 4.0K Apr 16 15:59 .
drwxr-xr-x 15 root root 4.0K Sep 27 2020 ..
-rw-r--r-- 1 root root 1.8K Apr 16 16:03 alternatives.log
-rw-r--r-- 1 root root 7.3K Mar 30 06:00 alternatives.log.1
-rw-r--r-- 1 root root 1.2K Feb 27 06:04 alternatives.log.2.gz
-rw-r--r-- 1 root root 1.8K Jan 29 06:46 alternatives.log.3.gz
-rw-r--r-- 1 root root 369 Dec 31 14:30 alternatives.log.4.gz
-rw-r--r-- 1 root root 838 Nov 30 11:18 alternatives.log.5.gz
-rw-r--r-- 1 root root 526 Oct 31 11:41 alternatives.log.6.gz
-rw-r--r-- 1 root root 3.6K Sep 28 2020 alternatives.log.7.gz
drwxr-x--- 2 root adm 4.0K Apr 16 00:00 apache2
-rw-r----- 1 root adm 0 Mar 21 00:00 apport.log
-rw-r----- 1 root adm 345 Mar 20 12:44 apport.log.1
-rw-r----- 1 root adm 1.6K Feb 11 15:49 apport.log.2.gz
-rw-r----- 1 root adm 158 Feb 6 09:09 apport.log.3.gz
-rw-r----- 1 root adm 1.2K Feb 5 16:35 apport.log.4.gz
-rw-r----- 1 root adm 437 Feb 2 07:05 apport.log.5.gz
-rw-r----- 1 root adm 256 Jan 1 14:21 apport.log.6.gz
-rw-r----- 1 root adm 1.3K Dec 30 15:54 apport.log.7.gz
drwxr-xr-x 2 root root 4.0K Apr 16 16:04 apt
-rw-r----- 1 syslog adm 116K Apr 16 17:19 auth.log
-rw-r----- 1 syslog adm 133K Apr 10 23:39 auth.log.1
-rw-r----- 1 syslog adm 8.7K Apr 3 23:39 auth.log.2.gz
-rw-r----- 1 syslog adm 9.0K Mar 27 23:39 auth.log.3.gz
-rw-r----- 1 syslog adm 9.9K Mar 20 23:39 auth.log.4.gz
-rw------- 1 root root 12K Apr 16 15:59 boot.log
-rw------- 1 root root 12K Apr 6 00:00 boot.log.1
-rw------- 1 root root 12K Mar 21 00:00 boot.log.2
-rw------- 1 root root 12K Mar 10 06:03 boot.log.3
-rw------- 1 root root 23K Feb 21 00:00 boot.log.4
-rw------- 1 root root 12K Feb 12 00:00 boot.log.5
-rw------- 1 root root 12K Feb 9 00:00 boot.log.6
-rw------- 1 root root 11K Jan 30 00:00 boot.log.7
-rw-r--r-- 1 root root 102K Jul 31 2020 bootstrap.log
-rw-rw---- 1 root utmp 0 Apr 1 00:00 btmp
-rw-rw---- 1 root utmp 0 Mar 1 00:00 btmp.1
drwxr-xr-x 2 root root 4.0K Apr 16 00:00 cups
drwxr-xr-x 2 root root 4.0K Jul 20 2020 dist-upgrade
-rw-r--r-- 1 root adm 87K Apr 16 15:59 dmesg
-rw-r--r-- 1 root adm 85K Apr 5 06:26 dmesg.0
-rw-r--r-- 1 root adm 22K Mar 20 10:05 dmesg.1.gz
-rw-r--r-- 1 root adm 22K Mar 10 06:03 dmesg.2.gz
-rw-r--r-- 1 root adm 22K Feb 20 17:01 dmesg.3.gz
-rw-r--r-- 1 root adm 22K Feb 20 14:21 dmesg.4.gz
-rw-r--r-- 1 root root 91K Apr 16 16:04 dpkg.log
-rw-r--r-- 1 root root 163K Mar 31 06:39 dpkg.log.1
-rw-r--r-- 1 root root 18K Feb 27 06:04 dpkg.log.2.gz
-rw-r--r-- 1 root root 24K Jan 31 08:10 dpkg.log.3.gz
-rw-r--r-- 1 root root 6.4K Dec 31 13:08 dpkg.log.4.gz
-rw-r--r-- 1 root root 16K Nov 30 11:18 dpkg.log.5.gz
-rw-r--r-- 1 root root 11K Oct 31 11:05 dpkg.log.6.gz
-rw-r--r-- 1 root root 127K Sep 29 2020 dpkg.log.7.gz
-rw-r--r-- 1 root root 32K Jan 23 10:42 faillog
-rw-r--r-- 1 root root 12K Apr 16 16:03 fontconfig.log
drwx--x--x 2 root gdm 4.0K Oct 7 2019 gdm3
-rw-r--r-- 1 root root 1.4K Apr 16 15:59 gpu-manager.log
drwxrwxr-x 2 root root 4.0K Sep 26 2020 installer
drwxr-sr-x+ 3 root systemd-journal 4.0K Sep 26 2020 journal
-rw-r----- 1 syslog adm 4.5M Apr 16 17:20 kern.log
-rw-r----- 1 syslog adm 5.6M Apr 10 23:58 kern.log.1
-rw-r----- 1 syslog adm 468K Apr 3 23:59 kern.log.2.gz
-rw-r----- 1 syslog adm 441K Mar 27 23:59 kern.log.3.gz
-rw-r----- 1 syslog adm 492K Mar 20 23:59 kern.log.4.gz
-rw-rw-r-- 1 root utmp 286K Jan 23 10:42 lastlog
drwxr-xr-x 2 mongodb mongodb 4.0K Jan 23 10:43 mongodb
drwxr-x--- 2 mysql adm 4.0K Apr 16 00:00 mysql
drwxr-xr-x 2 root root 4.0K Sep 5 2019 openvpn
drwxrwxr-x 2 root root 4.0K Jan 8 13:59 php
-rw------- 1 root root 338 Apr 16 15:59 php7.4-fpm.log
-rw------- 1 root root 338 Apr 5 06:25 php7.4-fpm.log.1
-rw------- 1 root root 73 Jan 31 00:00 php7.4-fpm.log.10.gz
-rw------- 1 root root 281 Jan 29 06:46 php7.4-fpm.log.11.gz
-rw------- 1 root root 73 Jan 17 00:00 php7.4-fpm.log.12.gz
-rw------- 1 root root 72 Mar 28 00:00 php7.4-fpm.log.2.gz
-rw------- 1 root root 73 Mar 21 00:00 php7.4-fpm.log.3.gz
-rw------- 1 root root 192 Mar 20 10:05 php7.4-fpm.log.4.gz
-rw------- 1 root root 239 Mar 10 06:03 php7.4-fpm.log.5.gz
-rw------- 1 root root 221 Mar 1 06:17 php7.4-fpm.log.6.gz
-rw------- 1 root root 73 Feb 21 00:00 php7.4-fpm.log.7.gz
-rw------- 1 root root 380 Feb 20 17:01 php7.4-fpm.log.8.gz
-rw------- 1 root root 694 Feb 11 08:36 php7.4-fpm.log.9.gz
-rw------- 1 root root 338 Apr 16 15:59 php8.0-fpm.log
-rw------- 1 root root 338 Apr 5 06:25 php8.0-fpm.log.1
-rw------- 1 root root 73 Jan 31 00:00 php8.0-fpm.log.10.gz
-rw------- 1 root root 255 Jan 29 06:46 php8.0-fpm.log.11.gz
-rw------- 1 root root 73 Jan 17 00:00 php8.0-fpm.log.12.gz
-rw------- 1 root root 72 Mar 28 00:00 php8.0-fpm.log.2.gz
-rw------- 1 root root 73 Mar 21 00:00 php8.0-fpm.log.3.gz
-rw------- 1 root root 192 Mar 20 10:05 php8.0-fpm.log.4.gz
-rw------- 1 root root 415 Mar 12 06:54 php8.0-fpm.log.5.gz
-rw------- 1 root root 394 Mar 4 17:11 php8.0-fpm.log.6.gz
-rw------- 1 root root 73 Feb 21 00:00 php8.0-fpm.log.7.gz
-rw------- 1 root root 635 Feb 20 17:01 php8.0-fpm.log.8.gz
-rw------- 1 root root 545 Feb 11 08:34 php8.0-fpm.log.9.gz
drwx------ 2 root root 4.0K Jul 31 2020 private
drwx------ 2 speech-dispatcher root 4.0K Jan 19 2020 speech-dispatcher
-rw-r----- 1 syslog adm 379G Apr 16 17:20 syslog
-rw-r----- 1 syslog adm 5.8M Apr 16 00:00 syslog.1
-rw-r----- 1 syslog adm 360K Apr 15 00:00 syslog.2.gz
-rw-r----- 1 syslog adm 363K Apr 14 00:00 syslog.3.gz
-rw-r----- 1 syslog adm 355K Apr 13 00:00 syslog.4.gz
-rw-r----- 1 syslog adm 353K Apr 12 00:00 syslog.5.gz
-rw-r----- 1 syslog adm 361K Apr 11 00:00 syslog.6.gz
-rw-r----- 1 syslog adm 364K Apr 10 00:00 syslog.7.gz
-rw------- 1 root root 0 Jul 31 2020 ubuntu-advantage.log
-rw-r----- 1 syslog adm 4.3M Apr 16 17:20 ufw.log
-rw-r----- 1 syslog adm 5.4M Apr 10 23:58 ufw.log.1
-rw-r----- 1 syslog adm 444K Apr 3 23:59 ufw.log.2.gz
-rw-r----- 1 syslog adm 425K Mar 27 23:59 ufw.log.3.gz
-rw-r----- 1 syslog adm 447K Mar 20 23:59 ufw.log.4.gz
drwxr-x--- 2 root adm 4.0K Apr 6 00:00 unattended-upgrades
-rw-rw-r-- 1 root utmp 27K Apr 16 15:59 wtmp
答案1
执行tail -n 100 /var/log/syslog
并查找其中有错误的重复行。将它们复制到文本文件中,然后执行
> /var/log/syslog
(这将清空文件但保留文件的所有设置。删除它并重新创建它可能会创建具有错误权限或用户或组的文件)。
然后在 askubuntu 或 google 上搜索该问题,看看该问题的解决方法是什么。如果您无法找到解决方案,请编辑问题并将行添加到问题中(然后也可以删除文件列表)。