> For the complete documentation index, see [llms.txt](https://d3ndr1t30x.gitbook.io/breaking-things-a-junior-pentesters-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://d3ndr1t30x.gitbook.io/breaking-things-a-junior-pentesters-guide/linux-commands-cheat-sheet.md).

# Linux Commands Cheat Sheet

### Finding files in the terminal

```
find /path/to/start/directory -type [file_type] -ls
```

1. `/path/to/start/directory`: This is where you should specify the starting directory or path where the search begins. Readers should replace `/path/to/start/directory` with the actual directory they want to search.
2. `[file_type]`: This is where readers should specify the type of file they are looking for. They can replace `[file_type]` with one of the following options:
   * `f`: To find regular files (this is the most common use).
   * `d`: To find directories.
   * `l`: To find symbolic links.
   * `c`: To find character devices.
   * `b`: To find block devices.
   * And other file types as needed.
3. `-ls`: This part of the command remains the same. It instructs `find` to display detailed information about the files found in the specified format.

```
echo "base64_encoded_string" | base64 -d | xxd
```

1. `"base64_encoded_string"`: This is where users should substitute their specific Base64-encoded string that they want to decode.

Users should replace `"base64_encoded_string"` with the actual Base64-encoded string they want to decode. When they run this command with their specific value, it will decode the provided Base64 string and display the hexadecimal representation of the decoded binary data using `xxd`.

### Searching for files in bash

```
find . -ls -type f
```

### Extracting hidden info using Steghide

```
steghide extract -sf <source_image_file> -p <passphrase>
```

* `<source_image_file>`: Replace this with the path to the image file from which you want to extract hidden data (the carrier file).
* `<passphrase>`: Replace this with the passphrase or password required to extract the hidden data. Make sure you use the correct passphrase associated with the hidden data in the image.

When using the `steghide` command, replace `<source_image_file>` with the actual path to your image file and `<passphrase>` with the correct passphrase or password if one is required.

### Clearing clipboards in Linux

To clear all clipboards in Kali Linux, you can use `xclip` or `xsel` with the `-b` option, which specifies the clipboard selection. You'll need to run the commands for both the "primary" and "clipboard" selections to clear all clipboards.

Here are the commands to clear both clipboards:

Using `xclip`:

```bash
xclip -selection primary -i /dev/null
xclip -selection clipboard -i /dev/null
```

Using `xsel`:

```bash
xsel --primary --input < /dev/null
xsel --clipboard --input < /dev/null
```

Using xclipboard

```
xclip -i /dev/null
```

### Open a file in Nano with line wrapping enabled

```
nano -w filename
```

### Looking for files owned by a certain user

```
find / -user shaun -ls 2>/dev/null
```
