Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Retrieve, back up and edit files

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Lab Case: Retrieving, backing up and editing files

Steps:

File viewing and retrieval operations

Check the file/etc/filesystems to confirm the file system type of the current system, as shown in the figure:

View the/etc/services file by page to understand the protocols and port numbers used by various services by default, as shown in the figure:

Filter out the physical memory size and free memory size from the/proc/meminfo file, as shown in the figure:

Backup and restore operations

Back up the entire/etc/directory tree and make it into an archive file etc.tar.gz, as shown in the figure:

View the directory and file list contained in etc.tar.gz file, as shown in the figure:

Restore the etc. tar.gz file to the/tmp directory, and delete the/tmp/etc folder after confirmation, as shown in the figure:

Basic use of the Vi editor

by "man man| col -b > man.txt"Create man command manual page, open man.txt file with vi editor as shown in figure

Switch to no row mode and type ":set nu" to display row numbers as shown

Copy the contents of line 6 to line 2, and delete the blank lines after line 2, as shown in the figure

Command mode:yy Copy current line #yy Copy contents of line #starting at cursor, dd Delete current line #dd Delete contents of line #starting at cursor

P Paste content after the cursor (capital) P Paste content before the cursor as shown in the figure

Look for the string "-k" in the file, as shown

Replace all "string" strings in the file with "BENET" as shown

Save the file and exit vi editor as shown

Reopen the man.txt file, keeping only the first 5 lines Delete everything else #dd as shown

Copy the contents of the/root/.bashrc file to 5 lines later, as shown in the figure

Save as man2.txt file, as shown

Using vi to modify system configuration

Make a backup of/etc/inittab and etc/issue files as shown in the figure

Open the/etc/iinittab file with the "vi" editor, find the line containing the string "id: 5: initdefault", and modify it to "id: 3: initdefault", as shown in the figure

Open/etc/issue file with vi, delete all contents and add a new line "windows server 2008 enterprise RC2", as shown in the figure

Restart the system and observe the changes as shown

Restore the contents of/etc/inittab and/etc/issue files from the backup file, as shown in the figure

-f: Overwrite target file or directory with the same name without warning, but directly force copy

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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report