Basic Linux command configuration (1)

1. Command format

Main command parameter operation multi-image

Main command: the phrase of the temporal command

parameter:

1. Short format: starting with a minus sign (-), parameter letter

2. Long format: two minus (--) followed by the complete parameters of the mountain

2. Check the kernel version

[root@server ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 9.1 (Plow)
// 解释:
// 5:主版本号
// 14:主修订版本号
// 0-162:次要版本号
// 6.1:补丁版本
// el9:红帽9
// x86——64:使用平台

3. Check the shell type

[root@server ~]# cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash

 4. Check the local IP

[root@server RHCSA]# 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 mq state UP group default qlen 1000
    link/ether 00:0c:29:e5:85:5b brd ff:ff:ff:ff:ff:ff
    altname enp3s0
    inet 192.168.228.128/24 brd 192.168.228.255 scope global dynamic noprefixroute ens160
       valid_lft 1765sec preferred_lft 1765sec
    inet6 fe80::20c:29ff:fee5:855b/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

5. Directory switching--cd

Function: Change the current working directory, that is, switch directories
Format: cd -parameter path
path:
Absolute road strength: start describing and recommending from / and the directory
First, describe the path: start from the current working directory
[root@server RHCSA]# cd /
[root@server /]# cd root
[root@server ~]# cd ~
[root@server ~]# cd /etc
[root@server etc]# cd ..
[root@server /]# 

6. View the current working directory --pwd

[root@server ~]# pwd
/root
[root@server ~]# cd /etc/yum.repos.d
[root@server yum.repos.d]# pwd
/etc/yum.repos.d
[root@server yum.repos.d]# cd ~
[root@server ~]# pwd
/root
[root@server ~]# su fox
[fox@server root]$ cd ~
[fox@server ~]$ 
[fox@server ~]$ su root
密码:

7. Browse files in the directory --ls

[root@server fox]# ls
公共  模板  视频  图片  文档  下载  音乐  桌面
[root@server fox]# ls /etc
[root@server fox]# which /ls
/usr/bin/which: no ls in ()

8. Modify user password--passwd

[root@server ~]# passwd root
// 更改用户 root 的密码 。
// 新的密码:
// 无效的密码: 密码少于 8 个字符
// 重新输入新的密码:
// passwd:所有的身份验证令牌已经成功更新。

9. Reset root account password

Step 1: Restart the system

[root@server ~]# reboot

Step 2: Command the login interface and click the up and down keys on the keyboard to let the interface stop here.

Step 3: Click the e key to enter the kernel startup parameter configuration interface below

Step 4: Paste the line containing Linux, use the keyboard arrow keys to move the line, enter rd.break, and then press ctrl+x

Step 5: Mount /sysroot in a read-write manner. Enter the command

Step Six: Set Password

Step 7: Force a reset of the file system’s context policy

Step 8: Exit the system and enter exit twice

Guess you like

Origin blog.csdn.net/2301_77475090/article/details/132919379