Forum: PC-Programmierung Zeichenfolge in Dateien suchen


von Hänschen (Gast)


Lesenswert?

Hi

Ich möchte auf meinem NAS (Synology 411+, Linux basierend) Dateien 
suchen, die eine bestimmte Zeichenfolge enthalten (In der Datei selbst, 
nicht im Namen). Wie kann ich das am besten anstellen?

von Rufus Τ. F. (rufus) Benutzerseite


Lesenswert?

Wenn Du über das Netzwerk auf das Ding zugreifst, dann kannst Du die 
Bordmittel des von Dir verwendeten Betriebssystemes verwenden; unter 
Windows wären das die Kommandozeilenbefehle
find
bzw.
findstr.

Wenn Du das NAS selbst dazu bringen willst, zu suchen, brauchst Du einen 
Shell-Zugang zum NAS und kannst dann die korrespondierenden 
Linux-Kommandos verwenden.

von Tobi (Gast)


Lesenswert?

Moin,

grep -r 'Tobi' .

sucht im aktuellen Verzeichnis (unter darunter) in allen Dateien nach 
der Zeichenkette Tobi.

Gruss,
Tobi

von Hänschen (Gast)


Lesenswert?

hab nun mit grep eine Suche gestartet, Ausgabe der Ergebnise in einer 
Datei. Dort stehen auch mittlerweile ein paar Resultate drin. Allerdings 
weiß ich nicht, ob der Suchprozess noch läuft. Die HD Leds auf dem NAS 
blinken zur Zeit nicht mehr, eine Abfrage mit ps bringt aber folgendes:

 6416 root      8056 S N  /usr/syno/sbin/synomkflvd
 6484 root     60376 S    /usr/syno/sbin/dms
 6485 root     60376 S    /usr/syno/sbin/dms
 6487 root     60376 S    /usr/syno/sbin/dms
 6488 root     60376 S    /usr/syno/sbin/dms
 6489 root     60376 S    /usr/syno/sbin/dms
 6491 root     60376 S    /usr/syno/sbin/dms
 6492 root     60376 S    /usr/syno/sbin/dms
 6512 root      4244 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 6547 root      4240 S    /usr/syno/apache/bin/httpd
 6559 nobody    4240 S    /usr/syno/apache/bin/httpd
 6560 nobody    4420 S    /usr/syno/apache/bin/httpd
 6561 nobody    4240 S    /usr/syno/apache/bin/httpd
 6642 root      8564 S    /usr/syno/sbin/ftpd -D
 6649 root      6768 S    /usr/syno/sbin/cnid_metad
 6655 root     13324 S    /usr/syno/sbin/afpd -c 256 -g guest -n Server 
AFPSer
 6665 admin    33688 S    postgres: admin mediaserver [local] idle
 6666 admin    33404 S    postgres: admin mediaserver [local] idle
 8216 nobody    4372 S    /usr/syno/apache/bin/httpd
 8217 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8225 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8226 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8264 root      4652 S    /usr/sbin/inetd
 8280 admin     2484 R    grep -i -r -o kenox @eaDir Data Media 
Partition_back
 8309 admin    33404 S    postgres: admin mediaserver [local] idle
 8336 root      4424 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8348 root      4424 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8571 root     18424 S    /usr/syno/sbin/smbd -D
 8574 root         0 SW   [flush-9:2]
 8575 root      2444 S    telnetd
 8578 admin     4656 S    -sh
 8579 root         0 SW   [flush-9:0]
 8583 admin     4656 R    ps
Server> ps
  PID USER       VSZ STAT COMMAND
    1 root      2440 S    init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [migration/0]
    4 root         0 SW   [ksoftirqd/0]
    5 root         0 SW   [migration/1]
    6 root         0 SW   [ksoftirqd/1]
    7 root         0 SW   [migration/2]
    8 root         0 SW   [ksoftirqd/2]
    9 root         0 SW   [migration/3]
   10 root         0 SW   [ksoftirqd/3]
   11 root         0 SW   [events/0]
   12 root         0 SW   [events/1]
   13 root         0 SW   [events/2]
   14 root         0 SW   [events/3]
   15 root         0 SW   [khelper]
   20 root         0 SW   [async/mgr]
  112 root         0 SW   [sync_supers]
  114 root         0 SW   [bdi-default]
  115 root         0 SW   [kintegrityd/0]
  116 root         0 SW   [kintegrityd/1]
  117 root         0 SW   [kintegrityd/2]
  118 root         0 SW   [kintegrityd/3]
  119 root         0 SW   [kblockd/0]
  120 root         0 SW   [kblockd/1]
  121 root         0 SW   [kblockd/2]
  122 root         0 SW   [kblockd/3]
  123 root         0 SW   [kacpid]
  124 root         0 SW   [kacpi_notify]
  125 root         0 SW   [kacpi_hotplug]
  233 root         0 SW   [ata/0]
  234 root         0 SW   [ata/1]
  235 root         0 SW   [ata/2]
  236 root         0 SW   [ata/3]
  237 root         0 SW   [ata_aux]
  239 root         0 SW   [kseriod]
  278 root         0 SW   [rpciod/0]
  279 root         0 SW   [rpciod/1]
  280 root         0 SW   [rpciod/2]
  281 root         0 SW   [rpciod/3]
  325 root         0 SW   [kswapd0]
  326 root         0 SW   [nfsiod]
  970 root         0 SW   [scsi_eh_0]
  972 root         0 SW   [scsi_eh_1]
  974 root         0 SW   [scsi_eh_2]
  976 root         0 SW   [scsi_eh_3]
  978 root         0 SW   [scsi_eh_4]
  980 root         0 SW   [scsi_eh_5]
 1021 root         0 SW   [scsi_eh_6]
 1053 root         0 SW   [kstriped]
 1062 root         0 SW   [md0_raid1]
 1068 root         0 SW   [md1_raid1]
 1178 root         0 SW   [jbd2/md0-8]
 1179 root         0 SW   [ext4-dio-unwrit]
 1180 root         0 SW   [ext4-dio-unwrit]
 1181 root         0 SW   [ext4-dio-unwrit]
 1182 root         0 SW   [ext4-dio-unwrit]
 2176 root         0 SW   [ksuspend_usbd]
 2195 root         0 SW   [khubd]
 2227 root         0 SW   [ksnapd]
 2251 root         0 SW   [crypto/0]
 2252 root         0 SW   [crypto/1]
 2253 root         0 SW   [crypto/2]
 2254 root         0 SW   [crypto/3]
 2395 root         0 SW   [ecryptfs-kthrea]
 2523 root      2440 S    /sbin/syslogd -S
 2525 root      2440 S    /sbin/klogd
 3589 root         0 SW   [md2_raid5]
 3734 root     10664 S <  /usr/syno/bin/findhostd
 3754 root         0 SW   [jbd2/md2-8]
 3755 root         0 SW   [ext4-dio-unwrit]
 3756 root         0 SW   [ext4-dio-unwrit]
 3757 root         0 SW   [ext4-dio-unwrit]
 3758 root         0 SW   [ext4-dio-unwrit]
 3961 root      2236 S    avahi-daemon: running [Server.local]
 3978 admin    32700 S    /usr/syno/pgsql/bin/postgres -D 
/var/services/pgsql
 3983 admin    32824 S    postgres: writer process
 3984 admin    32700 S    postgres: wal writer process
 4144 root      9712 S    /usr/syno/sbin/hotplugd
 4168 root      4652 S    /usr/sbin/crond
 4284 root      7332 S    /usr/syno/bin/scemd
 5386 root         0 SW   [scsi_eh_7]
 5401 root         0 SW   [usb-storage]
 5539 root         0 SW   [usbhid_resumer]
 5744 root      2444 S    /sbin/getty 115200 console
 5843 root      2964 S    /usr/syno/sbin/cupsd -C 
/usr/local/cups/cupsd.conf
 5885 root     14848 S    /usr/syno/sbin/fileindexd
 5896 root     23196 S N  /usr/syno/sbin/synoindexd
 5901 root      8060 S N  /usr/syno/bin/synomkthumbd
 5967 root     13844 S    /usr/syno/sbin/nmbd -D
 6333 root     18248 S    /usr/syno/sbin/smbd -D
 6335 root     18248 S    /usr/syno/sbin/smbd -D
 6400 root      5952 S    /usr/syno/sbin/atalkd
 6404 root     60376 S    /usr/syno/sbin/dms
 6409 root      8412 S    /usr/syno/sbin/lighttpd -f 
/usr/syno/mediaserver/lig
 6416 root      8056 S N  /usr/syno/sbin/synomkflvd
 6484 root     60376 S    /usr/syno/sbin/dms
 6485 root     60376 S    /usr/syno/sbin/dms
 6487 root     60376 S    /usr/syno/sbin/dms
 6488 root     60376 S    /usr/syno/sbin/dms
 6489 root     60376 S    /usr/syno/sbin/dms
 6491 root     60376 S    /usr/syno/sbin/dms
 6492 root     60376 S    /usr/syno/sbin/dms
 6512 root      4244 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 6547 root      4240 S    /usr/syno/apache/bin/httpd
 6559 nobody    4240 S    /usr/syno/apache/bin/httpd
 6560 nobody    4420 S    /usr/syno/apache/bin/httpd
 6561 nobody    4240 S    /usr/syno/apache/bin/httpd
 6642 root      8564 S    /usr/syno/sbin/ftpd -D
 6649 root      6768 S    /usr/syno/sbin/cnid_metad
 6655 root     13324 S    /usr/syno/sbin/afpd -c 256 -g guest -n Server 
AFPSer
 6665 admin    33688 S    postgres: admin mediaserver [local] idle
 6666 admin    33404 S    postgres: admin mediaserver [local] idle
 8216 nobody    4372 S    /usr/syno/apache/bin/httpd
 8217 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8225 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8226 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8264 root      4652 S    /usr/sbin/inetd
 8280 admin     2484 R    grep -i -r -o kenox @eaDir Data Media 
Partition_back
 8336 root      4424 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8348 root      4424 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8571 root     18816 S    /usr/syno/sbin/smbd -D
 8575 root      2444 S    telnetd
 8578 admin     4656 S    -sh
 8603 admin    33772 S    postgres: admin mediaserver [local] idle
 8658 root         0 SW   [flush-9:0]
 8659 root         0 SW   [flush-9:2]
 8665 admin     4656 R    ps
Server> htop
-sh: htop: not found
Server> yum
-sh: yum: not found
Server> install htop
-sh: install: not found
Server> apt-get install htop
-sh: apt-get: not found
Server> ps
  PID USER       VSZ STAT COMMAND
    1 root      2440 S    init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [migration/0]
    4 root         0 SW   [ksoftirqd/0]
    5 root         0 SW   [migration/1]
    6 root         0 SW   [ksoftirqd/1]
    7 root         0 SW   [migration/2]
    8 root         0 SW   [ksoftirqd/2]
    9 root         0 SW   [migration/3]
   10 root         0 SW   [ksoftirqd/3]
   11 root         0 SW   [events/0]
   12 root         0 SW   [events/1]
   13 root         0 SW   [events/2]
   14 root         0 SW   [events/3]
   15 root         0 SW   [khelper]
   20 root         0 SW   [async/mgr]
  112 root         0 SW   [sync_supers]
  114 root         0 SW   [bdi-default]
  115 root         0 SW   [kintegrityd/0]
  116 root         0 SW   [kintegrityd/1]
  117 root         0 SW   [kintegrityd/2]
  118 root         0 SW   [kintegrityd/3]
  119 root         0 SW   [kblockd/0]
  120 root         0 SW   [kblockd/1]
  121 root         0 SW   [kblockd/2]
  122 root         0 SW   [kblockd/3]
  123 root         0 SW   [kacpid]
  124 root         0 SW   [kacpi_notify]
  125 root         0 SW   [kacpi_hotplug]
  233 root         0 SW   [ata/0]
  234 root         0 SW   [ata/1]
  235 root         0 SW   [ata/2]
  236 root         0 SW   [ata/3]
  237 root         0 SW   [ata_aux]
  239 root         0 SW   [kseriod]
  278 root         0 SW   [rpciod/0]
  279 root         0 SW   [rpciod/1]
  280 root         0 SW   [rpciod/2]
  281 root         0 SW   [rpciod/3]
  325 root         0 SW   [kswapd0]
  326 root         0 SW   [nfsiod]
  970 root         0 SW   [scsi_eh_0]
  972 root         0 SW   [scsi_eh_1]
  974 root         0 SW   [scsi_eh_2]
  976 root         0 SW   [scsi_eh_3]
  978 root         0 SW   [scsi_eh_4]
  980 root         0 SW   [scsi_eh_5]
 1021 root         0 SW   [scsi_eh_6]
 1053 root         0 SW   [kstriped]
 1062 root         0 SW   [md0_raid1]
 1068 root         0 SW   [md1_raid1]
 1178 root         0 SW   [jbd2/md0-8]
 1179 root         0 SW   [ext4-dio-unwrit]
 1180 root         0 SW   [ext4-dio-unwrit]
 1181 root         0 SW   [ext4-dio-unwrit]
 1182 root         0 SW   [ext4-dio-unwrit]
 2176 root         0 SW   [ksuspend_usbd]
 2195 root         0 SW   [khubd]
 2227 root         0 SW   [ksnapd]
 2251 root         0 SW   [crypto/0]
 2252 root         0 SW   [crypto/1]
 2253 root         0 SW   [crypto/2]
 2254 root         0 SW   [crypto/3]
 2395 root         0 SW   [ecryptfs-kthrea]
 2523 root      2440 S    /sbin/syslogd -S
 2525 root      2440 S    /sbin/klogd
 3589 root         0 SW   [md2_raid5]
 3734 root     10664 S <  /usr/syno/bin/findhostd
 3754 root         0 SW   [jbd2/md2-8]
 3755 root         0 SW   [ext4-dio-unwrit]
 3756 root         0 SW   [ext4-dio-unwrit]
 3757 root         0 SW   [ext4-dio-unwrit]
 3758 root         0 SW   [ext4-dio-unwrit]
 3961 root      2236 S    avahi-daemon: running [Server.local]
 3978 admin    32700 S    /usr/syno/pgsql/bin/postgres -D 
/var/services/pgsql
 3983 admin    32824 S    postgres: writer process
 3984 admin    32700 S    postgres: wal writer process
 4144 root      9712 S    /usr/syno/sbin/hotplugd
 4168 root      4652 S    /usr/sbin/crond
 4284 root      7332 S    /usr/syno/bin/scemd
 5386 root         0 SW   [scsi_eh_7]
 5401 root         0 SW   [usb-storage]
 5539 root         0 SW   [usbhid_resumer]
 5744 root      2444 S    /sbin/getty 115200 console
 5843 root      2964 S    /usr/syno/sbin/cupsd -C 
/usr/local/cups/cupsd.conf
 5885 root     14848 S    /usr/syno/sbin/fileindexd
 5896 root     23196 S N  /usr/syno/sbin/synoindexd
 5901 root      8060 S N  /usr/syno/bin/synomkthumbd
 5967 root     13844 S    /usr/syno/sbin/nmbd -D
 6333 root     18248 S    /usr/syno/sbin/smbd -D
 6335 root     18248 S    /usr/syno/sbin/smbd -D
 6400 root      5952 S    /usr/syno/sbin/atalkd
 6404 root     60376 S    /usr/syno/sbin/dms
 6409 root      8412 S    /usr/syno/sbin/lighttpd -f 
/usr/syno/mediaserver/lig
 6416 root      8056 S N  /usr/syno/sbin/synomkflvd
 6484 root     60376 S    /usr/syno/sbin/dms
 6485 root     60376 S    /usr/syno/sbin/dms
 6487 root     60376 S    /usr/syno/sbin/dms
 6488 root     60376 S    /usr/syno/sbin/dms
 6489 root     60376 S    /usr/syno/sbin/dms
 6491 root     60376 S    /usr/syno/sbin/dms
 6492 root     60376 S    /usr/syno/sbin/dms
 6512 root      4244 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 6547 root      4240 S    /usr/syno/apache/bin/httpd
 6559 nobody    4240 S    /usr/syno/apache/bin/httpd
 6560 nobody    4420 S    /usr/syno/apache/bin/httpd
 6561 nobody    4240 S    /usr/syno/apache/bin/httpd
 6642 root      8564 S    /usr/syno/sbin/ftpd -D
 6649 root      6768 S    /usr/syno/sbin/cnid_metad
 6655 root     13324 S    /usr/syno/sbin/afpd -c 256 -g guest -n Server 
AFPSer
 6665 admin    33688 S    postgres: admin mediaserver [local] idle
 6666 admin    33404 S    postgres: admin mediaserver [local] idle
 8216 nobody    4372 S    /usr/syno/apache/bin/httpd
 8217 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8225 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8226 root      4684 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8264 root      4652 S    /usr/sbin/inetd
 8280 admin     2484 R    grep -i -r -o suchbegriff @eaDir Main
 8336 root      4424 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8348 root      4424 S    /usr/syno/apache/bin/httpd -f 
/usr/syno/apache/conf/
 8571 root     18816 S    /usr/syno/sbin/smbd -D
 8575 root      2444 S    telnetd
 8578 admin     4656 S    -sh
 8603 admin    33772 S    postgres: admin mediaserver [local] idle
 8658 root         0 SW   [flush-9:0]
 8659 root         0 SW   [flush-9:2]
 8666 admin     4656 R    ps
Server>


laut dem müsste der Task aber noch laufen. Kann er aber blockiert sein? 
Wie kann ich das überprüfen?

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.