# Handige commando's

> Handige commando's en scripts die technische taken makkelijker maken, zoals logs beheren met Notepad++ en regex, of DNS-checks voor domeinen automatiseren.

- URL: https://www.allsubjectsmatter.nl/nl/useful-commands/
- Language: nl
- Published: 2023-09-11
- Updated: 2024-09-11
- Author: Remco Loup (https://www.allsubjectsmatter.nl/nl/author/remco/)
- Tags: Tech
- Original (en, written by the author): https://www.allsubjectsmatter.nl/useful-commands/
- Note: this text was translated with AI from the original.

## Notepad++ regexp

Bijvoorbeeld om je php-fpm access/slow log te controleren. Gebruik mark in Notepad++ om alle regels te markeren die trager zijn dan x/y.

```text
10000ms en trager 

^.*\s(\d{5,}\.\d{3}ms).*

5000ms en trager 

^.*\s(5\d{3}\.\d{2,}ms|\d{5,}\.\d{2,}ms).*
```

## DNS-tools om de overdracht van je DNS automatisch te controleren

```bash
sudo apt update
sudo apt install dnsutil

nano check_nameservers.sh
```

```bash
#!/bin/bash

DOMAIN="jouwdomein.com"
EXPECTED_NS1="ns1.cloudflare.com."
EXPECTED_NS2="ns2.cloudflare.com."

# Get the current nameservers
CURRENT_NS=$(dig NS $DOMAIN +short)

# Check if the current nameservers match the expected ones
if [[ $CURRENT_NS == *"$EXPECTED_NS1"* && $CURRENT_NS == *"$EXPECTED_NS2"* ]]; then
    echo "Nameservers are correctly set to Cloudflare."
else
    echo "Nameservers have not yet switched to Cloudflare."
fi
```

```bash
chmod +x check_nameservers.sh

watch -n 1 ./check_nameservers.sh
```
