一些實用的linux命令

2022-06-28 17:36:14 字數 1436 閱讀 2992

1、ls 按時間倒序檢視,最上面的是最新的

[root@master1 ~]# ls -rtl

total

244-rw-r--r-- 1 root root 4637 dec 21

12:24 haproxy-ingress.yaml

-rw-r--r-- 1 root root 189295 mar 8

14:12

calico.yaml

-rw-r--r-- 1 root root 29438 mar 8

15:32 openebs-operator.yaml

-rw-r--r-- 1 root root 4000 mar 8

17:25

components.yaml

-rw-------. 1 root root 1421 mar 11

00:17 anaconda-ks.cfg

-rw-r--r-- 1 root root 4902 mar 11

23:36 kube.info

2、建立軟鏈結  ln -s /opt/test  test    解釋  ln -s 真實目錄  軟連線目錄

[root@master1 test]# ln -s /opt/test/test

[root@master1 test]#

lstest

[root@master1 test]# ll

total

0lrwxrwxrwx

1 root root 10 mar 12

15:14 test -> /opt/test/

3、檢視軟連線對應的實際目錄  

[root@master1 test]# readlink -f test/

/opt/test

4、將兩個檔案合併 

paste a b                                  # 將兩個檔案合併用tab鍵分隔開

paste -d'

+' a b # 將兩個檔案合併指定'

+'符號隔開

5、拷貝不提示 

\cpa.txt b
[root@master1 ~]# cp

a.txt b

[root@master1 ~]# cp

a.txt b

cp: overwrite 『b』? ^c

[root@master1 ~]# \cp

a.txt b

[root@master1 ~]#

6、轉換檔案編碼

iconv -f gbk -t utf8 source.txt > new.txt  # 轉換編碼

一些實用的linux命令

一直在用linux,可linux下的命令還是用得不是很熟悉,記錄一下比較有用命令 和 是一樣的,都是用指令的執行結果來替換。linux下 echo hello world hello world 會把多個空格變成乙個空格,這其實是echo 把它們當作兩個輸入引數來處理了。因些只會有乙個空格輸出。gr...

一些實用的linux命令

1 解壓檔案 tar zxvf mysql.tar.gz tar zcvf eshop.tar.gz eshop 2 替換 sed i s i.ifensi.com g tpl 將i.ifensi.com替換為 sed i s 粉立方 展示空間 g grep rl 3 搜尋 grep grep hl...

linux新手,一些實用的命令

cd 進入 root目錄 cd 進入根目錄 make clean make錯誤,清除 rm rf 刪除所有資料夾 rm rf 刪除所有檔案 rpm qa grep pcre 檢視是否已安裝pcre包 netstat apn grep 7979 檢視7979埠的程序 kill 30240 關閉該程序 ...