其他分享
首页 > 其他分享> > RHCSA笔记-01

RHCSA笔记-01

作者:互联网

RHCSA笔记-01

通过终端窗口输入指令(推荐通过远程终端进行操作)

执行命令的三要素: 我是谁;我在哪;我要做什么。

基本命令

[root@localhost ~]# 命令提示符

用户名@主机名 ~用户家目录 #管理员的标识符 $普通用户的标识符

ip a 查看ip地址 ifconfig

[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 ---- 没有ip地址
link/ether 00:0c:29:fa:92:8a brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:f5:4e:b8 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:f5:4e:b8 brd ff:ff:ff:ff:ff:ff
[root@localhost ~]# dhclient -– 发起自动获取地址(并且主机默认网络断开,会连接网络),如果没有输出信息执行成功
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 ---- 虚拟机真实网卡信息
link/ether 00:0c:29:d9:7e:e1 brd ff:ff:ff:ff:ff:ff
inet 192.168.220.130/24 brd 192.168.220.255 scope global dynamic ens160
valid_lft 1692sec preferred_lft 1692sec
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:cc:7c:f7 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:cc:7c:f7 brd ff:ff:ff:ff:ff:ff


第二种情况

[root@localhost ~]# dhclient
dhclient(3220) is already running - exiting. — 已经在运行
[root@localhost ~]# kill 3220 结束已存在的dhclient进程 或者killall dhclient
[root@localhost ~]# dhclient — 发起自动获取地址,如果没有输出信息执行成功
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 ---- 虚拟机真实网卡信息
link/ether 00:0c:29:d9:7e:e1 brd ff:ff:ff:ff:ff:ff
inet 192.168.220.130/24 brd 192.168.220.255 scope global dynamic ens160
valid_lft 1692sec preferred_lft 1692sec
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:cc:7c:f7 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:cc:7c:f7 brd ff:ff:ff:ff:ff:ff


第三种

[root@localhost ~]# ifconfig ens160
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.220.128 netmask 255.255.255.0 broadcast 192.168.220.255
ether 00:0c:29:fa:92:8a txqueuelen 1000 (Ethernet)
RX packets 766 bytes 102668 (100.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 780 bytes 76779 (74.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


远程连接xshell远程连接软件

[C:\~]$ ssh   192.168.220.128    写自己虚拟的ip地址

linux学习环境

通过vmware虚拟机软件+ 创建虚拟机(主机网络模式nat、仅主机、桥接,ide、sata、scsi 2G)+链接iso光盘镜像文件(RHEL-8.1)

查看当前主机发行版信息

[root@localhost ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.1 (Ootpa)

查看内核版本

[root@localhost ~]# uname -r
4.18.0-147.el8.x86_64

linux关机命令:

 shutdown -h now (正常关机) 或者 poweroff (断电关机)

linux重启命令 :

  reboot == shutdown -r now

命令格式:(判断命令执行成功(执行命令没有任何输出信息;执行命令提示对应命令显示的结果))

 ifconfig
 ip a / kill 7345 | ifconfig ens160
#命令 -选项
 ls -l 等于 ls --long
 --表示长选项

shell 命令解释器

查看系统默认所支持的shell

[root@localhost ~]# cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
[root@localhost ~]# chsh  -l
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash

查看系统默认使用的shell程序----bash shell

[root@localhost ~]#  echo $SHELL
/bin/bash

su 用户切换命令

#su redhat

#su -l redhat #su - redhat

#su 默认切换的root用户

切换用户 加- 和不加-的区别

都可以成功切换用户,不加-切换用户不更该当前所在目录路径

加-切换用户会更改当前所在目录路径(当前用户的家目录)

[redhat@localhost ~]$ su -l redhat | su - redhat

pwd 打印当前工作目录

passwd 密码修改命令,密码设置命令

passwd -d 用户名 删除指定用户的密码

管理员:可以修改系统上任意用户的密码,不要验证之前的密码,密码等级要求可以忽略

普通用户:默认只能更改自己的密码,需要验证之前的密码,必须符合密码等级要求

标签:00,01,RHCSA,forever,笔记,lft,ff,brd,localhost
来源: https://blog.csdn.net/z99533/article/details/121442772