linux常用命令-echo/printf/file

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux常用命令-echo/printf/file相关的知识,希望对你有一定的参考价值。

echo:显示文本

NAME
       echo - display a line of text


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


-n

[[email protected] doc]# echo -n
[[email protected] doc]# echo


[[email protected] doc]#

[[email protected] doc]# echo -n "this year is 2017,\n the day is Feb 11"
this year is 2017,\n the day is Feb 11[[email protected] doc]#



-e:文本开启转义符

[[email protected] doc]# echo "this year is 2017,\n the day is Feb 11"
this year is 2017,\n the day is Feb 11
[[email protected] 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



[[email protected] doc]# printf "this year is 2017,the day is Feb 11"
this year is 2017,the day is Feb 11[[email protected] 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:可执行链接文件

[[email protected] ~]$ 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的主要内容,如果未能解决你的问题,请参考以下文章

linux常用命令多少个

Linux文本操作常用命令

Linux部署项目常用命令

linux系统基础常用命令

Linux常用命令

Linux常用命令都有哪些?