Project 2 Task 7 Manage rpm packages and compressed packages

Subtask 1 Manage rpm packages

Step 1: Check whether the rpm software has been installed

View through the [rpm -q package name] command, the specific command is as follows:

[rpm -qa | grep tomcat4] Query all the installed tomcat packages.

[rpm -qip example. rpm] Query the information about the example.rpm installation package.

[rpm -qif /bin/df] Query the information about the installation package where the /bin/df file is located.

[rpm -qif /bin/df] Query the directory where each file in the installation package where the /bin/df file is installed is installed.

Step 2: Install the rpm package

[rpm -i example.rpm] Install the example.rpm package.

[rpm -iv example.rpm] Install the example.rpm package and display the file information being installed during the installation process.

[rpm -ivh example.rpm] Install the example.rpm package and display the file information and installation progress during the installation process.


Step 3: Upgrade the rpm package

[rpm -U example.rpm] example.rpm package.

[rpm -Uvh example.rpm] Add the parameter v to display the detailed information during the upgrade, and add the parameter h to display the installation process.

Step 4: Uninstall the rpm package

[rpm -e tomact4] Uninstall the tomact4 package.

[rpm -e --nodeps] command to force uninstall.

Step 5: Familiarize yourself with other additional commands of rpm

[rpm -e --nodeps vsftpd] Ignore dependencies and proceed to remove the vsftpd package.

[rpm -i --nodeps vsftpd] Ignore the dependencies and continue to install the vsftpd package.

[rpm -i --requires vsftpd] Display the dependencies of the installation package and install the vsftpd package.

[rpm -i --force vsftpd] Force the installation of the vsftpd package.

Subtask 2 Manage compressed packages

Step 1: Manage tar packages

[tar cvf aa.tar aa.txt] Create a tar package

[tar xvf aa.tar] Unzip a tar package.

[tar cvfz aa.tar.gz aa.txt] Create a tar.gz package.

Step 2: Manage zip packages

[zip yhy.zip yhy.txt] Compress the yhy.txt file to yhy.zip.

[zip -r test.zip./*] Compress all files and folders in the current directory into test.zip files, -r means recursively compress all files in subdirectories.

[zip test2.zip test/*] Package directory.

[zip -d yhy.zip yhy.txt] Delete the yhy.txt file in the compressed file yhy.zip.

[zip -d yhy.zip yhy/ln.log] Delete the file ln.log in the package file directory.

[zip -m yhy1.zip yhy1.txt] Add the yhy.txt file to the compressed file yhy1.zip.

[zip yhy3.zip yhy3s/* -x yhy3s/ln.log] Exclude the ln.log file when compressing the file.

Step 3: Unzip the zip package

[unzip yhy.zip] Unzip the compressed file yhy.zip to the current directory.

[unzip -n yhy.zip -d /tmp] Unzip the compressed file yhy.zip in the specified directory /tmp. If the same file already exists, the [unzip] command is required not to overwrite the original file.

[unzip -o test.zip -d tmp/] Unzip the compressed file test.zip under tmp in the specified directory. If the same file already exists, the [unzip] command is required to overwrite the original file.

[unzip -v yhy.zip] View compressed files without decompressing them.

[unzip a.zip] Unzip a zip package.

Step 4: Other compression software such as gzip and gunzip and common commands

[gzip -d a. gz 3. tar.gz] Unzip a gz package.

[tar xvzf abc.tar.gz] Unzip a tar.gz package.

[gunzip abc.tgz] Unzip a tgz package.

[tar xvzf a.tar.z] Unzip a tar.z package.

[bunzip2 b.txt.bz2] Unzip a bz2 package.

[find / -name "*.zip"] will display all the .zip files in the system.

[find / -name “*.gz”|wc -1|] Find how many .gz files are in the system and count the number.

[mkdir /home/dir1 dir2 dir3] Create 3 directories in the home directory.

[touch /home/dir1/file1 /home/dir1/file2 /home/dir1/file3] respectively create file1, file2, and file3 in the newly created directory.

[zip -q -r /root/ysl.zip/root/*] Compress all files (excluding directories) in the home directory into the file ysl.zip.

[zip -m ysl.zip install. log] Add /root/install.log to ysl.zip.

[unzip -v ysl.zip] Display the file information contained in ysl.zip.

[mkdir /tmp/unzip-ysl] Create the unzip-ysl directory.

[unzip ysl.zip -d/tmp/unzip-ysl] Unzip ysl.zip to /tmp/unzip-ysl.

[zip -r /root/ys2.zip /root/*] Compress all files (including directories) in the home directory into the file ys2.zip.

[mkdir /tmp/unzip-ys2] Create the unzip-ys2 directory

[unzip ys2.zip -d /tmp/unzip-ys2] Unzip ys2.zip to the /tmp/unzip-ys2 directory.

[tar -czvf file.tar.gz dirl/file1] Compress the dirl/file1 file into file1.tar.gz.

[tar -czvf file.tar.gz dirl/file2] Compress the dirl/file2 file into file2.tar.gz.

[tar -czvf file.tar.gz dirl/file3] Compress the dirl/file3 file into file3.tar.gz.

[mkdir /tmp/gunzip] Create a gunzip directory.

[cp dirl/file1.gz dirl/file2.gz dirl/file3.gz /tmp/gunzip] Copy the compressed file to the newly created directory.

[gzip -dv /tmp/gunzip/*] Compress all files in the gunzip directory.




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324770268&siteId=291194637