码迷,mamicode.com
首页 > 系统相关 > 详细

linux常用命令-echo/printf/file

时间:2017-02-12 16:11:36      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:echo   file   printf   

echo:显示文本

NAME
       echo - display a line of text


SYNOPSIS
       echo [SHORT-OPTION]... [STRING]...
       echo LONG-OPTION


-n

[root@localhost doc]# echo -n
[root@localhost doc]# echo


[root@localhost doc]#

[root@localhost doc]# echo -n "this year is 2017,\n the day is Feb 11"
this year is 2017,\n the day is Feb 11[root@localhost doc]#



-e:文本开启转义符

[root@localhost doc]# echo "this year is 2017,\n the day is Feb 11"
this year is 2017,\n the day is Feb 11
[root@localhost doc]# echo -e "this year is 2017,\n the day is Feb 11"
this year is 2017,
 the day is Feb 11



printf:格式化并显示文本

PRINTF(1)                        User Commands                       PRINTF(1)


NAME
       printf - format and print data


SYNOPSIS
       printf FORMAT [ARGUMENT]...
       printf OPTION



[root@localhost doc]# printf "this year is 2017,the day is Feb 11"
this year is 2017,the day is Feb 11[root@localhost doc]#


file 判断文件类型

该命令用来识别文件类型,也可用来辨别一些文件的编码格式。它是通过查看文件的头部信息来获取文件类型,而不是像Windows通过扩展名来确定文件类型的。


NAME
     file - determine file type


SYNOPSIS
     file [-bchikLNnprsvz0] [--apple] [--mime-encoding] [--mime-type] [-e testname] [-F separator]
          [-f namefile] [-m magicfiles] file ...
     file -C [-m magicfiles]
     file [--help]


ELF:可执行链接文件

[rhel@localhost ~]$ file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped





linux常用命令-echo/printf/file

标签:echo   file   printf   

原文地址:http://f1yinsky.blog.51cto.com/12568071/1897013

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!