Cheat Sheet

A page dedicated to all the useful commands found laying around the internet. It is a reference tool that provides simple, brief instructions for accomplishing a specific tasks.

Create a file with specific size

The below command will create a 10M file

#  dd if=/dev/zero of=disk1.img bs=1024k count=10

CHMOD Recursively on directories or files using FIND

Get ownership and permission sorted out quickly in a web directory.

# find -name '*' -type d -exec chmod 0755 {} \;
# find . -type f -exec chmod 0644 {} \;

List installed packages

List all installed packages using rpm -a option

# rpm -qa

List all installed packages alphabetically name only

rpm -qa --queryformat "%{NAME}\n" | sort -fu | more

To flush the DNS cache in Linux

To restart the nscd daemon

# service nscd restart

Once you run the command your linux DNS cache will flush.

Remove all i386 packages from CentOS

# yum remove \*.i\?86

Clear history in CentOS

# history -c

Installing composer on CentOS 6

# curl -sS https://getcomposer.org/installer | php -- --install-dir=/bin
# composer.phar update

UNIX / Linux uptime command

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following commands:

# uptime

What is my IP Linux CLI

# wget -qO- http://ipecho.net/plain ; echo