操作
[root@localhost ~]# systemctl stop sshd #关闭sshd服务
[root@localhost ~]# systemctl start sshd #开启sshd服务
[root@localhost ~]# netstat -nltp | grep ssh #查看端口
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3395/sshd
tcp6 0 0 :::22 :::* LISTEN 3395/sshd
stop sshd服务 最终原理是因为关闭了22端口!!
- 你企业中用的什么操作系统?
Centos RedHat Ubuntu
- 怎么去查看操作系统版本?怎么查看内核?
## 根据查看到的操作系统版本使用对应的版本命令
[root@localhost ~]# cat /etc/redhat-release # 查看操作系统版本
CentOS Linux release 7.8.2003 (Core)
## 一台机器允许存在多个内核
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux # 查看内核版本
- 你接触过什么操作系统?
Windows Centos
- 安装过什么操作系统?怎么安装?
大批量的设备:网络PXE安装
小批量的设置:U盘安装
- 如果机房现场没人,有10台服务器需要重新安装系统,你怎么做?
通过管理卡控制机器,安装操作系统
- 你用过或者见过什么品牌及型号的服务器 几U的?
DELL HP IBM LC GD H3C 浪潮 联想
1U [ 4块硬盘 ] 2U 4U
命令
cd # 切换路径
ctrl + l # 清屏
ctrl + c # 终止
history # 历史记录
!623 # 使用历史记录中623号命令
touch {
1..5}.txt # 创建 1.txt ~ 5.txt
echo 'hello' > 1.txt # 清空重定向
echo 'hello' >> 1.txt # 追加重定向
Vim
vim 1.txt
yy # 复制当前行
2yy # 复制两行
p # 粘贴
dd # 删除当前行
3dd # 删除三行
G # 移动到尾行
:set nu # 显示行号
:set nonu # 取消显示行号
:w # 保存
:q # 退出
:wq # 保存退出
:wq! # 强制保存退出
实战
touch * # 创建*
touch {
1..3}.txt # 创建 1.txt ~ 3.txt
touch file{
1..3} # 创建 file1 ~ file3
rm -rf ./file* # 删除 file1 ~ file3
rm -rf ./*.txt # 删除 1.txt ~ 3.txt
rm -rf * # 删除 所有文件
rm -rf \* # 删除 文件 * \ 转义符