Some Useful Shell command

Source: Internet
Author: 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 shows the contents of the file.txt in cat file.txt file1.txt ....   Show the content of File.txt file1.txt  ..... Show multiple files file.txt file1.txt ... Contents of cat File.txt | Tr-s ' \ n '    //show the content of file.txt. It will squeeze adjacent ' \ n ' characters to a single ' \ n ' to  display the contents of file.txt, and replace successive empty lines with one
Cat-t file.txt //show The content of file.txt and Highlight tab characters as ^i displays the contents of the File.txt and displays tab pay as ^i
Cat-n file.txt //show every line and a line number prefixed display the contents of the file

 2. find          list all the files and fol DERs 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 F Ilename 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 are 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/deplo Y_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 MATC H Bat*find. -regex ". *\ (\.txt\|\.sh\) $"//list all files with the 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.