- 다른 뜻에 대해서는 파일 문서를 참조하십시오.
1 개요[ | ]
- file
- /usr/bin/file
- 파일형식 확인 리눅스 명령어
- 파일의 종류를 판단하는 리눅스 명령어
- 확장자를 보고 판단하는 것이 아니라 내용을 보고 판단한다.
2 실습 1[ | ]
Console
Copy
[root@zetawiki ~]# file /etc/hosts
/etc/hosts: ASCII text
Console
Copy
[root@zetawiki ~]# file /bin/cp
/bin/cp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
Console
Copy
[root@zetawiki ~]# file /dev/console
/dev/console: character special
3 실습 2[ | ]
Console
Copy
[root@zetawiki ~]# echo 1 > 1.txt
[root@zetawiki ~]# file 1.txt
1.txt: ASCII text
Console
Copy
[root@zetawiki ~]# echo 안녕 > 2.txt
[root@zetawiki ~]# file 2.txt
2.txt: UTF-8 Unicode text
Console
Copy
[root@zetawiki ~]# echo '<?php' > 3.txt
[root@zetawiki ~]# file 3.txt
3.txt: PHP script text
Console
Copy
[root@zetawiki ~]# gzip 1.txt
[root@zetawiki ~]# file 1.txt.gz
1.txt.gz: gzip compressed data, was "1.txt", from Unix, last modified: Thu Jan 23 02:12:01 2014
Console
Copy
[root@zetawiki ~]# cp 1.txt.gz 4.txt
[root@zetawiki ~]# file 4.txt
4.txt: gzip compressed data, was "1.txt", from Unix, last modified: Thu Jan 23 02:12:01 2014