find 找文字檔或二進位檔

有次機會想找多個目錄下的特定的檔案,如哪些是腳本檔,哪些是可執行檔,試了一下原來是要透過 perl 再處理過

找出 /bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin 下二進位檔案
# find /bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin -type f | perl -lne 'print if  -B'
找出 /bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin 下二進位檔案
# find /bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin -type f | perl -lne 'print if  -T'


# find /bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin -type f | perl -lne 'print if  not -B'

 

 

Author: jerryw1974

learning and focus on computer science, cloud infrastructure, virtualization and information security, technical, networking,platform system and cyber-security related topic.