bash体验AI代码助手代码解读复制代码# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface auto lo iface lo inet loopback
sh体验AI代码助手代码解读复制代码deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free-firmware # deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free-firmware
# deb http://security.debian.org/debian-security bookworm-security main non-free-firmware # deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free-firmware # deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free-firmware
sh体验AI代码助手代码解读复制代码rz@debian:~$ sudo systemctl daemon-reload rz@debian:~$ sudo systemctl restart sshd rz@debian:~$ sudo systemctl status sshd ● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; preset: enabled) Active: active (running) since Wed 2024-12-25 21:51:31 EST; 12s ago Docs: man:sshd(8) man:sshd_config(5) Process: 6721 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) Main PID: 6723 (sshd) Tasks: 1 (limit: 2264) Memory: 1.4M CPU: 23ms CGroup: /system.slice/ssh.service └─6723 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
Dec 25 21:51:31 debian systemd[1]: Starting ssh.service - OpenBSD Secure Shell s> Dec 25 21:51:31 debian sshd[6723]: Server listening on 0.0.0.0 port 22. Dec 25 21:51:31 debian sshd[6723]: Server listening on :: port 22. Dec 25 21:51:31 debian systemd[1]: Started ssh.service - OpenBSD Secure Shell se>
# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
使用sudo vim /etc/hosts时,会给出警告信息:sudo: unable to resolve host hub: Name or service not known,是由于此时/etc/hosts内容未做同步变更造成的。
重新登录,使主机名生效。
使用ping命令,验证主机名与域名:
bash体验AI代码助手代码解读复制代码rz@debase:~$ ping debase PING debase (127.0.1.1) 56(84) bytes of data. 64 bytes from debase (127.0.1.1): icmp_seq=1 ttl=64 time=0.013 ms 64 bytes from debase (127.0.1.1): icmp_seq=2 ttl=64 time=0.034 ms ^C --- debase ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1024ms rtt min/avg/max/mdev = 0.013/0.023/0.034/0.010 ms rz@debase:~$ ping debase.rz PING debase.rz (192.168.152.3) 56(84) bytes of data. 64 bytes from debase.rz (192.168.152.3): icmp_seq=1 ttl=64 time=0.017 ms 64 bytes from debase.rz (192.168.152.3): icmp_seq=2 ttl=64 time=0.025 ms ^C --- debase.rz ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1029ms rtt min/avg/max/mdev = 0.017/0.021/0.025/0.004 ms
使用Ctrl+C中止ping命令。
常用工具batcat、tree、curl
安装batcat与tree:
bash体验AI代码助手代码解读复制代码rz@debase:~$ sudo apt update Hit:1 http://mirrors.tuna.tsinghua.edu.cn/debian bookworm InRelease Hit:2 http://mirrors.tuna.tsinghua.edu.cn/debian bookworm-updates InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done All packages are up to date. rz@debase:~$ sudo apt install bat tree curl