---
title: "我使用过的Linux命令之strings - 打印文件中的可打印字符串"
author: "codingstandards"
date: "2011-04-18T10:54:51Z"
tags: ["Blog", "HTML", "ITeye", "Linux"]
categories: ["操作系统"]
slug: "linux-strings"
draft: false
lastmod: "2011-04-18T10:55:13Z"
id: 1006118
url: "https://codingstandards.iteye.com/blog/1006118"
---

# 我使用过的Linux命令之strings - 打印文件中的可打印字符串

本文链接：[http://codingstandards.iteye.com/blog/1006118](/blog/1006118)   （转载请注明出处）

## 用途说明

打印文件中的可打印字符串（print the strings of printable characters in files）。常用来在二进制文件中查找字符串，与grep配合使用。strings命令输出的字符串是至少包含连续4个可打印字符的，这个可以通过参数来修改。

 

## 常用方式

 

## 使用示例

### 示例一

\[root@jfht ~]# strings /usr/bin/uptime  
/lib/ld-linux.so.2  
FK9{  
PTRhp  
\[^\_]  
usage: uptime \[-V]  
    -V    display version  
libproc-3.2.7.so  
\_\_gmon\_start\__  
\_Jv\_RegisterClasses  
display\_version  
print\_uptime  
libc.so.6  
\_IO\_stdin\_used  
stderr  
fwrite  
\_\_libc\_start\_main  
memset  
\_3\_2\_5  
GLIBC\_2.0  
/lib/ld-linux.so.2  
\[root@jfht ~]#

 

### 示例二

\[root@jfht ~]# strings /usr/bin/uptime | grep GLIB  
GLIBC\_2.0  
\[root@jfht ~]#

 

### 示例三

\[root@jfht ~]# strings -n 3 /usr/bin/uptime  
/lib/ld-linux.so.2  
GNU  
FK9{  
%()  
PTRhp  
QVh  
WVS  
t+1  
\[^\_]  
tZ1  
usage: uptime \[-V]  
    -V    display version  
libproc-3.2.7.so  
\_\_gmon\_start\__  
\_Jv\_RegisterClasses  
display\_version  
print\_uptime  
libc.so.6  
\_IO\_stdin\_used  
stderr  
fwrite  
\_\_libc\_start\_main  
memset  
\_3\_2\_5  
GLIBC\_2.0  
/lib/ld-linux.so.2  
\[root@jfht ~]#

 

## 问题思考

## 相关资料

【1】xiaobei的博客 linux strings命令的用法  
http://laiqingtao1984.blog.163.com/blog/static/11363446820101331952670/  
【2】飘渺的风 linux strings命令详解  
http://www.huanxiangwu.com/234/linux-strings%E5%91%BD%E4%BB%A4%E8%AF%A6%E8%A7%A3  
【3】Prayer linux命令strings  
http://www.cppblog.com/prayer/archive/2009/07/22/90836.html

 

 

返回 [我使用过的Linux命令系列总目录](/blog/786653)