Linux筆記 -- Week04 Q&A

1、自建yum倉庫,分為網(wǎng)絡(luò)源和本地源。

網(wǎng)絡(luò)yum源

1、本地主機(jī) 10.0.0.162 安裝httpd服務(wù)并啟用(出于實(shí)驗(yàn)方便考慮,關(guān)閉防火墻及selinux服務(wù));
2、虛擬機(jī)添加光驅(qū)并執(zhí)行如下命令掃描識(shí)別:

alias scandisk='echo - - - >/sys/class/scsi_host/host0/scan;echo - - - >/sys/class/scsi_host/host1/scan;echo - - - > /sys/class/scsi_host/host2/scan'
[root@centos8 7]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk
├─sda1   8:1    0  100G  0 part /
├─sda2   8:2    0   50G  0 part /data
├─sda3   8:3    0    2G  0 part [SWAP]
├─sda4   8:4    0    1K  0 part
└─sda5   8:5    0    1G  0 part /boot
sr0     11:0    1  9.3G  0 rom  /run/media/root/CentOS-8-4-2105-x86_64-dvd
sr1     11:1    1  9.5G  0 rom

3、在/var/www/html/ 目錄下創(chuàng)建mkdir -p /var/www/html/centos/{7,8} 執(zhí)行如下命令掛載:

[root@centos8 7]# mount  /dev/sr1 /var/www/html/centos/7/
mount: /var/www/html/centos/7: WARNING: device write-protected, mounted read-only.
[root@centos8 7]# mount  /dev/sr0 /var/www/html/centos/8/
mount: /var/www/html/centos/8: WARNING: device write-protected, mounted read-only.
[root@centos8 7]#

4、正常訪問httpd服務(wù)后,在客戶機(jī) /etc/yum.repos.d/Centos7.repo 或 Centos8.repo倉庫文件添加如下內(nèi)容并驗(yàn)證:
http獲取源
Centos7

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://10.0.0.162/centos/7/
gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
gpgkey=http://10.0.0.162/centos/7/RPM-GPG-KEY-CentOS-7
enabled=1

Centos8:

[baseos]
name=CentOS Linux $releasever - BaseOS
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
baseurl=http://10.0.0.162/centos/8/BaseOS/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[AppStream]
name=CentOS Linux $releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
baseurl=http://10.0.0.162/centos/8/AppStream/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

#additional packages that may be useful
[extras]
name=CentOS Linux $releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

通過刷新yum緩存后驗(yàn)證倉庫信息:
centos7

[root@centos7 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                                                                 repo name                                                                        status
base                                                                    CentOS-7 - Base                                                                  10,072
repolist: 10,072
[root@centos7 yum.repos.d]#

centos8

[root@centos8 yum.repos.d]# yum clean all
21 files removed
[root@centos8 yum.repos.d]# yum update
CentOS Linux 8 - BaseOS                                                                                                         89 MB/s | 2.5 MB     00:00
CentOS Linux 8 - AppStream                                                                                                      91 MB/s | 7.1 MB     00:00
CentOS Linux 8 - Extras - mirrors.aliyun.com                                                                                    80 kB/s |  10 kB     00:00
Dependencies resolved.
Nothing to do.
Complete!
[root@centos8 yum.repos.d]# yum repolist
repo id                                                       repo name
AppStream                                                     CentOS Linux 8 - AppStream
baseos                                                        CentOS Linux 8 - BaseOS
extras                                                        CentOS Linux 8 - Extras - mirrors.aliyun.com
[root@centos8 yum.repos.d]# yum list httpd
Last metadata expiration check: 0:00:15 ago on Sun 12 Dec 2021 11:04:05 PM CST.
Installed Packages
httpd.x86_64                                                 2.4.37-43.module_el8.5.0+1022+b541f3b1                                                  @appstream
[root@centos8 yum.repos.d]# yum list vsftpd
Last metadata expiration check: 0:00:26 ago on Sun 12 Dec 2021 11:04:05 PM CST.
Available Packages
vsftpd.x86_64                                                                    3.0.3-33.el8                                                                     AppStream
[root@centos8 yum.repos.d]#

yum本地源形式:
命令 createrepo . 可以在當(dāng)前目錄生成元數(shù)據(jù) repodata ,從而可以將當(dāng)前目錄作為倉庫使用
centos7
1、掛載光驅(qū) mount /dev/cdrom /mnt/cdrom
2、yum配置文件設(shè)置為:
[base]
name=CentOS-$releasever - Base
baseurl=file:///mnt/cdrom
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

【Centos8.repo】
epel源配置已經(jīng)額外的epel.repo里面配置,故Centos8.repo文件中注釋掉該部分
1、安裝autofs并啟動(dòng)服務(wù),實(shí)現(xiàn)將光驅(qū)自動(dòng)掛載至 /misc/cd目錄下
2、編輯 /etc/yum.repos.d/Centos8.repo文件配置如下:

# Centos8.repo
[baseos]
name=CentOS Linux $releasever - BaseOS
failovermethod=priority
baseurl=file:///misc/cd/BaseOS/
        https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
       https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

[AppStream]
name=CentOS Linux $releasever - AppStream
failovermethod=priority
baseurl=file:///misc/cd/AppStream
        https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/AppStream/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
       https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
  
#additional packages that may be useful
[extras]
name=CentOS Linux $releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

#[epel]
#name=Extra Packages for Enterprise Linux $releasever - $basearch
## It is much more secure to use the metalink, but if you wish to use a local mirror
## place it's address here.
##metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
#baseurl=https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch
#gpgcheck=1
#countme=1
#gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8
##gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS Linux $releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 
[PowerTools]
name=CentOS Linux $releasever - PowerTools - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/PowerTools/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/PowerTools/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

enabled=1

更新yum緩存:yum clean all 和 yum update

[root@centos8 yum.repos.d]# yum clean all
73 files removed
[root@centos8 yum.repos.d]# yum update
CentOS Linux 8 - BaseOS                                                                                                                                                       .
.
.
Dependencies resolved.
Nothing to do.
Complete!
[root@centos8 yum.repos.d]# yum repolist
repo id                                                                           repo name
AppStream                                                                         CentOS Linux 8 - AppStream
PowerTools                                                                        CentOS Linux 8 - PowerTools - mirrors.aliyun.com
baseos                                                                            CentOS Linux 8 - BaseOS
epel                                                                              Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                                                      Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                                                            CentOS Linux 8 - Extras - mirrors.aliyun.com
[root@centos8 yum.repos.d]#
[root@centos8 yum.repos.d]# yum list all |grep httpd
centos-logos-httpd.noarch                                         85.5-1.el8                                        baseos
dmlite-apache-httpd.x86_64                                        1.15.1-11.el8                                     epel
httpd.x86_64                                                      2.4.37-39.module_el8.4.0+778+c970deab             AppStream
httpd-devel.x86_64                                                2.4.37-39.module_el8.4.0+778+c970deab             AppStream
.
.
.
#省略后續(xù)顯示的包
[root@centos8 yum.repos.d]#

2、編譯安裝http2.4,實(shí)現(xiàn)可以正常訪問,并將編譯步驟和結(jié)果提交。

[root@centos8 pkgs_of_httpd]# wget https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.bz2
#獲取源碼包
[root@centos8 pkgs_of_httpd]# tar -jxvf httpd-2.4.51.tar.bz2
#解壓
[root@centos8 pkgs_of_httpd]#yum install -y apr-devel apr-util-devel pcre-devel gcc make openssl-devel redhat-rpm-config autoconf
#安裝依賴包
[root@centos8 httpd-2.4.51]# ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl
checking for chosen layout... Apache
checking for working mkdir -p... yes
...
#安裝配置
[root@centos8 httpd-2.4.51]# make && make install
Making all in srclib
make[1]: Entering directory '/data/pkgs_of_httpd/httpd-2.4.51/srclib'
make[1]: Leaving directory '/data/pkgs_of_httpd/httpd-2.4.51/srclib'
Making all in os
make[1]: Entering directory '/data/pkgs_of_httpd/httpd-2.4.51/os'
Making all in unix
...
make[1]: Leaving directory '/data/pkgs_of_httpd/httpd-2.4.51'
#編譯安裝
[root@centos8 httpd-2.4.51]# cat /etc/passwd |grep apache
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
[root@centos8 httpd-2.4.51]# usermod  -d /var/www -c Apache -u 48 apache
[root@centos8 httpd-2.4.51]# cat /etc/passwd |grep apache
apache:x:48:48:Apache:/var/www:/sbin/nologin
[root@centos8 httpd-2.4.51]#echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
[root@centos8 httpd-2.4.51]# . /etc/profile.d/httpd.sh
#添加apache用戶,并添加啟動(dòng)命令至PATH
[root@centos8 httpd-2.4.51]#apachectl start
#啟動(dòng)服務(wù)
[root@centos8 httpd-2.4.51]#vim /etc/httpd/httpd.conf
#修改 User apache
#修改 Group apache
#重啟服務(wù)
[root@centos8 httpd-2.4.51]# ps aux |grep httpd
root       88225  0.0  0.3 119008  6592 ?        Ss   02:21   0:00 /apps/httpd/bin/httpd -k start
apache     88604  0.0  0.4 1339632 9768 ?        Sl   02:39   0:00 /apps/httpd/bin/httpd -k start
apache     88605  0.0  0.4 1339632 9768 ?        Sl   02:39   0:00 /apps/httpd/bin/httpd -k start
apache     88606  0.0  0.3 1339632 7728 ?        Sl   02:39   0:00 /apps/httpd/bin/httpd -k start
root       88689  0.0  0.0  12136  1160 pts/0    S+   02:39   0:00 grep --color=auto httpd
[root@centos8 httpd-2.4.51]#
#查看進(jìn)程
[root@centos8 shell-excercise]# curl http://10.0.0.162
<html><body><h1>It works!</h1></body></html>
[root@centos8 shell-excercise]#
image.png

3、利用sed取出ifocnfig命令中本機(jī)的ipv4地址。

[root@centos8 data]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.151  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::20c:29ff:fe9b:6267  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:9b:62:67  txqueuelen 1000  (Ethernet)
         RX packets 251012  bytes 230084898 (219.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 112650  bytes 28477654 (27.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@centos8 data]#
[root@centos8 data]# ifconfig ens33|sed -nE '2s/.*inet ([0-9\.]+).*/\1/p'
10.0.0.151

4、刪除/etc/fstab文件中所有以#開頭,后面至少跟一個(gè)空白字符的行的行首的#和空白字符

1、核實(shí)/etc/fstab中滿足條件的行并將內(nèi)容復(fù)制到 /data/fstab 做操作測試

[root@centos8 data]# cat -An /etc/fstab
     1  $
     2  #$
     3  # /etc/fstab$
     4  # Created by anaconda on Tue Nov 16 17:12:10 2021$
     5  #$
     6  # Accessible filesystems, by reference, are maintained under '/dev/disk/'.$
     7  # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.$
     8  #$
     9  # After editing this file, run 'systemctl daemon-reload' to update systemd$
    10  # units generated from this file.$
    11  #$
    12  UUID=3dc5ae48-314d-41af-87e1-3f748c16432b /                       xfs     defaults        0 0$
    13  UUID=d8f1d916-e9b4-4f9d-8d49-6fe0042237f8 /boot                   ext4    defaults        1 2$
    14  UUID=68d033ab-ee22-4afc-9e02-39439bfd38c1 /data                   xfs     defaults        0 0$
    15  UUID=43b2e65e-bd66-4920-9993-218f80d0bee3 none                    swap    defaults        0 0$
[root@centos8 data]#cp -a /etc/fstab /data/fstab

2、需要操作的行數(shù)為3,4,9,10,執(zhí)行如下命令:
sed -i -E 's/'^#[[:space:]]+'//g' fstab

[root@centos8 data]# sed -i -E 's/'^#[[:space:]]+'//g' fstab
[root@centos8 data]# cat -An fstab
     1  $
     2  #$
     3  /etc/fstab$
     4  Created by anaconda on Tue Nov 16 17:12:10 2021$
     5  #$
     6  Accessible filesystems, by reference, are maintained under '/dev/disk/'.$
     7  See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.$
     8  #$
     9  After editing this file, run 'systemctl daemon-reload' to update systemd$
    10  units generated from this file.$
    11  #$
    12  UUID=3dc5ae48-314d-41af-87e1-3f748c16432b /                       xfs     defaults        0 0$
    13  UUID=d8f1d916-e9b4-4f9d-8d49-6fe0042237f8 /boot                   ext4    defaults        1 2$
    14  UUID=68d033ab-ee22-4afc-9e02-39439bfd38c1 /data                   xfs     defaults        0 0$
    15  UUID=43b2e65e-bd66-4920-9993-218f80d0bee3 none                    swap    defaults        0 0$
[root@centos8 data]#

5、處理/etc/fstab路徑,使用sed命令取出其目錄名和基名

路徑名:

[root@centos8 data]# echo /etc/fstab | sed -E 's/(.*\/)([^\/]*)/\1/'
/etc/
[root@centos8 data]#

基名/basename:

[root@centos8 data]# echo /etc/fstab | sed -E 's/(.*\/)([^\/]*)/\2/'
fstab
[root@centos8 data]#

6、列出Ubuntu軟件管理工具apt的一些用法(自由總結(jié))

更新ubuntu18.04 /etc/apt/sources.list 軟件倉庫源為阿里鏡像源,更新后執(zhí)行 apt update刷新緩存。

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

1、apt list查詢包列表信息【安裝或未安裝都匹配顯示】:apt list / apt list --all-versions

root@ubuntu1804-1-edu-org:~# apt list |egrep "^tree"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

tree/bionic,now 1.7.0-5 amd64 [installed]
tree-ppuzzle/bionic 5.2-10 amd64
tree-puzzle/bionic 5.2-10 amd64
root@ubuntu1804-1-edu-org:~#
root@ubuntu1804-1-edu-org:/etc# apt list --all-versions apache2
Listing... Done
apache2/bionic-updates 2.4.29-1ubuntu4.20 amd64
apache2/bionic-security 2.4.29-1ubuntu4.18 amd64
apache2/bionic 2.4.29-1ubuntu4 amd64

root@ubuntu1804-1-edu-org:/etc#

2、安裝指定軟件及其依賴: apt install

root@ubuntu1804-1-edu-org:~# apt install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0
  ssl-cert
Suggested packages:
Enabling module setenvif.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Processing triggers for ureadahead (0.100.0-21) ...
root@ubuntu1804-1-edu-org:~#

3、刪除:apt remove 刪除軟件包[部分配置仍保留] / apt purge 刪除軟件及其配置文件

root@ubuntu1804-1-edu-org:~# apt remove apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 ssl-cert
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  apache2
0 upgraded, 0 newly installed, 1 to remove and 16 not upgraded.
After this operation, 536 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 117875 files and directories currently installed.)
Removing apache2 (2.4.29-1ubuntu4.20) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.2) ...
root@ubuntu1804-1-edu-org:~# ls /etc/apache2/
apache2.conf  conf-available  conf-enabled  envvars  magic  mods-available  mods-enabled  ports.conf  sites-available  sites-enabled
root@ubuntu1804-1-edu-org:~#root@ubuntu1804-1-edu-org:~# apt purge apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done

4、根據(jù)已知特性搜索軟件包【正則匹配搜索】: apt search

root@ubuntu1804-1-edu-org:~# apt search '^ftp'
Sorting... Done
Full Text Search... Done
bareftp/bionic 0.3.9-3 amd64
  FTP client for GNOME

ftp/bionic,now 0.17-34 amd64 [installed,automatic]
  classical file transfer client

5、顯示包的安裝大小、依賴、安裝來源等信息:apt show
[apt depends 查看依賴的軟件信息 apt rdepends 查看被依賴的軟件信息]

root@ubuntu1804-1-edu-org:~# apt show tree
Package: tree
Version: 1.7.0-5
Priority: optional
Section: universe/utils
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Florian Ernst <florian@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 105 kB
Depends: libc6 (>= 2.14)
Homepage: http://mama.indstate.edu/users/ice/tree/
Task: lubuntu-qt-desktop
Supported: 9m
Download-Size: 40.7 kB
APT-Manual-Installed: yes
APT-Sources: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 Packages
Description: displays an indented directory tree, in color
 Tree is a recursive directory listing command that produces a depth indented
 listing of files, which is colorized ala dircolors if the LS_COLORS environment
 variable is set and output is to tty.

root@ubuntu1804-1-edu-org:~#

6、查看已安裝的全部軟件信息:apt list --installed

root@ubuntu1804-1-edu-org:~# apt list --installed | wc -l

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

641
root@ubuntu1804-1-edu-org:~#

7、查看文件來自于哪個(gè)包:dpkg -S filename

root@ubuntu1804-1-edu-org:/etc# dpkg -S crontab
cron: /usr/bin/crontab
cron: /etc/crontab
cron: /var/spool/cron/crontabs
cron: /usr/share/man/man5/crontab.5.gz
bash-completion: /usr/share/bash-completion/completions/crontab
cron: /usr/share/doc/cron/examples/crontab2english.pl
cron: /usr/share/man/man1/crontab.1.gz
vim-runtime: /usr/share/vim/vim80/syntax/crontab.vim
root@ubuntu1804-1-edu-org:/etc#
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
禁止轉(zhuǎn)載,如需轉(zhuǎn)載請(qǐng)通過簡信或評(píng)論聯(lián)系作者。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容