Linux命令之strings:列印檔案中的可列印字串

來源:互聯網
上載者:User

Linux系統裡的命令strings,即列印檔案中的可列印字串print the strings of printable characters in files),常用來在二進位檔案中尋找字串,與grep配合使用。strings命令輸出的字串是至少包含連續4個可列印字元的,這個可以通過參數來修改。下面就通過3個使用樣本來向大家解釋一下!

使用樣本

樣本一:

  1. [root@www.linuxidc.com ~]# strings /usr/bin/uptime  
  2. /lib/ld-linux.so.2  
  3. FK9{  
  4. PTRhp  
  5. [^_]  
  6. usage: uptime [-V]  
  7. -V    display version  
  8. libproc-3.2.7.so  
  9. __gmon_start__  
  10. _Jv_RegisterClasses  
  11. display_version  
  12. print_uptime  
  13. libc.so.6  
  14. _IO_stdin_used  
  15. stderr  
  16. fwrite  
  17. __libc_start_main  
  18. memset  
  19. _3_2_5  
  20. GLIBC_2.0  
  21. /lib/ld-linux.so.2  
  22. [root@www.linuxidc.com ~]#  

樣本二:

  1. [root@www.linuxidc.com ~]# strings /usr/bin/uptime | grep GLIB  
  2. GLIBC_2.0  
  3. [root@www.linuxidc.com ~]#  

樣本三:

  1. [root@www.linuxidc.com ~]# strings -n 3 /usr/bin/uptime  
  2. /lib/ld-linux.so.2  
  3. GNU  
  4. FK9{  
  5. %()  
  6. PTRhp  
  7. QVh  
  8. WVS  
  9. t+1  
  10. [^_]  
  11. tZ1  
  12. usage: uptime [-V]  
  13. -V    display version  
  14. libproc-3.2.7.so  
  15. __gmon_start__  
  16. _Jv_RegisterClasses  
  17. display_version  
  18. print_uptime  
  19. libc.so.6  
  20. _IO_stdin_used  
  21. stderr  
  22. fwrite  
  23. __libc_start_main  
  24. memset  
  25. _3_2_5  
  26. GLIBC_2.0  
  27. /lib/ld-linux.so.2  
  28. [root@www.linuxidc.com ~]#  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.