Create a gist now

Instantly share code, notes, and snippets.

Useful commands for CentOS.

Files

Find file

find . -name foobar.txt

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

-iname foobar — Filter by file name

Visual Editor

Find string

/foobar

n — Next occurrence

SHIFT + n — Previous occurrence

Packages

View setup repositories

yum repolist --verbose

-v, --verbose — Print verbose information

Download package

curl http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm --remote-name
curl http://rpms.famillecollet.com/enterprise/remi-release-7.rpm --remote-name

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

Import package key

rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi

--import — Import key from path.

Install package

YUM
yum install git
RPM
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
yum remove git
RPM
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

System

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