---
name: "gcore"
section: "1"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/gcore"
---

# gcore(1)

get core images of running process

## NAME

**gcore** – get core images of running process

## SYNOPSIS

**gcore** \[**-f**\] \[**-k**\] \[**-c** *core*\] \[*executable*\] *pid*

## DESCRIPTION

The **gcore** utility creates a core image of the specified process, suitable for use with [gdb(1)](/gdb/1.md) (*ports/devel/gdb*). By default, the core is written to the file “*core.\<pid\>*”. The process identifier, *pid*, must be given on the command line.

The following options are available:

- **-c**

  Write the core file to the specified file instead of “*core.\<pid\>*”.

- **-f**

  Dumps all available segments, excluding only malformed and undumpable segments. Unlike the default invocation, this flag dumps mappings of devices which may invalidate the state of device transactions or trigger other unexpected behavior. As a result, this flag should only be used when the behavior of the application and any devices it has mapped is fully understood and any side effects can be controlled or tolerated.

- **-k**

  Use the [ptrace(2)](/ptrace/2.md) PT\_COREDUMP kernel facility to write the core dump, instead of reading the process' memory and constructing the dump file in **gcore** itself. This is faster, and the dump is written by the same kernel code that writes core dumps upon fatal signals.

## FILES

- *core.\<pid\>*

  the core image

## HISTORY

A **gcore** utility appeared in 4.2BSD.

## BUGS

Because of the [ptrace(2)](/ptrace/2.md) usage **gcore** may not work with processes which are actively being investigated with [truss(1)](/truss/1.md) or [gdb(1)](/gdb/1.md) (*ports/devel/gdb*). Additionally, interruptable sleeps may exit with EINTR.

The **gcore** utility is not compatible with the original 4.2BSD version.
