Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Useful commands for CentOS.


Find file

find . -name foobar.txt

-name FooBar — Filter by file name (case sensitive)

-iname foobar — Filter by file name

Visual Editor

Find string


n — Next occurrence

SHIFT + n — Previous occurrence


View setup repositories

yum repolist --verbose

-v, --verbose — Print verbose information

Download package

curl --remote-name
curl --remote-name

-O, --remote-name — Write output to local file

Import package key

rpm --import

--import — Import key from path.

Install package

yum install git
rpm epel-release-7-5.noarch.rpm --hash --install --verbose
rpm remi-release-7.rpm --hash --install --verbose

-h, --hash — Print progress

-i, --install — Install package

-v, --verbose — Print verbose information

Remove package

yum remove git
rpm epel-release-7-2.noarch.rpm --erase

-e, --erase — Remove package

View package dependants

repoquery --whatrequires httpd

--whatrequires — Print packages that require target package.

View package dependencies

yum deplist httpd

View installed packages

yum list installed


View Red Hat version

cat /etc/redhat-release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment