In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
9. Head function: display the first few lines of a file (default is 10 lines) format: head-n file option:-n NUM: specify to display the previous NUM line example: display the first 10 lines of the file 1.txt # head 1.txt example: display the first 3 lines of the file 1.txt # head-n 3 1.txt10, Tail function: display the last few lines of a file (default is 10 lines) format: tail option file option:-n: specify the end of the display n lines-f: dynamically monitor the content changes in a file example: display the last 10 lines of the file 1.txt # tail 1.txt example: display the last 3 lines of the file 1.txt # tail-n 3 1.txt monitor the content changes in the 1.txt [ Root@localhost tmp] # tail-f 1.txt exits the monitoring ctrl+c as soon as the content in the file 1.txt changes Will be immediately displayed on the terminal. 11. More function: display the contents of a file (split screen display) 12. Less function: display the contents of a file (split screen display) Operation enter: display the next line of space: display the next screen b: turn up the next screen Q: exit more or less add: the difference between more and less is only one more when it reaches the end of the file Will automatically exit less will not automatically exit the supplement: cat, tac: show less content of the file head, tail: display part of the file more, less: show a large file of all the contents retrieved in the file 13, Rm command full name: remove (remove) function: delete file or directory format: rm option file 1 file 2 example: delete file 1.txt 2.txt 3.txtroot@7.4 ~ # touch 1.txt 2.txt 3.txtroot@7.4 ~ # ls1.txt 2.txt 3.txt Readme y.sh option:-f-- force force delete-r delete directory rm-f 1.txt 2.txt 3.txtroot@7.4 ~ # mkdir book1 book2 book3root@7.4 ~ # rm-f book1 book2 book3rm: cannot remove 'book1': Is a directoryrm: cannot remove' book2': Is a directoryrm: cannot remove 'book3': Is a directoryroot@7.4 ~ # lsbook1 book2 book3 Readme y.shroot@7.4 ~ # rm-f-r book1 book2 book3root@7.4 ~ # lsReadme y.sh or rm-rf book1 book2 book3 wildcard introduction *: represents any character of any length (available To indicate anything) * abc indicates that the last three digits of the file name are abc The order should strictly match the example: delete the file whose name ends with .txt root@7.4 ~ # touch 2.txt 3.txt a.txt a.conf b.conf root@7.4 ~ # ls2.txt 3.txt a.conf a.txt b.conf Readme y.shroot@7.4 ~ # rm-rf * .txtroot@7.4 ~ # ls example: delete the file root@7.4 ~ # lsa.conf b whose name begins with a .conf Readme y.shroot@7.4 ~ # rm-rf a*root@7.4 ~ # lsb.conf Readme y.sh example: delete the file root@7.4 test# touch a.txt abad.txt b.txt bag.xt 3.txt dk vbroot@7.4 test# ls3.txt abad.txt a.txt bag.xt b.txt dk vbroot@7.4 test# rm-rf * a*root@7.4 test# ls3.txt b.txt that contains an in the file name Dk vb example: delete all files in the current directory rm-rf. / * or rm-rf * example: delete all files under homo starting with a The letter b ends in the file rm-rf / home/a*b example: delete all files under home that begin with an and end with the letter b, and the file name contains c file rm-rf / home/a*c*b Note: be sure to delete the file before deletion, remember: you can delete the files created by yourself, do not delete the ones that come with the system, and make sure that the system has a snapshot. Rm-rf / * Delete all files in the system after deletion, the system can not start, some files can not be deleted, are pseudo files. When the system starts up, press esc to see the details of the system startup process 14. Full name of mv: move function: move files and directories example: move 1.txt under tmp to home # mv / tmp/1.txt / home example: move 2.txt under tmp to home and rename it to new2.txt # mv / tmp/2.txt / home/new2.txt it is not recommended to use mv command in work When the power-off data is lost in the process of copying from one disk to another, the file will crash and copy the file first. after determining the data integrity, delete the source file. Example: move 3.txt under tmp to tmp and rename new3.txt#mv / tmp/3.txt / tmp.new3.txt mv/tmp/3.txt / tmp/new3.txt#mv / tmp/book2 / home/newbook2 (for directory movement) this command is to move the command book2 to home if there is no directory book2 under home, book2 will be copied to home and renamed newbook2 if there is already newbook2 under home Then move book2 under newbook2 [root@7 tmp] # mv / tmp/book2 / home/newbook2 [root@7 tmp] # ls / homenewbook2 [root@7 tmp] # mkdir book2 [root@7 tmp] # mv / tmp/book2 / home/newbook2 [root@7 tmp] # ls / homenewbook2 [root@7 tmp] # ls / home/newbook2/book2mv / tmp/1.txt / home/new1.txt (move command) this command moves 1.txt to home if there is new1.txt under home You will be prompted to overwrite if there is no new1.txt under home, 1.txt will be copied to home and renamed to new1.txt15, cp command function: copy file and directory format: cp option original file destination file option:-a: keep the attributes of the file during replication if the purpose of replication is to back up system files Usually use-a to keep the properties of the file unchanged. Direct backup will cause the file's properties to change. Direct backup will cause the file's properties to change.-f: if overwriting is required during the copy process, it is enforced (not asked)-I: ask the user before performing the overwrite operation, if you use this option Then-f is invalid-r: copy the directory (this option must be used to copy the directory) copy the directory to the destination location first Then copy everything in the directory to [root@7 home] # cp-r-v / tmp/book3 / home/'/ tmp/book3'->'/ home/book3'-v: display the replication process information (analyze how the command is executed) Note: the system defaults to the alias set by the cp command The option-I has been used in the alias: copy the 1.txt under tmp to [root@7 tmp] # cp 1.txt / home/ [root@7 tmp] # ls / home 1.txt under home Note: if you copy again, you will be prompted to overwrite If you want to automatically force overwriting, you need to use cp's original intention #\ cp / tmp/1.txt / home example: copy the 2.txt under tmp to home and rename it to new2.txt [root@7 tmp] # cp / tmp/2.txt / home/new2.txt [root@7 tmp] # ls / home 1.txt new2.txt example: copy the directory book2 to home and rename it newbook2 [root@7 tmp] # cp -r / tmp/book1 / home/ [root@7 tmp] # ls / home/ 1.txt book1 new2.txt example: copy the directory book1 to home and rename it to newbook1 cp-r / tmp/book1 / home/newbook1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.