1.系统初始化程序
(1)systemd
系统初始化程序,系统开始的第一个进程,pid为1
(2)systemctl命令
systemctl list-units ##列出当前系统服务的状态
systemctl list-unit-files ##列出服务的开机状态
systemctl status sshd ##查看指定服务的状态
systemctl stop sshd ##关闭指定服务
systemctl start sshd ##开启指定服务
systemctl restart sshd ##从新启动服务
systemctl enable sshd ##设定指定服务开机开启
systemctl disable sshd ##设定指定服务开机关闭
systemctl reload sshd ##使指定服务从新加载配置
systemctl list-dependencies sshd ##查看指定服务的倚赖关系
systemctl mask sshd ##冻结指定服务
systemctl unmask sshd ##启用服务
systemctl set-default multi-user.target ##开机不开启图形
systemctl set-default graphical.target ##开机启动图形
(3)服务的状态
systemctl status 服务名称 ##查看服务的状态
loaded ##系统服务已经初始化完成,加载过配置
active(running) ##正有一个或多个程序正在系统中执行,
##vsftpd 就是這種模式
active(exited) ##僅執行一次就正常結束的服務,
active(waiting) ##正在執行當中,
##不過還再等待其他的事件才能繼續處理
inactive ##服务关闭
enbaled ##服务开机启动
disabled ##服务开机不自启
static ##服务开机启动项不可被管理
failed ##系统配置错误
(4)reload和restart的区别
reload #重新加载配置;不需要结束进程 原来的进程和现在的进程是同一个
restart #重新启动;需要先关闭原进程 重新打开一个新的进程
实验:
##PID为1234
[root@localhost ~]# systemctl status sshd
##重启服务
[root@localhost ~]# systemctl restart sshd
##PID变更为8343
[root@localhost ~]# systemctl status sshd
##PID为8343
[root@localhost ~]# systemctl status sshd
##重新加载服务
[root@localhost ~]# systemctl reload sshd
##PID仍为8343
[root@localhost ~]# systemctl status sshd
[root@localhost ~]# systemctl status sshd
##设定指定服务开机关闭
[root@localhost ~]# systemctl disable sshd
[root@localhost ~]# systemctl status sshd
##设定指定服务开机开启
[root@localhost ~]# systemctl enable sshd
[root@localhost ~]# systemctl status sshd
2.系统中的文件传输
scp file username@ip:/dir ##上传
scp username@ip:/dir/file /dir ##下载
实验:
##上传
[kiosk@foundation34 Desktop]$ scp ./file1 root@172.25.254.134:/root/
root@172.25.254.134's password:
file1 100% 5857 5.7KB/s 00:00
##下载
[kiosk@foundation34 Desktop]$ scp root@172.25.254.134:/root/file* .
root@172.25.254.134's password:
file~ 100% 0 0.0KB/s 00:00
file1 100% 5857 5.7KB/s 00:00
file1~ 100% 5857 5.7KB/s 00:00