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

What are the operations related to Linux Vim and library archiving

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is to share with you about Linux Vim and library archiving related operations, the editor feels very practical, so share with you to learn, I hope you can learn something after reading this article, say no more, follow the editor to have a look.

Cat: full screen display of file contents command-t: display the special characters in the file ctrl+d end, can display multiple files more: split screen display, only one screen message at a time, press Q to exit, press the space to display the next page can only go down, not up

Less: scroll to view and press the up and down keys to view

Head: displays the first 10 lines for the file header view, and-n specifies the number of lines

Tail: tail view-f tail latest information press ctrl+c to exit-n specify the number of lines

Grep: filtering the contents of the file shows-v reverse filtering out lines without specified keywords-I will filter by ignoring case

Touch: the command to add an empty file, if the file update time already exists

Copy all cp:-a-I prompt for operation

Rm: file deletion command is missing to delete the specified file

-I indicates the confirmed content to be deleted

-r Recursively delete the specified file or directory

-f forces the deletion of a specified file or directory, regardless of whether it exists or not

Mv: mobile renaming and lookup of files

Find: search for files, find matching files within the specified path range

Which: find the directory where the system commands are located through the system path

Locate: find through file index

Editing of text files

Editor with three state modes of vi/vim under the command line

Command mode editable mode last line mode

The basic operation of vim: open, edit, save and exit.

Vi replication yy replication multiple lines several yy

Paste p

Delete dd

Add a line o

Search and replace of vim

In command line mode / find

Replace: s / content to be replaced / content after replacement / gc

Advanced operation of vim

Line number setting jump: set nu displays line number: set nonu does not display line number

Jump line number: colon plus line number

~ representative home directory

Concurrent operation of multiple files

Edit settings for ~ / .vimrc: settings for configuration files themselves

Undo operation windows:ctrl+z vim contains u U

Args: check how many files are currently open

Next: view the next file

Prev: view the previous file

First: the first file

Last: there is the most one file paste paste yy copy

File compression and archiving

File archiving, compression, library file archiving

File archiving command: tar packaging default only package archiving, no file compression common parameters

"- c" create an archive package

"- x" release archive package

"- t" View archive package "- v"

Displays the archive package operation process information "- f" to specify the archive file name

Example: tar cvf py.tar * .c * .txt archives all .c and .txt files in this directory into py.tar, f must be followed by an archive file.

Tar tvf py.tar to see which archive files are in the archive file

Tar xvf py.tar-C zq/ releases the contents of the py.tar archive file to the zq directory

Compression of files

File package compression command: tar common option parameter "- z" file package is compressed in * .tgz (traditional compression method) format "- j" file package is compressed in * .bz2 format ()

Tar czvf py1.tgz * .txt compresses all .txt files in this directory into py1.tgz files

Tar tzvf py1.tgz view py1.tgz files in this compressed file

Tar xzvf py1.tgz-C zq releases the contents of this compressed file to the zq directory

Bz2 format

Just change the above zvf to j

Zip: also compress the command file package to * .zip unzip

Zip xx.zip * .txt compresses all txt files in this directory into xx.zip

Unzip.. / xx.zip

7z file compression command 7zip software provides compression with the highest compression ratio to date, installs the package software, called p7zipmurfull, and provides decompression support for a variety of compression formats, including * .rar,*.iso

"- a" add files to the package

"- e" releases the files in the package to the current directory

"- l" lists the list of child files in the compressed package "- d" deletes a subfile "- t" in the compressed file to test the integrity of the compressed file

7za: a separate executable file responsible for the bidirectional operation of 7za compression and decompression

7z a ys.7z * .txt compresses all txt files in this directory into ys.7z files

7z e ys.7z extracted to the current folder can only be extracted to the current folder

7z d ys.7z xx deletes the file xx in the ys.7z package

Library archive file

Full-screen display of file contents command ar

The object code file of the archiving program *. O to static library file * .a

The common option parameter "- r" adds the object code file to the static library file

"- x" extracts object code files from static library files

"- t" View the list of object codes in the static library file

"- v" shows more detailed "cumbersome information"

"- d" removes the object code file from the static library file

Ar tv libsupp.a view the contents of this file

Ar xv libsupp.an extract content

For beginners to delete things-I

Ar rv xx.an add.o adds this file to the file

These are the operations related to Linux Vim and library archiving. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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

Servers

Wechat

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

12
Report