Category Archives: Manual/Reference

Memcached – Flush Contents Of a Server Using Command Line

You can invalidate all existing cache items using the flush_all command. This command does not pause the server, as it returns immediately.
It does not free up or flush memory at all, it just causes all items to expire.

netcat (nc) Command Example

The nc (netcat) command is a simple unix utility which reads and writes data across network connections, using TCP or UDP protocol.
It can simply connect to the memcached instance and and invalidate all existing cache:

echo 'flush_all' | nc localhost 11211

OR

echo 'flush_all' | netcat localhost 11211

OR

nc 192.168.1.10 11211<<<"flush_all"

Read more »

Linux – Set Date and Time From a Command Prompt

Use the date command to display the current date and time or set the system date / time over ssh session.
You can also run the date command from X terminal as root user.

This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from the shell prompt.

You must login as root user to use date command.

Use the following syntax to set new data and time:

date --set="STRING"

For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:

# date -s "2 OCT 2006 18:00:00"

OR

# date --set="2 OCT 2006 18:00:00"

You can also simplify format using following syntax:

# date +%Y%m%d -s "20081128"

To set time use the following syntax:

# date +%T -s "10:13:13"

Where,

10: Hour (hh)
13: Minute (mm)
13: Second (ss)

Use %p locale’s equivalent of either AM or PM, enter:

# date +%T%p -s "6:10:30AM"
# date +%T%p -s "12:10:30PM"

Linux – Network comands

This article provides a summary of the most important or frequently used commands.

Please keep in mind that these tips assume you already have a configured Linux hostname and IP, with a working network card and connection.

arp

This short but quite useful command allows you to check your network card for connectivity and review your IP address and host network information. Although I tend to use other commands more frequently, arp is useful when I want to very quickly check status on my network card.

host

The host command is something I use very regularly to check either the hostname of a specific server when I have the IP address, or the IP address when I have a specific hostname. The primary function of the host command is to enable a quick lookup of DNS server information. But don’t underestimate the power of this command. The host command allows you to perform many different queries using the -t option.

For instance, you can use the -t with TOC to specify that you wish to lookup a host geographical location: host -t LOC hostname (replace hostname with the fully qualified domain such as whileifblog.com)
ifconfig

The ifconfig command allows you to check and configure your server’s network cards, assigning IP, DNS, and Gateway addresses. For example, to assign a specific IP address for the eth0 network card, you can use:

ifconfig eth0 XXX.XXX.XXX.XXX

(replace to XXX.XXX.XXX.XXX with an actual IP address)

Read more »