Read Me
shmcat - a tool to dump shared memory segments, files and text
(C) 2012, 2014, 2016, 2017, 2022 by Stefan Gast
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
License: GPLv2 or later
Report bugs to: dev at stefangast dot eu
===============================================================================
Description:
shmcat is a tool to dump shared memory segments (System V and/or POSIX), files,
standard input and/or text passed via the command line to standard output.
The program can dump several objects in sequence, similar to the cat (1)
command.
The package comes with an optional utility called ftok that acts as a wrapper
to the library function of the same name.
===============================================================================
Compile and install in the usual GNU way:
cd SUBDIR
./configure
make
su -c 'make install'
The configure script supports several options (use ./configure --help for a
complete list), for example:
--disable-nls Disable translations. This includes program messages
and man pages. Currently only German translations are
available, so you probably want to use this option if
you are not a German speaker.
--disable-ftok Do not build the ftok utility.
--disable-posix-shm
Disable POSIX shared memory support (shm_open
and friends). Support for the (older) System V
shared memory API (shmget, shmat...) will still
be included.
If are going to install shmcat on FreeBSD, you probably want to configure with:
--manpath=/usr/local/man
Otherwise the man pages will be installed (by default) to /usr/local/share/man,
which is not in the default manpath of FreeBSD.
===============================================================================
Examples:
To dump a System V shared memory segment, given by key:
shmcat -M KEY > FILENAME
(where KEY is some shared memory key obtained via ipcs (1) or ftok (1),
and FILENAME is the file to write the content to)
To dump a System V shared memory segment, given by id:
shmcat -m ID > FILENAME
(where ID is some shared memory ID obtained via ipcs (1), and FILENAME
is the name of the file to write the content to)
To dump a POSIX shared memory segment:
shmcat -p /SHMNAME > FILENAME
(where /SHMNAME is the name of the desired POSIX shared memory segment,
and FILENAME is the file to write the content to)
You can dump several segments and files together with one call, e.g.:
shmcat -m ID -f SOME_FILE > FILENAME
Of course, you can also use command substitution and the ftok tool for the
key, e.g.:
shmcat -M `ftok SOME_FILE 65` > FILENAME
For more information, please see the man pages for shmcat (1) and ftok (1),
or type:
shmcat -h
ftok -h
As seen above, if you dump shared memory segments, you should redirect the
output of shmcat to a file or a program like od (1), because shared memory
data usually has a binary form and thus it may contain non-printable
characters.