Sunday, May 17, 2015

UNIX Gem 3: How to display, segreggate file types:


We have several types of files in a directory (txt,pdf,.pl,.c etc) and we want UNIX to seggregate the file based on their types. How can we achieve this. UNIX has a command file. If we want to display the file type for txt file, just type in
>file filename.txt
If we want to display types for entire files:
file *
If we want to display set of files:
file file1 file 2 file 3
sample output:
file *
sound:                   directory
speech-dispatcher:       directory
ssh:                     directory
ssl:                     directory
sudoers:                 regular file, no read permission
sudoers.d:               directory
sysctl.conf:             ASCII English text
sysctl.d:                directory
systemd:                 directory
terminfo:                directory
thunderbird:             directory
timezone:                ASCII text
ts.conf:                 ASCII text
ucf.conf:                ASCII English text
udev:                    directory
ufw:                     directory
updatedb.conf:           ASCII text
update-manager:          directory

No comments:

Post a Comment