linux常用命令收藏

linux文件類型基本概念

 

1、d 目錄

2、l 符號鏈接(指向另一個文件)

3、s 套接字文件(socket)

4、b 塊設備文件

5、c 字符設備文件

6、p 命名管道文件

 


 

linux下創建一個文件

 

touch filename

 


linux權限講解

 

--r      --r       --r

 

user   group   other

 


find 常用命令

 

find . -name  "*.txt"

 

find 權限位查找

 

find . -perm 755 -print

 

find 類型查找

 

find /etc   -type d -print

 

find . -size +10000 -print

 

find . type f -exec ls -l {} /;

 

find  /  -type f -print | xargs filename

 


 

grep 命令

 

grep "192.168.1.1" *

 

ps -ef |grep java*

 

ps -ef |grep ora*

 


 

sed 命令

 

sed -i "s/192.168.1.11/127.0.0.1/g" filename  替換文件中的IP爲192.168.1.11 爲 127.0.0.1  /g 表示全局。

 


 

 awk 常用命令

 

awk "NR==2 {print $1}" 1.txt  輸出1.txt 的第二行內容

 

 

linux下調用一個程序,並設置參數。例:sout 爲linux下編譯後的C++/C 應用。

 

./sout  << SYSSMALL

a

b

SYSMALL

 

這個命令非常有用。可以用於數據庫刷腳本時。輸入一些命令與參數。

 

 


 

問題一:

   1、輸出1.properties 文件中的第三行信息到控制檯

 

    awk "NR==3 {print $1}" 1.properties

 

    2、將1.txt 文件內容小寫轉成大寫輸出到第二個文件中

  

    cat 1.txt | tr '[a-z]' '[A-Z]'

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章