Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’m running a Debian Squeeze web server. I’ve installed memcached on it, and configured memcached to listen on a Unix domain socket (at /tmp/memcached.sock), as it only needs to receive messages from the website, which lives on the same server.

It seems to be working fine, but I’d also like to communicate with memcached via the shell, to check that it’s doing what I think it’s doing.

memcached accepts messages via a simple ASCII protocol (if I understand correctly). If it was listening on TCP/IP, I could send messages to it via e.g. nc:

$ echo "stats settings" | nc localhost 11211

But I can’t figure out how to send that text to the domain socket instead.

On my laptop (which runs OS X Lion), both nc and telnet have options (-U and -u respectively) to use domain sockets. However, on my Debian Squeeze web server, these options aren’t present.

share|improve this question
up vote 15 down vote accepted

With netcat-openbsd, there is a -U option. If you don't have it, you probably have netcat-traditional installed instead; I'd suggest switching.

share|improve this answer

With socat (a 'bidirectional data relay between two data channels') you can can connect to the unix domain socket like this:

$ socat - UNIX-CONNECT:/tmp/memcached.sock
share|improve this answer

You can use socat on Debian. To install it:

# apt-get install socat
share|improve this answer
That looks pretty good. I don’t appear to have socat installed on my server, but it’s certainly available: packages.debian.org/squeeze/socat – Paul D. Waite Dec 13 '11 at 22:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.