一、 centos
CentOS(Community Enterprise Operating System,即社区企业操作系统)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同,在于CentOS完全开源。
centos基本命令
1、进入HOME目录
[root@iZbp19m6s0kz1ktg5okuauZ ~]# cd /home
2、显示工作路径
[root@iZbp19m6s0kz1ktg5okuauZ ~]# cd /home
3、查看CPU
[root@iZbp19m6s0kz1ktg5okuauZ ~]# grep “model name” /proc/cpuinfo | cut -f2 -d:
Intel® Xeon® Gold 6148 CPU @ 2.40GHz
4、查看内存
[root@iZbp19m6s0kz1ktg5okuauZ ~]# grep MemTotal /proc/meminfo
MemTotal: 2047068 kB
5、查看当前linux的版本
[root@iZbp19m6s0kz1ktg5okuauZ ~]# more /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
6、查看当前时间
[root@iZbp19m6s0kz1ktg5okuauZ ~]# date
Thu Dec 12 11:01:23 CST 2019
7、查看到这个目录的大小
[root@iZbp19m6s0kz1ktg5okuauZ ~]# du -sh
80K .
8、查看selinux情况
[root@iZbp19m6s0kz1ktg5okuauZ ~]# cat /etc/sysconfig/selinux
This file controls the state of SELinux on the system.
SELINUX= can take one of these three values:
enforcing - SELinux security policy is enforced.
permissive - SELinux prints warnings instead of enforcing.
disabled - No SELinux policy is loaded.
SELINUX=disabled
SELINUXTYPE= can take one of three two values:
targeted - Targeted processes are protected,
minimum - Modification of targeted policy. Only selected processes are protected.
mls - Multi Level Security protection.
SELINUXTYPE=targeted
9、查看ip,mac地址
(在ifcfg-eth0 文件里可以看到mac,网关等信息)
[root@iZbp19m6s0kz1ktg5okuauZ ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.0.4 netmask 255.255.240.0 broadcast 172.16.15.255
inet6 fe80::f816:3eff:fe9b:34c2 prefixlen 64 scopeid 0x20
ether fa:16:3e:9b:34:c2 txqueuelen 1000 (Ethernet)
RX packets 6628 bytes 918021 (896.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6623 bytes 1486032 (1.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 1184 bytes 692835 (676.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1184 bytes 692835 (676.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
10、查看网关
[root@iZbp19m6s0kz1ktg5okuauZ ~]# cat /etc/sysconfig/network
Created by anaconda
11、查看dns
[root@iZbp19m6s0kz1ktg5okuauZ ~]# cat /etc/resolv.conf
Generated by NetworkManagerl
search openstacklocal
nameserver 172.16.0.2
nameserver 172.16.0.3
options rotate timeout:1
12、查看默认语言
[root@iZbp19m6s0kz1ktg5okuauZ ~]# echo $LANG $LANGUAGE
en_US.UTF-8
13、查看主机名
[root@iZbp19m6s0kz1ktg5okuauZ ~]# hostname
iZbp19m6s0kz1ktg5okuauZ
二、SSH
SSH 为 Secure Shell 的缩写,由 IETF 的网络小组(Network Working Group)所制定;SSH 为建立在应用层基础上的安全协议。SSH 是较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。SSH最初是UNIX系统上的一个程序,后来又迅速扩展到其他操作平台。SSH在正确使用时可弥补网络中的漏洞。SSH客户端适用于多种平台。几乎所有UNIX平台—包括HP-UX、Linux、AIX、Solaris、Digital UNIX、Irix,以及其他平台,都可运行SSH。
ssh协议提供两种用户认证方式:
1、 基于口令的安全认证:使用用户名、密码的方式对登录用户进行认证。
2、 基于密钥的安全认证:使用公钥和私钥对的方式对登录用户进行认证。
1、ssh登录
新建连接
用户身份验证
SSH简单的用法
SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。
SSH主要用于远程登录。
若本地用户名与远程用户名一致,登录时可以省略用户名。
SSH的默认端口是22。使用p参数,可以修改这个端口。