{"id":68,"date":"2010-01-06T16:03:47","date_gmt":"2010-01-06T15:03:47","guid":{"rendered":"https:\/\/caipirinha.spdns.org\/wp\/?p=68"},"modified":"2019-09-02T23:41:13","modified_gmt":"2019-09-02T21:41:13","slug":"nuetzliche-befehle","status":"publish","type":"post","link":"https:\/\/caipirinha.spdns.org\/wp\/?p=68","title":{"rendered":"N\u00fctzliche Befehle"},"content":{"rendered":"\n<p>Auf dieser Seite gibt es eine Liste verschiedener Unix-Befehle samt Optionen, die ich immer mal wieder ben\u00f6tige.\n<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Doppelte Dateien finden<\/h2>\n\n\n\n<p>So sucht man doppelte Dateien in einem Verzeichnis (hier im Beispiel: \/home\/tmp):\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">find \/home\/tmp -not -type l -exec md5sum {} 2>\/dev\/null \\; | sort | uniq -w32 -D --all-repeated=separate | cut -c35-<\/pre>\n\n\n\n<p>Werden doppelte Dateien gefunden, erh\u00e4lt man solche Treffer:\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/home\/tmp\/Gesichter.ppt\n\/home\/tmp\/Rostos.ppt\n\n\/home\/tmp\/Gedanken_des_Tages.pps\n\/home\/tmp\/PensamentosdoDia.pps<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Offene Ports<\/h2>\n\n\n\n<p>Offene Ports und die zugeh\u00f6rigen Programme kann man mit diesem Befehl finden:\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">lsof -i4 -n -P<\/pre>\n\n\n\n<p>Damit beschr\u00e4nkt man sich allerdings auf das IP-Protokoll in der \nVersion 4. Au\u00dferdem werden Rechnernamen und Portnummern nicht aufgel\u00f6st,\n sondern nur numerisch dargestellt. Man erh\u00e4lt dann beispielsweise diese\n Ausgabe:\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">COMMAND     PID      USER   FD   TYPE  DEVICE SIZE\/OFF NODE NAME\nportmap    3040       bin    4u  IPv4    8673      0t0  UDP *:111\nportmap    3040       bin    5u  IPv4    8679      0t0  TCP *:111 (LISTEN)\nnmbd       3182      root    7u  IPv4    9161      0t0  UDP *:137\nnmbd       3182      root    8u  IPv4    9162      0t0  UDP *:138\nnmbd       3182      root    9u  IPv4    9164      0t0  UDP 192.168.2.2:137\nnmbd       3182      root   10u  IPv4    9165      0t0  UDP 192.168.2.2:138\napcupsd    3186      root    5u  IPv4    9956      0t0  TCP *:3551 (LISTEN)\navahi-dae  3332     avahi   13u  IPv4    9825      0t0  UDP *:5353\navahi-dae  3332     avahi   14u  IPv4    9826      0t0  UDP *:47151\ncupsd      3448      root    2u  IPv4   10227      0t0  TCP *:631 (LISTEN)\nclamd      3492     vscan    4u  IPv4   10117      0t0  TCP 127.0.0.1:3310 (LISTEN)\nmysqld-ma  3561     mysql   11u  IPv4   10232      0t0  TCP *:3306 (LISTEN)\namavisd    3606     vscan    7u  IPv4   10316      0t0  TCP 127.0.0.1:10024 (LISTEN)\npptpd      3723      root    6u  IPv4   10707      0t0  TCP *:1723 (LISTEN)\npure-ftpd  3738      root    4u  IPv4   10739      0t0  TCP *:21 (LISTEN)\namavisd    3791     vscan    7u  IPv4   10316      0t0  TCP 127.0.0.1:10024 (LISTEN)\namavisd    3792     vscan    7u  IPv4   10316      0t0  TCP 127.0.0.1:10024 (LISTEN)\nsshd       3794      root    4u  IPv4   11048      0t0  TCP *:22 (LISTEN)\nfamd       3852 mailowner    3u  IPv4   11257      0t0  TCP 127.0.0.1:636 (LISTEN)\nmaster     3906      root   11u  IPv4   11499      0t0  TCP *:25 (LISTEN)\nmaster     3906      root  106u  IPv4   11642      0t0  TCP 127.0.0.1:10025 (LISTEN)\nvlc        3979    wwwrun    5u  IPv4 2075026      0t0  TCP *:4212 (LISTEN)\nsnmptrapd  4168      root    9u  IPv4   13963      0t0  UDP *:162\nsshd       6397      root    3u  IPv4 3527486      0t0  TCP 192.168.2.2:22->213.61.59.222:3940 (ESTABLISHED)\nsshd       6550      root    3u  IPv4 3528133      0t0  TCP 192.168.2.2:22->213.61.59.222:27817 (ESTABLISHED)\nsshd       6550      root    6u  IPv4 3528205      0t0  TCP 127.0.0.1:6010 (LISTEN)\nsshd       6738      root    3u  IPv4 3529868      0t0  TCP 192.168.2.2:22->213.61.59.222:45180 (ESTABLISHED)\nsshd       6738      root    6u  IPv4 3529942      0t0  TCP 127.0.0.1:6011 (LISTEN)\nsshd       7465      root    3r  IPv4 3556103      0t0  TCP 192.168.2.2:22->213.61.59.222:37268 (ESTABLISHED)\nsshd       7465      root    6u  IPv4 3556173      0t0  TCP 127.0.0.1:6013 (LISTEN)\nmrtg      11646    wwwrun    4u  IPv4 3560096      0t0  UDP *:33150\nsnmpd     14786      root    7u  IPv4 3498190      0t0  TCP 127.0.0.1:199 (LISTEN)\nsnmpd     14786      root    8u  IPv4 3498188      0t0  UDP *:45681\nsnmpd     14786      root    9u  IPv4 3498191      0t0  UDP *:161\nsshd      24534      root    3r  IPv4 3550583      0t0  TCP 192.168.2.2:22->213.61.59.222:12882 (ESTABLISHED)\nsshd      24534      root    6u  IPv4 3550658      0t0  TCP 127.0.0.1:6012 (LISTEN)\nntpd      32080       ntp   16u  IPv4 2379133      0t0  UDP *:123\nntpd      32080       ntp   20u  IPv4 2379140      0t0  UDP 127.0.0.1:123\nntpd      32080       ntp   21u  IPv4 2379141      0t0  UDP 127.0.0.2:123\nntpd      32080       ntp   22u  IPv4 2379142      0t0  UDP 192.168.2.2:123<\/pre>\n\n\n\n<p>Mit <code>lsof -i4tcp -n -P<\/code> kann man die Ausgabe auf reine TCP-Verbindungen beschr\u00e4nken, mit <code>lsof -i4udp -n -P<\/code> beschr\u00e4nkt man die Ausgabe entsprechend auf reine UDP-Verbindungen.\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Auf dieser Seite gibt es eine Liste verschiedener Unix-Befehle samt Optionen, die ich immer mal wieder ben\u00f6tige. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-68","post","type-post","status-publish","format-standard","hentry","category-it"],"_links":{"self":[{"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/68","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=68"}],"version-history":[{"count":1,"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/68\/revisions"}],"predecessor-version":[{"id":69,"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/68\/revisions\/69"}],"wp:attachment":[{"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/caipirinha.spdns.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}