리눅스 file

(File에서 넘어옴)
  다른 뜻에 대해서는 파일 문서를 참조하십시오.

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

4 같이 보기[ | ]

5 참고[ | ]

  • 리눅스 디렉토리 용량 확인 du
    "현재폴더에 있는 폴더 및 파일 중에서 용량이 큰 것 순으로 10개 보기" 에서 -hs 옵션을 주면 sort가 제대로 되지 않는다고 하셨는데 sort의 -h 옵션을 이용하면 가능합니다. (-h, --human-numeric-sort) 저는 다음과 같이 합니다. du -hs * | so
  • 리눅스 반복 예약작업 cron, crond, crontab
    타사 크론 서비스를 사용하여 자신의 서버에서 호스팅 크론을 사용하여 게다가, 당신은 타사 크론 서비스 (보통이라고 webcron)를 사용할 수 있습니다 : http://EasyCron.com - 크론 작업을 설정하는 crontab을 또는 다른 작업 스케줄러의 필요성을 제거 webcron