Domanda :In genere uso rpm -qa | grep command
per trovare a quale pacchetto appartiene il comando. Tuttavia, il grepped elencherebbe più nomi di pacchetti e talvolta anche i nomi di pacchetti sbagliati che corrispondono al modello di ricerca. Stavo pensando se c'è un modo migliore per farlo in CentOS? – Pavitra
Soluzione:trova a quale pacchetto appartiene il comando
Tutto ciò di cui hai bisogno è un semplice comando come mostrato di seguito:
Formato:
# rpm -qf $(which <command>)
Esempio:
# rpm -qf $(which update-crypto-policies) crypto-policies-scripts-20211116-1.gitae470d6.el8.noarch
(o)
# rpm -qf `which update-crypto-policies`
(o)
In alternativa, puoi provare anche il comando seguente.
Formato:
# which <command> | xargs rpm -qf
Esempio:
# which update-crypto-policies | xargs rpm -qf crypto-policies-scripts-20211116-1.gitae470d6.el8.noarch
Puoi anche usare dnf
e yum
comandi per trovare lo stesso.
# dnf provides `which update-crypto-policies` crypto-policies-scripts-20210209-1.gitbfb6bed.el8_3.noarch : Tool to switch between crypto policies Repo : baseos Matched from: Filename : /usr/bin/update-crypto-policies crypto-policies-scripts-20210617-1.gitc776d3e.el8.noarch : Tool to switch between crypto policies Repo : baseos Matched from: Filename : /usr/bin/update-crypto-policies crypto-policies-scripts-20211116-1.gitae470d6.el8.noarch : Tool to switch between crypto policies Repo : @System Matched from: Filename : /usr/bin/update-crypto-policies crypto-policies-scripts-20211116-1.gitae470d6.el8.noarch : Tool to switch between crypto policies Repo : baseos Matched from: Filename : /usr/bin/update-crypto-policies
Utilizzo di yum:
# yum provides `which update-crypto-policies`
Metodo non consigliato:
Ma se grep l'output di rpm -qa
, quindi risulterebbe in più nomi di pacchetto.
# rpm -qa |grep crypto crypto-policies-20211116-1.gitae470d6.el8.noarch python3-cryptography-3.2.1-5.el8.x86_64 crypto-policies-scripts-20211116-1.gitae470d6.el8.noarch
Come hai giustamente sottolineato, il modello di ricerca "crypto" corrisponde a più nomi di pacchetti e devi eseguire un altro comando per trovare a quale pacchetto appartiene.
Ad esempio, devi elencare i file inclusi nel pacchetto e grep il suo output come mostrato di seguito:
# rpm -ql crypto-policies-scripts | grep update-crypto-policies /usr/bin/update-crypto-policies /usr/share/crypto-policies/python/__pycache__/update-crypto-policies.cpython-36.opt-1.pyc /usr/share/crypto-policies/python/__pycache__/update-crypto-policies.cpython-36.pyc /usr/share/crypto-policies/python/update-crypto-policies.py /usr/share/man/man8/update-crypto-policies.8.gz
Ma questo controllo deve essere fatto con ogni pacchetto elencato da rpm -qa
comando. Quindi questo non è il modo ideale per trovare il pacchetto.
Su Debian/Ubuntu:
dpkg -S $(which update-crypto-policies)
Nota :Il comando utilizzato negli esempi è "update-crypto-policies
' che viene utilizzato per impostare/modificare le politiche crittografiche a livello di sistema. Devi sostituirlo con il comando che preferisci.