Ora provo con i comandi che mi hai suggerito tu, non avevo ancora provato con il grep semplicemente perchè non avrei saputo scrivere il comando altrettanto bene

Moderatore: Staff
Codice: Seleziona tutto
root@darkstar:/usr/share/applications# cd /home/matteo/Downloads/
foremost/ recup_dir.11/ recup_dir.21/ recup_dir.4/
foremost.tar.gz recup_dir.12/ recup_dir.22/ recup_dir.5/
install_flash_player_11_linux.i386.tar.gz recup_dir.13/ recup_dir.23/ recup_dir.6/
java.SlackBuild recup_dir.14/ recup_dir.24/ recup_dir.7/
java.SlackBuild~ recup_dir.15/ recup_dir.25/ recup_dir.8/
jre-7u21-linux-i586.tar.gz recup_dir.16/ recup_dir.26/ recup_dir.9/
lyx-2.0.5.1-i486-1sl.txz recup_dir.17/ recup_dir.27/ rk_free.exe
make-pam-solibs-for-chrome.sh recup_dir.18/ recup_dir.28/ testdisk-6.14-WIP.linux26.tar.bz2
make-pam-solibs-for-chrome.sh ~ recup_dir.19/ recup_dir.29/
recup_dir.1/ recup_dir.2/ recup_dir.3/
recup_dir.10/ recup_dir.20/ recup_dir.30/
root@darkstar:/usr/share/applications# cd /home/matteo/Downloads/
root@darkstar:/home/matteo/Downloads# find ./ -exec file "{}" \;|grep LyX
root@darkstar:/home/matteo/Downloads#
Codice: Seleziona tutto
bash-4.2# fidentify /home/matteo/f76836140.lyx
/home/matteo/f76836140.lyx: java
Codice: Seleziona tutto
lyx 0 "lyx file"
peccato che non mi dicano come farlo...If the file is identified with an incorrect extension, check if there is way to differentiate this file from files having the extension that has been found
Codice: Seleziona tutto
/home/joe/tmp/filetypes//fff/drawing.eps: eps
/home/joe/tmp/filetypes//fff/lyxguide.lyx: lyx
/home/joe/tmp/filetypes//fff/demoarticle.lyx: lyx
/home/joe/tmp/filetypes//fff/essential.tex: tex
/home/joe/tmp/filetypes//fff/latexintro.pdf: pdf
/home/joe/tmp/filetypes//fff/demoarticle.ps: ps
/home/joe/tmp/filetypes//fff/Makefile: txt
/home/joe/tmp/filetypes//fff/demoarticle.tex: java
/home/joe/tmp/filetypes//fff/personal.bind: txt
/home/joe/tmp/filetypes//fff/demo.bib: txt
/home/joe/tmp/filetypes//ddd: lyx
/home/joe/tmp/filetypes//bbb: unknown
/home/joe/tmp/filetypes//aaa: mp3
/home/joe/tmp/filetypes//ggg: tar.gz
/home/joe/tmp/filetypes//ccc: pdf
Codice: Seleziona tutto
file /home/matteo/f76836140.lyx
Codice: Seleziona tutto
bash-4.2$ hexdump -C /home/joe/tmp/filetypes/ddd|head -n3
00000000 23 4c 79 58 20 31 2e 33 20 63 72 65 61 74 65 64 |#LyX 1.3 created|
00000010 20 74 68 69 73 20 66 69 6c 65 2e 20 46 6f 72 20 | this file. For |
00000020 6d 6f 72 65 20 69 6e 66 6f 20 73 65 65 20 68 74 |more info see ht|
bash-4.2$ hexdump -C /home/joe/tmp/filetypes//fff/lyxguide.lyx|head -n3
00000000 23 4c 79 58 20 31 2e 33 20 63 72 65 61 74 65 64 |#LyX 1.3 created|
00000010 20 74 68 69 73 20 66 69 6c 65 2e 20 46 6f 72 20 | this file. For |
00000020 6d 6f 72 65 20 69 6e 66 6f 20 73 65 65 20 68 74 |more info see ht|
bash-4.2$ hexdump -C /home/joe/tmp/filetypes//fff/demoarticle.lyx|head -n3
00000000 23 4c 79 58 20 31 2e 32 20 63 72 65 61 74 65 64 |#LyX 1.2 created|
00000010 20 74 68 69 73 20 66 69 6c 65 2e 20 46 6f 72 20 | this file. For |
00000020 6d 6f 72 65 20 69 6e 66 6f 20 73 65 65 20 68 74 |more info see ht|
Codice: Seleziona tutto
#LyX 1.2 created
Codice: Seleziona tutto
#LyX 1.3 created
Codice: Seleziona tutto
lyx 0 "#LyX 1."
Codice: Seleziona tutto
bash-4.2$ photorec -v
PhotoRec 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Version: 6.13
Compiler: GCC 4.7
Compilation date: 2013-03-02T19:13:47
ext2fs lib: 1.42.6, ntfs lib: libntfs-3g, ewf lib: none, libjpeg: 80
OS: Linux, kernel 3.2.29-smp (#2 SMP Mon Sep 17 13:16:43 CDT 2012) i686
Codice: Seleziona tutto
root@darkstar:/home/matteo# rm .photorec.sig
root@darkstar:/home/matteo# file newfile1.lyx
newfile1.lyx: LyX document text
root@darkstar:/home/matteo# fidentify newfile1.lyx
newfile1.lyx: java
root@darkstar:/home/matteo# file /home/matteo/f76836140.lyx
/home/matteo/f76836140.lyx: LyX document text
root@darkstar:/home/matteo# fidentify /home/matteo/f76836140.lyx
/home/matteo/f76836140.lyx: java
Codice: Seleziona tutto
root@darkstar:/home/matteo# photorec -v
PhotoRec 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Version: 6.13
Compiler: GCC 4.7
Compilation date: 2013-05-05T03:25:19
ext2fs lib: 1.42.6, ntfs lib: libntfs-3g, ewf lib: none, libjpeg: 80
OS: Linux, kernel 3.2.29-smp (#2 SMP Mon Sep 17 13:16:43 CDT 2012) i686
Codice: Seleziona tutto
root@darkstar:/home/matteo# hexdump -C /home/matteo/newfile1.lyx|head -n3
00000000 23 4c 79 58 20 32 2e 30 20 63 72 65 61 74 65 64 |#LyX 2.0 created|
00000010 20 74 68 69 73 20 66 69 6c 65 2e 20 46 6f 72 20 | this file. For |
00000020 6d 6f 72 65 20 69 6e 66 6f 20 73 65 65 20 68 74 |more info see ht|
root@darkstar:/home/matteo# nano .photorec.sig
Codice: Seleziona tutto
root@darkstar:/home/matteo# cat .photorec.sig
#LyX 1.2 created
#LyX 1.3 created
#LyX 2.0 created
lyx 0 "#LyX 2."
Codice: Seleziona tutto
root@darkstar:/home/matteo# fidentify /home/matteo/newfile1.lyx
/home/matteo/newfile1.lyx: java
Codice: Seleziona tutto
$ head -n1 tmp/filetypes/ddd
#LyX 1.3 created this file.
Codice: Seleziona tutto
bash-4.2$ file Downloads/curriculum_di_paperino.lyx
Downloads/curriculum_di_paperino.lyx: LyX document text
bash-4.2$ fidentify Downloads/curriculum_di_paperino.lyx
Downloads/curriculum_di_paperino.lyx: java
bash-4.2$ hexdump -C Downloads/curriculum_di_paperino.lyx |head -n1
00000000 23 4c 79 58 20 32 2e 30 20 63 72 65 61 74 65 64 |#LyX 2.0 created|
bash-4.2$ echo 'lyx 0 "#LyX 2."' > .photorec.sig
bash-4.2$ cat .photorec.sig
lyx 0 "#LyX 2."
bash-4.2$ fidentify Downloads/curriculum_di_paperino.lyx
Downloads/curriculum_di_paperino.lyx: lyx
Codice: Seleziona tutto
bash-4.2$ echo 'lyx 0 "#LyX"' > .photorec.sig
bash-4.2$ fidentify Downloads/curriculum_di_paperino.lyx
Downloads/curriculum_di_paperino.lyx: lyx
Codice: Seleziona tutto
bash-4.2$ echo 'pippo 0 "#LyX"' > .photorec.sig
bash-4.2$ fidentify Downloads/curriculum_di_paperino.lyx
Downloads/curriculum_di_paperino.lyx: pippo
bash-4.2$ fidentify Downloads/curriculum_di_paperino.lyx
Downloads/curriculum_di_paperino.lyx: tipodifiledelcavolo
Codice: Seleziona tutto
root@darkstar:/home/matteo# echo 'lyx 0 "#LyX 2."' > .photorec.sig
root@darkstar:/home/matteo# cat .photorec.sig
lyx 0 "#LyX 2."
root@darkstar:/home/matteo# fidentify newfile1.lyx
newfile1.lyx: java
root@darkstar:/home/matteo# file newfile1.lyx
newfile1.lyx: LyX document text
root@darkstar:/home/matteo#
Codice: Seleziona tutto
root@darkstar:/home/matteo# echo 'lyx 0 "#LyX"' > .photorec.sig
root@darkstar:/home/matteo# fidentify newfile1.lyx
newfile1.lyx: java
root@darkstar:/home/matteo#
PhotoRec searches for the signature file named
...
.photorec.sig in the HOME directory, ie. /home/bob
photorec.sig in the current directory
This file doesn't exist by default, you need to create one.
Codice: Seleziona tutto
PhotoRec 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Disk /dev/sdb - 1000 GB / 931 GiB (RO) - SAMSUNG HD103SI
Partition Start End Size in sectors
1 P FAT32 LBA 0 32 33 121600 254 63 1953518017
Pass 1 - Reading sector 116526217/1953518017, 78570 files found
Elapsed time 1h40m50s - Estimated time to completion 26h29m35
jpg: 36367 recovered
txt: 20589 recovered
png: 6250 recovered
gz: 5625 recovered
gif: 3518 recovered
mp3: 2150 recovered
tx?: 1050 recovered
pdf: 943 recovered
swf: 325 recovered
bz2: 312 recovered
others: 1441 recovered
Segmentation fault
root@darkstar:/home/matteo#