title: “linux shell remove newline”
date: 2020-04-02T11:15:17
slug: linux-shell-remove-newline
| tr -d ‘
’
title: “linux shell remove newline”
date: 2020-04-02T11:15:17
slug: linux-shell-remove-newline
| tr -d ‘
’
title: “tcpdump”
date: 2018-05-11T13:42:39
slug: tcpdump
sudo tcpdump -i any -A -s 0 host 10.76.1.65 -n
Use the option -U in combination with -w so that tcpdump writes packets immediately.
title: “AWK – 2. Feld ausgeben, unique sortieren und Zeilen zählen”
date: 2018-04-27T09:27:55
slug: awk-2-feld-ausgeben-unique-sortieren-und-zeilen-zahlen
awk -F'#' '{print $2}' domains | sort -u | wc -l
title: “Show Top 50 open files”
date: 2016-11-18T10:36:11
slug: show-top-50-open-files
lsof -s | awk '$5 == "REG"' | sort -n -r -k 7,7 | head -n 50
title: “tar über ssh”
date: 2016-04-15T12:30:04
slug: tar-uber-ssh
Absolutes Verzeichnis
tar zcPf - /verzeichnis | ssh root@192.168.136.121 'tar zxpPf - '
title: “Security / Sicherheit”
date: 2015-04-06T20:19:50
slug: security-sicherheit
Hardening init
vi /etc/inittab
and add the line:
ss:S:respawn:/bin/sulogin
Hardening GRUB (Debian 7)
1 – Type the command: grub-mkpasswd-pbkdf2
2 – Enter the desired password
It will generate a long password encrypted like this: grub.pbkdf2.sha512.10000.FC58373BCA15A797C418C1EA7FFB007BF5A5
3 – Copy the complete generated code.
4 – Edit the file: /etc/grub.d/40_custom
5 – At the end of the file add the following commands:
set superusers=”username”
password_pbkdf2 username password
Obviously you should replace the words “username” with your desired user name, and the word password for the encrypted password generated in the previous step.
For example, if your desired username is John, and the password is grub.pbkdf2.sha512.10000.FC58373BCA15A797C418C1EA7FFB007BF5A5 your full code will look like this:
set superusers=”John”
password_pbkdf2 John grub.pbkdf2.sha512.10000.FC58373BCA15A797C418C1EA7FFB007BF5A5
6 – Save the file and exit.
7 – Finally, type the command: update-grub
title: “DNS Konfiguration (client)”
date: 2015-04-06T20:05:36
slug: dns-konfiguration-client
/etc/nsswitch.conf
Beispielzeile:
hosts: dns [NOTFOUND=return] files
Zuerst Abrage des DNS Servers. Wenn der DNS Server angefragt werden kann, aber die Zone nicht auflösen kann,
gibt die Abfrage einen Fehler zurück. Das local file (/etc/hosts) wird nur abgefragt wenn der DNS Server nicht erreichbar ist.
Sample /etc/resolv.conf
search example.com
nameserver 192.168.1.254
nameserver 24.215.7.126
options timeout:2
title: “lsof – list open files”
date: 2015-04-06T19:48:42
slug: lsof-list-open-files
Listed alle Netzwerkdienste und Verbindungen (Ausgabe:COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME)
lsof -i
title: “netstat”
date: 2015-04-06T19:42:13
slug: netstat
Zeigt Ports an auf denen ein Dienst läuft
netstat -ant
Interface mit Statistik anzeigen (RX-OK RX-ERR RX-DRP RX-OVR,…)
netstat -i
Aktive Ethernetverbindungen anzeigen (State: ESTABLISHED):
netstat -t
Aktive UDP Endpunkte anzeigen
netstat -u
title: “Routing”
date: 2015-04-06T19:24:58
slug: routing
Das Netzwerk 10.0.0.0 über eth1 und über das Gateway 192.168.1.108 routen.
route add -net 10.0.0.0 gw 192.168.1.108 dev eth1
Ein Defaultgateway hinzufügen
route add default gw 192.168.1.1 eth0