Skip to content

Instantly share code, notes, and snippets.

@mohanraj-r
Last active September 5, 2017 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohanraj-r/2f797a4687833a156688919509d829e3 to your computer and use it in GitHub Desktop.
Save mohanraj-r/2f797a4687833a156688919509d829e3 to your computer and use it in GitHub Desktop.
[centos] Utils for working with centos #shell #reference
# list files from a rpm file on disk without extracting it
# source: http://stackoverflow.com/a/18787544
rpmx(){
rpm_file=$1
rpm2cpio $rpm_file | cpio -idmv
}
# uninstalling package with issues
# http://serverfault.com/a/613258
yum clean all && rpm --rebuilddb
package-cleanup --problems
yum erase foo
# if that fails (due to errors in scripts)
yum --setopt=tsflags=noscripts remove foo
# if that fails ..
rpm -e --noscripts
# print metadata from a rpm file
# http://serverfault.com/a/414557
rpm -qip /path/file.rpm
# bunch of info about current sys - including hostname, kernel
hostnamectl
# centos version
rpm --query centos-release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment