虽然我知道一些基础知识,但我对 ubuntu 的各个方面还很陌生。我的计算机存储空间不足,经过检查,我发现我的 /var/log 文件夹有 118 GB 大!我考虑过直接删除日志,但我是新手,简单地删除每个日志似乎不太合适,因为有些程序可能无法处理丢失的日志文件。目录本身有 118 GB,这说明有些地方不对劲。仔细检查日志目录后,我发现:
root@fateh-Inspiron-13-5378:/var/log# ls -la
total 108917496
drwxrwxr-x 16 root syslog 4096 Aug 31 05:26 .
drwxr-xr-x 15 root root 4096 Aug 3 09:41 ..
-rw-r--r-- 1 root root 22073 Aug 28 07:34 alternatives.log
-rw-r--r-- 1 root root 29184 Jul 26 17:57 alternatives.log.1
-rw-r----- 1 root adm 1734 Aug 27 20:15 apport.log
-rw-r----- 1 root adm 1169 Aug 20 09:56 apport.log.1
-rw-r----- 1 root adm 1055 Aug 13 15:21 apport.log.2.gz
-rw-r----- 1 root adm 125 Jul 30 08:30 apport.log.3.gz
-rw-r----- 1 root adm 124 Jul 29 16:01 apport.log.4.gz
-rw-r----- 1 root adm 247 Jul 28 09:49 apport.log.5.gz
drwxr-xr-x 2 root root 4096 Aug 31 06:14 apt
-rw-r----- 1 syslog adm 713367 Aug 31 12:11 auth.log
-rw-r----- 1 syslog adm 503808 Aug 24 00:00 auth.log.1
-rw-r----- 1 syslog adm 71547 Aug 18 05:24 auth.log.2.gz
-rw-r----- 1 syslog adm 11627 Aug 1 23:36 auth.log.3.gz
-rw------- 1 root root 322337 Aug 31 05:26 boot.log
-rw------- 1 root root 216534 Aug 24 00:00 boot.log.1
-rw------- 1 root root 583044 Aug 18 05:24 boot.log.2
-rw------- 1 root root 42659 Aug 4 00:00 boot.log.3
-rw------- 1 root root 10452 Aug 2 00:00 boot.log.4
-rw------- 1 root root 18801 Jul 27 00:00 boot.log.5
-rw-r--r-- 1 root root 104003 Apr 23 00:33 bootstrap.log
-rw-rw---- 1 root utmp 1152 Aug 22 11:51 btmp
-rw-rw---- 1 root utmp 0 Apr 23 00:32 btmp.1
drwxr-xr-x 2 root root 4096 Aug 28 14:21 cups
drwxr-xr-x 2 root root 4096 Apr 8 08:59 dist-upgrade
-rw-r--r-- 1 root adm 84351 Aug 31 05:26 dmesg
-rw-r--r-- 1 root adm 87800 Aug 30 18:35 dmesg.0
-rw-r--r-- 1 root adm 21453 Aug 30 07:28 dmesg.1.gz
-rw-r--r-- 1 root adm 21348 Aug 30 06:28 dmesg.2.gz
-rw-r--r-- 1 root adm 21403 Aug 29 14:10 dmesg.3.gz
-rw-r--r-- 1 root adm 21271 Aug 29 10:48 dmesg.4.gz
-rw-r--r-- 1 root root 612124 Aug 31 06:15 dpkg.log
-rw-r--r-- 1 root root 1193854 Jul 31 06:48 dpkg.log.1
-rw-r--r-- 1 root root 2049792 Aug 12 10:40 faillog
-rw-r--r-- 1 root root 11453 Aug 22 07:11 fontconfig.log
drwx--x--x 2 root gdm 4096 Oct 7 2019 gdm3
-rw-r--r-- 1 root root 1242 Aug 31 05:26 gpu-manager.log
drwxr-xr-x 3 root root 4096 Apr 23 00:36 hp
drwxrwxr-x 2 root root 4096 Jul 25 08:12 installer
drwxr-sr-x+ 3 root systemd-journal 4096 Jul 25 08:13 journal
-rw-r----- 1 syslog adm 5050809 Aug 31 12:07 kern.log
-rw-r----- 1 syslog adm 55699410944 Aug 23 22:50 kern.log.1
-rw-r----- 1 syslog adm 1525796 Aug 18 05:24 kern.log.2.gz
-rw-r----- 1 syslog adm 188167 Aug 1 23:53 kern.log.3.gz
-rw-rw-r-- 1 root utmp 18704352 Aug 12 10:40 lastlog
drwxr-xr-x 5 root root 4096 Aug 12 10:40 libvirt
drwxr-x--- 2 www-data www-data 4096 Aug 24 00:00 lighttpd
drwxr-xr-x 2 root root 4096 Sep 5 2019 openvpn
drwxr-xr-x 2 pihole pihole 4096 Aug 12 14:15 pihole
-rw-r--r-- 1 pihole pihole 17216 Aug 31 12:00 pihole-FTL.log
-rw-r--r-- 1 pihole pihole 89319 Aug 30 06:28 pihole-FTL.log.1
-rw-r--r-- 1 pihole pihole 2326 Aug 24 00:00 pihole-FTL.log.2.gz
-rw-r--r-- 1 pihole pihole 28126 Aug 23 06:50 pihole-FTL.log.3.gz
-rw-r--r-- 1 pihole pihole 2113 Aug 31 12:00 pihole.log
-rw-r--r-- 1 pihole pihole 6294 Aug 31 05:26 pihole.log.1
-rw-r--r-- 1 pihole pihole 3967 Aug 30 06:28 pihole.log.2.gz
-rw-r--r-- 1 pihole pihole 1595 Aug 29 07:11 pihole.log.3.gz
-rw-r--r-- 1 pihole pihole 510 Aug 28 05:24 pihole.log.4.gz
-rw-r--r-- 1 pihole pihole 2201 Aug 27 05:22 pihole.log.5.gz
drwx------ 2 root root 4096 Apr 23 00:32 private
drwx------ 2 speech-dispatcher root 4096 Jan 19 2020 speech-dispatcher
-rw-r----- 1 syslog adm 50371538 Aug 31 12:11 syslog
-rw-r----- 1 syslog adm 55744626688 Aug 24 00:00 syslog.1
-rw-r----- 1 syslog adm 23788290 Aug 18 05:24 syslog.2.gz
-rw-r----- 1 syslog adm 669055 Aug 4 00:00 syslog.3.gz
-rw-r----- 1 syslog adm 163942 Aug 3 00:00 syslog.4.gz
-rw-r----- 1 syslog adm 158326 Aug 2 00:00 syslog.5.gz
-rw-r----- 1 syslog adm 116667 Aug 1 00:00 syslog.6.gz
-rw-r----- 1 syslog adm 81773 Jul 31 00:00 syslog.7.gz
-rw------- 1 root root 0 Apr 23 00:33 ubuntu-advantage.log
drwxr-x--- 2 root adm 4096 Aug 4 00:00 unattended-upgrades
-rw-r--r-- 1 root root 102 Aug 12 05:33 vbox-setup.log
-rw-r--r-- 1 root root 102 Aug 11 20:21 vbox-setup.log.1
-rw-r--r-- 1 root root 102 Aug 11 14:33 vbox-setup.log.2
-rw-r--r-- 1 root root 102 Aug 11 12:21 vbox-setup.log.3
-rw-r--r-- 1 root root 102 Aug 11 08:54 vbox-setup.log.4
-rw-rw-r-- 1 root utmp 153600 Aug 31 05:26 wtmp
重要的日志位于:
-rw-r----- 1 syslog adm 55699410944 Aug 23 22:50 kern.log.1
-rw-r----- 1 syslog adm 55744626688 Aug 24 00:00 syslog.1
以及其他一些不太大的问题。可能出了什么问题?我应该用cat /dev/null > kern.log.1
and清理文件cat /dev/null > syslog.1
吗?或者这些日志是否存在更深层次的问题?