国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Linux > 正文

更有效率的使用Linux鍵盤

2020-07-08 13:05:55
字體:
來源:轉載
供稿:網(wǎng)友

正確的使用鍵盤上的符號可以在幫助你在編寫簡單腳本時充分應用各種技巧

 

[Tab] 用于自動補齊一個命令和路徑或文件名

 

[root@localhost ~]# user 在輸入user 后連按鍵盤上的[Tab]鍵兩下,可以將以user開頭的命令列出

 

[root@localhost ~]# usera 在輸入usera后連按鍵盤上的[Tab]鍵一下,可以將以usera開頭的命令useradd命令自動補齊

 

[root@localhost ~]# useradd 在輸入useradd后連按鍵盤上的[Tab]鍵兩下,可以將當前目錄下的所有文件和目錄列出

 

~ 這個符號代表用戶自己的home目錄

 

[root@localhost ~]# cd /

 

[root@localhost ~]# pwd

 

[root@localhost ~]# cd ~

 

[root@localhost ~]# pwd

 

! 在一個命令前加上這個符號可以在命令的歷史記錄中調用上一個以這個命令開頭的命令 [root@localhost ~]# find /root/install.log

 

[root@localhost ~]# file /root/install.log

 

[root@localhost ~]# !f 在個命令將調用file /root/install這個查找文件的命令

 

[root@localhost ~]# !fi 在個命令將調用file /root/install這個查找文件的命令

 

[root@localhost ~]# !fin 在個命令將調用find /root/install這個查找文件的命令

 

$ 用于引用一個變量

 

[root@localhost ~]# myhost=www.liuziyang.cn

 

[root@localhost ~]# echo $myhost

 

& 在一個命令結尾表示將任務放在后臺運行

 

% 用于表示一個任務(任務不是進程)編號

 

[root@localhost ~]# while true; do echo hello >> /dev/tty2 ; sleep 1; done&

 

[root@localhost ~]# while true; do echo www.liuziyang.cn >> /dev/tty2 ; sleep 1; done&

 

[root@localhost ~]# [ctrl]+[alt]+[F2] 這里表示切換到第二個控制臺/dev/tty2,查看輸出結果

 

在每執(zhí)行下面的一個命令后都在[ctrl]+[alt]+[F1]和[F2]間進行切換來看一個結果的變化

 

[root@localhost ~]# jobs

 

[root@localhost ~]# fg %1

 

[root@localhost ~]# [ctrl]+z 這里按鍵盤上的[ctrl]和z這樣的組合

 

[root@localhost ~]# jobs [root@localhost ~]# kill %2

 

[root@localhost ~]# jobs

 

[root@localhost ~]# bg %1

 

[root@localhost ~]# jobs

 

[root@localhost ~]# kill %1 `` 表示一個命令或腳本 '' 表示一個字符串 "" 表示一個字符串

 

注意觀查每一個命令的輸出結果

 

[root@localhost ~]# echo `hostname`

 

[root@localhost ~]# echo 'hostname'

 

[root@localhost ~]# echo "hostname" | 管道符號,用于在一個命令語句后進行過濾

 

[root@localhost ~]# ls -l /etc | more

 

[root@localhost ~]# cat /etc/passwd | awk -F: '{print $7}' | sort | uniq

 

^ 匹配字符串首

 

$ 匹配字符串尾

 

> 定向符號

 

< 定向符號

 

>> 追加符號

 

注意每個命令的輸出結果對比

 

[root@localhost ~]# grep ^root < /etc/passwd > result1.txt

 

[root@localhost ~]# cat result1.txt

 

[root@localhost ~]# grep bash$ < /etc/passwd > result1.txt

 

[root@localhost ~]# grep bash$ < /etc/passwd > result2.txt

 

[root@localhost ~]# cat result1.txt

 

[root@localhost ~]# cat result2.txt

 

[root@localhost ~]# grep root < /etc/passwd >> result2.txt

 

[root@localhost ~]# cat result2.txt

 

先寫這些吧,多動手實踐就能理解這些命令并可以應用到實際中。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 夏津县| 那坡县| 长武县| 洪洞县| 岐山县| 台北市| 犍为县| 禄劝| 柳州市| 东阳市| 五指山市| 右玉县| 广昌县| 当涂县| 连江县| 娄烦县| 通化县| 安义县| 中牟县| 扶绥县| 翁牛特旗| 佛山市| 抚顺县| 旬阳县| 丰县| 阿瓦提县| 广安市| 荣昌县| 隆昌县| 会理县| 邛崃市| 舟山市| 嘉祥县| 龙川县| 衡阳县| 惠来县| 云龙县| 台湾省| 汽车| 安庆市| 罗源县|