CentOS基本操作
一、远程连接
1. Xshell连接
1.检查是否可以ping通:ping 192.168.X.X
2.检查ssh端口是否开启:telnet 192.168.X.X 22
2. Xshell配置
1.外观设置
2.日志设置:将操作日志存放到日志文件夹,并选中连接时启用
3.终端设置:
4.文件下载设置:
二、Linux介绍
1.基本介绍:
【root @ localhost ~ 】# ===>当前系统管理员状态,所有权限
【fengmou @ localhost ~ 】 $ ==>当前普通用户状态,只在自己的家目录下有权限
【fengmou @ localhost ~ 】 $
【当前用户 分隔符 主机名 当前路径】 提示符
2.基本命令:
Linux命令行bash语法:
命令 【选项】 目标(文件或者目录或者路径)
ls -l /root
[root@localhost /]# ls -l /home/
总用量 0
drwx------. 2 fengmou fengmou 83 5月 10 14:18 fengmou
1. 查看当前用户
【fengmou @ localhost ~ 】$ whoami
fengmou
2. 切换到管理员root
【fengmou @ localhost ~ 】$ su - root
密码:
~【提示上次登录时间等信息】~
3. 查看Linux系统默认解释器
[root@localhost ~]# echo $BASH
/bin/bash
[root@localhost ~]# head -1 /etc/passwd
root:x:0:0:root:/root:/bin/bash
4. 查看当前目录下内容 ls
[root@localhost /]# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
5. 查看指定目录下内容 ls /etc
[root@localhost /]# ls /etc
abrt ethertypes ld.so.conf.d popt.d sos.conf
adjtime exports libaudit.conf postfix ssh
6. 查看当前目录 pwd
[root@localhost /]# pwd
/
7. 查看历史记录
history 查看历史记录 默认显示1000条
49 pwd
50 history
51 echo "密码"
52 history
8. 删除某条历史记录
history -d 51
history -c (全部清除)
9. 关机
shutdown -h now
init 0
poweroff
halt
10. 重启命令
reboot
shutdown -r now
init 6
11. 注销当前窗口
exit
logout
ctrl + d
3.快捷键:
1. tab键 #给命令补全,直接按两下
2. ctrl + l #清屏键,同命令clear
3. ctrl + c #终止当前程序
4. ctrl + d #退出当前窗口
5. ctrl + s #锁定窗口
6. ctrl + q #恢复锁定窗口
7. ctrl + u #清楚光标前内容
8. ctrl + k #清楚光标后内容
9. ctrl + a #光标移到开头
10. ctrl + e #光标移到结尾
11. !sys 执行最近一次以sys开头的命令,sys可以是别的字符
12 !! 执行上一天命令