红帽linux终端快捷键,二、回忆redhat各种基本命令
二、回憶redhat各種基本命令
二、回憶redhat各種基本命令
這里寫目錄標題一、常見基本命令
二、 關于查看文件的命令
三、快捷鍵
四、用戶切換
五、關機、重啟快捷鍵
以此根目錄中所有文件作為演示,藍色為文件夾,白色為文件。
一、常見基本命令
1、file 文件名 //功能:查看文件信息
[[email?protected] ~]# file hello //查看文件信息
hello: very short file (no magic)
[[email?protected] ~]# file anaconda-ks.cfg
anaconda-ks.cfg: ASCII text
2、date //功能:顯示當前時間
[[email?protected] ~]# date //顯示當前時間
Sun Sep 6 16:13:37 EDT 2020
3、cal //功能:顯示當前月日歷
[[email?protected] ~]# cal
September 2020
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
[[email?protected] ~]# cal -3 //顯式當前月份與前后共三個月份日歷
August 2020 September 2020 October 2020
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 1 2 3 4 5 1 2 3
2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24
23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31
30 31
[[email?protected] ~]# cal 2020 //顯示2020全年日歷
2020
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5 6 7
5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14
12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21
19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28
26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 2 1 2 3 4 5 6
5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13
12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20
19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27
26 27 28 29 30 24 25 26 27 28 29 30 28 29 30
31
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5
5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12
12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19
19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26
26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30
30 31
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
25 26 27 28 29 30 31 29 30 27 28 29 30 31
4、bc //功能:進入計算器模式
[[email?protected] ~]# bc //功能:計算器模式
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
1+1
2
234*23
5382
2324-221
2103
434223/231
1879
434223%231
174
^C //按ctrl+c退出計算器模式
(interrupt) Exiting bc.
5、factor //功能因式分解
[[email?protected] ~]# factor //因式分解
4234345
4234345: 5 846869
12
12: 2 2 3
^C //按ctrl+c退出因式分解模式
6、uname -r //功能:查看內核版本
[[email?protected] ~]# uname -r //查看內核版本
4.18.0-80.el8.x86_64
7、history //功能:查看歷史輸入記錄,最多可查看前1000條
[[email?protected] ~]# history //查看歷史輸入記錄
1 ld
2 cd rot
3 cd root
4 cd /
5 ls
6 ls -a
7 top
8 which drop_caches
9 which dcache
10 which cache
11 cd /pro
12 firefox
13 firefox &
14 kill -9 %1
15 firefox &
16 jobs
17 kill -19 %2
18 fg %2
19 bg %2
20 systemctl list-unit-files
[[email?protected] ~]# !30 //執(zhí)行歷史輸入記錄中第三十行
systemctl is-active sshd
active
[[email?protected] ~]# !! //執(zhí)行上一條歷史記錄。因為上一條寫的是執(zhí)行第三十條記錄,所以執(zhí)行結果與上一條執(zhí)行結果相同
systemctl is-active sshd
active
[[email?protected] ~]# history -c //清除歷史記錄
[[email?protected] ~]# histroy
bash: histroy: command not found...
Failed to search for file: Cannot update read-only repo
二、 關于查看文件的命令
1、cat/more/less 文件名 //功能:都可以查看文件內容
區(qū)別在于:
cat //一次性顯示所有內容
[[email?protected] ~]# cat anaconda-ks.cfg //cat一次性顯示所有內容
#version=RHEL8
ignoredisk --only-use=sda
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
graphical
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
[[email?protected] ~]#
more //顯示部分內容且不能向上翻頁,并在最下面顯示當前內容占全部內容的百分之多少
[[email?protected] ~]# more anaconda-ks.cfg //more顯示部分內容
#version=RHEL8
ignoredisk --only-use=sda
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
graphical
firstboot --enable
-- more--(40%)
按空格鍵繼續(xù)顯示,直至結束
%packages
@^graphical-server-environment
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
--More--(85%)
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
[[email?protected] ~]#
less // 顯示部分內容,可,以向上翻頁并不顯示占全部內容的百分之多少
[[email?protected] ~]# less anaconda-ks.cfg //less顯示部分內容
#version=RHEL8
ignoredisk --only-use=sda
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
graphical
firstboot --enable
按空格鍵繼續(xù)顯示,可隨時結束閱讀結束閱讀時需要按“:q”
firstboot --enable
:q
[[email?protected] ~]# less anaconda-ks.cfg
[[email?protected] ~]#
2、head 文件名/tail 文件名 //功能:默認查看文件頭十行或尾十行
[[email?protected] ~]# head anaconda-ks.cfg //默認查看文件頭十行
#version=RHEL8
ignoredisk --only-use=sda
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
graphical
repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Use CDROM installation media
cdrom
# Keyboard layouts
[[email?protected] ~]# tail anaconda-ks.cfg //默認查看文件尾十行
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
head 文件名 -n 3 //設置查看文件開始行數,看文件尾也可以用
[[email?protected] ~]# tail anaconda-ks.cfg -n 3 //查看文件尾三行
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
3、查看文件大小屬性
[[email?protected] ~]# pwd anaconda-ks.cfg n-3 //pwd查看文件路徑
[[email?protected] ~]# wc /root/anaconda-ks.cfg //wc 文件路徑/文件名查看文件大小屬性
//*文本行數* *文本字數* *文本字符數* *文本路徑*
50 149 1664 /root/anaconda-ks.cfg
三、快捷鍵
ctrl+a/home 跳到命令行開頭
ctrl+e/end 跳到命令行結尾
ctrl+C 結束當前錯誤命令行
ctrl+L 清屏
四、用戶切換
1、root用戶切換至其他用戶
su - 其他用戶名 //無需密碼
[[email?protected] ~]# su - cami //root切換至其他用戶
[[email?protected] ~]$
2、其他用戶進入root
su - //有秘密
[[email?protected] ~]$ su -
Password:
[[email?protected] ~]#
3、root剛剛控制進入一般用戶再返回
exit //無需密碼
[[email?protected] ~]# su - cami
[[email?protected] ~]$ exit
logout
[[email?protected] ~]#
4、root用戶可以創(chuàng)建、刪除、更改用戶密碼 :
useradd user1 //創(chuàng)建user1
userdel user1//刪除user1
passwd user1//給user1密碼設置,若不用滿足系統要求的復雜性,則需重復輸入
[[email?protected] ~]# useradd user1//創(chuàng)建user1
[[email?protected] ~]# passwd user1//給user1密碼設置
Changing password for user user1.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[[email?protected] ~]# userdel user1//刪除user1
[[email?protected] ~]# su - user1//user1不存在
su: user user1 does not exist
5、普通用戶給自己設置密碼,需要滿足系統要求的密碼復雜性
[[email?protected] ~]$ passwd //普通用戶給自己設置密碼
Changing password for user user1.
Current password:
Current Password:
passwd: Authentication token manipulation error//密碼不滿足復雜性操作失敗
五、關機、重啟快捷鍵
init 0 關機
init 5 切換圖形化界面
[[email?protected] ~]$ init 5
init 6 重啟
二、回憶redhat各種基本命令相關教程
總結
以上是生活随笔為你收集整理的红帽linux终端快捷键,二、回忆redhat各种基本命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 医保每月返多少钱啊?
- 下一篇: linux中断共享程序实现,如何在非实时