In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Directory and file management (2)
Request:
? Practice file viewing and retrieval operations
1. Check the / etc/filesystems file to confirm the file system types supported by the current system.
Cat command-display and connect (Concatenate) the contents of the file
2. View the / etc/services file in pages to learn about the protocols and port numbers used by various services by default.
More and less commands-paging to view the contents of the file
3, filter out the physical memory size and free memory size from the / proc/meminfo file
Grep command-retrieve, filter the contents of the file
Basic usage format:
Grep [options]... Find condition object file
-I: ignore case (lgnore Case) when looking for content
-v: reverse lookup (inVert), that is, output lines that do not match the search criteria.
4Dere WC command-count the number of German words (Word Count), lines and other information in the contents of the file
-c: count the number of bytes in the contents of the file
-l: count the number of lines in the contents of the file
-w: count the number of words in the contents of the file (separated by spaces or tab stops)
? Practice backup and restore operations
Tar command-Archive and release tool (can compress files or directories)
-c: create a package file in (Create) .tar format
-C: specify the target folder to release when unpacking
-f: indicates the use of archive files
-j: call the bzip2 program to compress or decompress.
-p: retain the permissions of files and directories when packing
-P: keep the absolute path of files and directories when packing
-t: list to view the files in the package
-v: output details (Verbose)
-x: unlock the package file in .tar format
-z: call the gzip program to compress or decompress
1. Back up the entire / etc directory tree and make it into an archive package file etc.tar.gz
2. View the list of directories and files contained in the etc.tar.gz file
Enter command: tar ztvf etc.tar.gz
4. Restore the etc.tar.gz file to the / tmp directory, confirm and then delete the / tmp/etc folder
5, gzip and gunzip commands-Compression and decompression tool (only files can be compressed)
Compression:
Unzip:
Or
6, bzip2 and bunzip2 commands-Compression and decompression tool (only files can be compressed)
Compression:
Unzip:
Or
? Practice the basic use of the vi editor
1. Create a text man page of the man command through the "man man | col-b > man.txt" operation, and edit it with vi
Open the man.txt file and use it as material
2, switch to the last line mode and enter the ": set nu" command to display the line number
Step: first press the "ESC" key, and then enter the colon ":" switch to the last line mode, and then enter the command "set nu" and press enter. As shown in the figure:
3, copy the inner space of line 6 to line 2, and delete a few blank lines after line 2
Steps:
1. First press the "ESC" key, switch to command mode, then move the cursor to line 6, press the lowercase "y" key twice, then move the cursor to line 2, and press the uppercase "P" key. As shown in the figure:
Copy operation: use the key command yy to copy the contents of the entire line of the current line to the clipboard, and use the form of # yy to copy the contents of # lines starting at the cursor (where the "#" sign is replaced with a specific number). The copied content needs to be pasted before it can be used.
Paste operation: in the vi editor, the previous deleted or copied content will be saved to the clipboard buffer, press p key to paste the contents of the buffer to the cursor position, press the P key will paste in front of the cursor position.
two。 Then move the cursor to line 3, and then quickly press the number "3" key and two lowercase "d" keys to delete the blank line. As shown in the figure:
Delete operation:
U use the x or Del keys to delete a single character at the cursor
U use the keystroke command dd to delete the current line of the cursor, and use the form of # dd to delete the # lines starting at the cursor (where the "#" sign is replaced with a specific number)
U use keystroke command d? Delete all characters from the beginning of the line before the current cursor
U use the key command d$ to delete all characters from the current cursor to the end of the line
4, look for the "- k" string in the file
Step: in the last line mode, press the "/" key to enter the specified string and look backwards from the current cursor (if you press "?" The key looks forward). After completing the search, you can press the n key to look backward, and the N key to look forward. As shown in the figure:
5. Replace all "string" string operations in the file with "BENET"
Steps:
The format of the last line command when using the replace feature:
: [scope of replacement] sub / old content / new content [/ g]
?%: find and replace throughout the contents of the file
As shown in the figure:
? NQuery m: look in the contents of files within the specified number of lines
For example, to replace the "initdefault" string with "DEFAULT" in lines 5-15 of the document, you can do the following:
: 5,15 sub / initdefault/ DEFAULT/g
? The "/ g" section at the end is also optional, indicating that all matches in each row within the replacement range are replaced, and omitting "/ g" will replace only the first match in each line.
6. Exit the vi editor after saving the file
Steps:
Switch to the last line mode, then type the "wq" key, then press enter to save and exit. As shown in the figure:
Undo edits and save and exit:
When editing the contents of the file, it is sometimes necessary to undo some erroneous editing operations, and you can use the key commands u and U keys. Among them, the u key command is used to cancel the last operation and reply to the operation result, and the u key can be pressed repeatedly to resume the multi-step operation that has been carried out; the U key command is used to cancel all edits made to the current line. When you need to save the current file contents and exit the vi editor, you can press the ZZ command.
Save the file and exit the vi editor:
? Save the file: after you modify and confirm the contents of the file, you need to execute the ": W" command to save it.
If you need to save as another file, you need to specify a new file name and, if necessary, a file path. For example, executing the ": W / root/newfile" operation will save the currently edited file to the / root directory, which is named newfile.
? Exit editor: when you need to exit the vi editor, you can execute the ": Q" command. If the contents of the file have been modified but not saved, only using the ": Q" command will not be able to exit successfully. In this case, you need to use ": Q!" Command to force exit (either save or exit)
? Save and exit: you can use a last-line command ": wq" or ": X" to both save the file and exit the vi editor. The effect is the same as the ZZ command in command mode.
7, reopen the man.txt file, keep only the first five lines, and delete all the rest
Steps:
Switch to command mode, move the cursor to line 6, and then quickly press the number key "1000" and two lowercase "d" keys. As shown in the figure:
8, copy the contents of the / root/.bashrc file to line 5, and then save as a man2.txt file
Steps:
1. Switch to the last line mode, then enter ": r / root/.bashrc" and press enter. As shown in the figure:
two。 Then enter the command ": W man2.txt" in the last line mode, and press enter. As shown in the figure:
Open a new file or read in the contents of another file:
U Open a new file for editing: in the current vi editor, execute the last line command in the form of ": e new file" to Edit the new file.
U read the contents of other files in the current file: execute the last line command in the form of ": r other files" to Read the contents of other files and copy them to the current cursor location.
? Use vi to modify system configuration
1. Make a backup of the / etc/inittab and / etc/issue files for recovery if necessary
Steps:
As shown in the figure:
2. Open the / etc/inittab file with a vi editor and find the
Line, and change it to "id:3:initdefault:"
Steps:
1. Find the string containing "id:5:initdefault:" and enter ": / id:5:initdefault:". As shown in the figure:
two。 Then press the lowercase letter key "a", switch to input mode, and change "id:5:initdefault:" to "id:3:initdefault:". As shown in the figure:
3. Open the / etc/issue file with a vi editor, delete all its contents, and add a new line of text
"windows server 2008 Enterprise RC2" (or other text written by the user)
Steps:
As shown in the figure:
4. Restart the system and observe the changes in the Linux login interface (text interface, personalized login prompt)
Steps:
As shown in the figure:
5. Restore the contents of / etc/inittba and / etc/issue files according to the backup files
Steps:
As shown in the figure:
Note: if you want to backup and restore, do not appear when the backup path, you should go to the directory, and then back up the contents of the directory.
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
Download libpcap source from www.tcpdump.org hereDownload libpcap for win32 fromwww.winpcap.orgCheck
© 2024 shulou.com SLNews company. All rights reserved.