In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
I. View the contents of the file
View file contents cat command
Cat command
Purpose: display the contents of the file
Cat [option] file name...
Cat-n file name
Display the contents of the file and display the line number
More command
Purpose: full-screen paged display of file contents
Interactive operation method
Press Enter to scroll down line by line
Press the spacebar to flip down one screen
Press Q key to exit
More [option] file name...
Less command
Purpose: same as more command, but with more extended functions
Interactive operation method
Page Up page up, Page Down page down
Press the "/" key to find the content, "n" next content, "N" last content
Other functions are basically similar to the more command
Less [option] file name...
Tail command
Purpose: view a small portion of the end of the file (10 lines by default)
Tail-n file name...
Displays the specified number of rows at the end
Tail-f file name: orbit file changes
Wc command
Purpose: information such as the number of words in the statistics file (Word Count)
Common command options
-l: count the number of rows
-w: count the number of words
-c: count the number of bytes
Wc [options]... Target file.
Wc-l / etc/passwd to see how many users there are in the system
How much information does wc-l / var/log/secure have related to user operations?
The grep command (regular expressions are supported) and sed,awk
Purpose: find and display the line containing the specified string in the file
Common command options
-I: ignore case when looking up
-v: reverses the lookup and outputs lines that do not match the lookup criteria
Find condition settin
The string to be found is enclosed in double quotation marks
"^." Denote with. At the beginning, ". $" means with. End
"^ $" represents a blank line
Grep [options]... Find condition object file
2. Compress commands gzip and bzip2
Gzip command, bzip2 command
Purpose: make compressed files and unzip compressed files
Common command options
-9,-d
Gzip [- 9] filename...
Bzip2 [- 9] filename...
Compressed file in gzip-d. GZ format
Compressed file in bzip2-d .bz2 format
Please note:
Gzip/bzip2 compresses the object name, generates a compressed package and deletes the original file, which can only compress the file, not the compressed directory.
For example:
Bzip2 anaconda-ks.cfg
Gzip anaconda-ks.cfg
The gzip and bzip2 commands use different compression algorithms
Generally speaking, the compression efficiency of bzip2 is better.
Generate a large file
Dd if=/dev/zero of=big.txt bs=1M count=50
Gunzip command
Gunzip is equivalent to gzip-d
Gzip-d mkfile.gz
Or
Gunzip mkfile.gz
Bunzip2 command
The usage of bzip2 and bunzip2 commands is basically the same as that of gzip and gunzip commands.
Tar command (package directories and files and compress them)
Purpose: making and releasing archival documents
Common command options
-c,-x,-v,-f,-p,-t,-C,-z,-j
-c means packing
-x means unpacking
-v display details
-f specify the file name
-p keep permissions
-t test
-C specifies the decompression directory
-z calls compression algorithm gzip
-j calls the reduction algorithm bzip2
Tar [options]... Archive file name source file or directory
Tar [options]... Archive file name [- C target directory]
Tar czvf yasuob35.tar.gz / root/b35
Tar cjvf yasuob35.tar.bzip2 / root/b35/
Tar xzvf yasuob35.tar.gz-C dd36
Note: the relative path is used to compress the data, and the decompression will appear in the current working directory, so the operation is safer.
Assignment:
1. Count the number of users in the system; display the lines at the end of bash in the user configuration
2. Create a new directory yasuo in / root, and use two compression methods to compress the files of / etc/*.conf type into packages, package names peizhi.tar.gz and peizhi.bz2.
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.