Some useful shell command

來源:互聯網
上載者:User

標籤:

1. cat              cat is used to read, display, or concatenate the contents of a file

cat file.txt             //show the content of file.txt  顯示file.txt中的內容cat file.txt file1.txt....   //show the content of file.txt file1.txt .....  顯示多個檔案file.txt file1.txt...的內容cat file.txt | tr -s ‘\n‘    //show the content of file.txt. It will squeeze adjacent ‘\n‘ characters into a single ‘\n‘  顯示file.txt的內容,並且將連續的空行換成一個
cat -T file.txt   //show the content of file.txt and highlight tab characters as ^I   顯示file.txt中的內容,並且將TAB自付顯示為^I 
cat -n file.txt //show each line with a line number prefixed 顯示檔案中的內容,每一行帶有行號

 2. find          list all the files and folders from the current directory to the descending child directories

find base_path //list all files and subfiles in base_path find /root/deploy_ws/ -name "testlist.*" //list all files with filename starting with testlist in /root/deploy_wsfind /root/deploy_ws/ -iname "testlist.*" //list all files with filename starting with testlist in /root/deploy_ws, the more important is to ignore casefind /root/deploy_ws \( -name "testlist.*" -or -name "*.plugin" \) -print //list all files with filename starting with testlist or ending with pluginfind /root/deploy_ws \( -name "testlist.*" -and -name "*.plugin" \) //list all files with filename starting with testlist and ending with pluginfind /root/deploy_ws -path "*BAT*" -print //list all files in /root/deploy_ws and the path for the files should match BAT*find . -regex ".*\(\.txt\|\.sh\)$" //list all files with filename ending with txt or sh in current dir.find . ! -name "*.txt" -print    //list files the name does not end with .txt
find . -type d -print //List only directories including descendants
find . -type f -print //List only regular files
find . -type l -print //List only symbolic links
find /usr/lib/firefox/plugins -type l -print //list symbolic links in /usr/lib/firefox/plugins

 

Some useful shell command

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.