# How to Disable Terminal Clearing in Holehe CLI: Complete Guide

> Learn how to disable terminal clearing in Holehe CLI with the --no-clear flag. Keep your terminal history visible after running email investigations. Complete guide.

- Repository: [Palenath/holehe](https://github.com/megadose/holehe)
- Tags: how-to-guide
- Published: 2026-08-26

---

**Pass the `--no-clear` flag when running Holehe to prevent the tool from clearing your terminal screen before displaying email investigation results.**

Holehe is an open-source OSINT tool that checks whether an email address is registered on various websites and services. By default, the application clears the entire terminal screen before printing its findings, which can disrupt your workflow if you need to preserve previous command output. You can disable this behavior using a built-in command-line option that preserves your terminal history according to the megadose/holehe source code.

## Understanding the Terminal Clearing Mechanism

When you execute Holehe without any flags, the tool automatically injects ANSI escape sequences to wipe the terminal screen clean. In [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py), the `print_result` function contains the following logic:

```python
if args.noclear == False:
    print("\033[H\033[J")   # clear screen

else:
    print("\n")              # just add a newline

```

The escape sequence `\033[H\033[J` moves the cursor to the top-left position and clears everything below it, effectively giving the tool a blank canvas for its output. This behavior ensures clean presentation but removes any previous commands or outputs from view.

## Using the --no-clear Flag

To preserve your terminal content, append `--no-clear` to your Holehe command. This sets the `noclear` argument to `True`, causing the application to skip the clear-screen routine and instead print a single newline before the results.

**Basic syntax:**

```bash
holehe target@example.com --no-clear

```

**Default behavior (clears screen):**

```bash
holehe target@example.com

```

When the flag is present, Holehe maintains all previous terminal output, allowing you to scroll up and review earlier commands or outputs alongside the email investigation results.

## Where the Logic is Implemented

The terminal clearing functionality is defined and controlled in two specific locations within [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py).

**Argument definition (around line 188):**

```python
parser.add_argument("--no-clear", default=False, required=False,
                    action="store_true", dest="noclear",
                    help="Do not clear the terminal to display the results")

```

This configuration creates a boolean flag that defaults to `False`, meaning the terminal clears unless you explicitly opt out.

**Execution logic (in `print_result` function, around line 14):**

The function checks the `args.noclear` value immediately before rendering results. If the value remains `False` (default), it executes the ANSI clear command. If you passed `--no-clear`, the value becomes `True` and the function bypasses the clearing routine entirely.

## Combining with Other Options

The `--no-clear` flag works seamlessly with other Holehe command-line options. You can chain it with output formatters and color settings to customize your investigation workflow.

**Disable clearing and colors while exporting to CSV:**

```bash
holehe target@example.com --no-clear --no-color --csv

```

**Preserve terminal with verbose output:**

```bash
holehe target@example.com --no-clear -v

```

This flexibility allows you to integrate Holehe into scripts and automated workflows without losing context from previous terminal operations.

## Summary

- Holehe clears the terminal by default using ANSI escape sequences (`\033[H\033[J`) defined in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py).
- The `--no-clear` flag sets `args.noclear` to `True`, bypassing the screen-clearing logic in the `print_result` function.
- When disabled, Holehe prints only a newline (`\n`) instead of wiping the terminal, preserving your command history.
- You can combine `--no-clear` with other flags like `--no-color` and `--csv` without conflicts.

## Frequently Asked Questions

### Why does Holehe clear the terminal by default?

Holehe clears the terminal to provide a clean, uncluttered display of email investigation results. According to the source code in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py), this behavior ensures that results appear at the top of the terminal window without interference from previous command outputs, creating a focused viewing experience for OSINT investigators.

### Can I disable terminal clearing permanently without typing the flag every time?

The current implementation in megadose/holehe does not support a configuration file or environment variable for default settings. You must specify `--no-clear` with each execution. To make this permanent, create a shell alias such as `alias holehe='holehe --no-clear'` in your `.bashrc` or `.zshrc` file.

### Does --no-clear affect the format or content of the results?

No, the `--no-clear` flag only controls the display behavior before outputting results. In [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py), the logic simply swaps the clear-screen escape sequence for a newline character. The email check results, colors (unless disabled with `--no-color`), and CSV exports remain identical regardless of whether you clear the terminal or preserve it.

### What happens if I use --no-clear in a script or piped command?

When using `--no-clear` in scripts or piped workflows, Holehe will output a single newline character before the results instead of ANSI escape sequences. This makes the output more predictable for log files and pipeline processing, as it avoids injecting terminal control characters that might corrupt text processing tools or log parsers.