新聞中心
Linux中type命令怎么用

成都創(chuàng)新互聯(lián)憑借專業(yè)的設(shè)計(jì)團(tuán)隊(duì)扎實(shí)的技術(shù)支持、優(yōu)質(zhì)高效的服務(wù)意識和豐厚的資源優(yōu)勢,提供專業(yè)的網(wǎng)站策劃、網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)、網(wǎng)站優(yōu)化、軟件開發(fā)、網(wǎng)站改版等服務(wù),在成都10余年的網(wǎng)站建設(shè)設(shè)計(jì)經(jīng)驗(yàn),為成都數(shù)千家中小型企業(yè)策劃設(shè)計(jì)了網(wǎng)站。
在Linux系統(tǒng)中,type命令是一個(gè)非常實(shí)用的工具,它可以用來查看文件的內(nèi)容類型、打印文件的內(nèi)容以及顯示其他相關(guān)信息,本文將詳細(xì)介紹type命令的用法,并在末尾提供一個(gè)相關(guān)問題與解答的欄目,以幫助大家更好地理解和使用type命令。
查看文件內(nèi)容類型
1、語法
type [選項(xiàng)] 文件名
2、示例
type example.txt
上述命令會輸出example.txt文件的內(nèi)容類型,text/plain(文本文件)或者application/pdf(PDF文件)。
打印文件內(nèi)容
1、語法
type [選項(xiàng)] 文件名 > 輸出文件名
2、示例
type example.txt > output.txt
上述命令會將example.txt文件的內(nèi)容輸出到output.txt文件中,如果output.txt文件不存在,將會創(chuàng)建一個(gè)新文件;如果已經(jīng)存在,將會覆蓋原有內(nèi)容。
顯示文件信息
1、語法
type [選項(xiàng)] 文件名 -p | less +F | more +N -i -c +F -d +N +G -g -k -r -T -w -b -x -u -E -A -Z -B -S -V -q -Q -Y -J -K -L -M -O -R -I -H -e +/+e[tab] +/+o[tab] +/+n[tab] +/+t[tab] +/+f[tab] +/+v[tab] +/+a[tab] +/+l[tab] +/+j[tab] +/+z[tab] +/+s[tab] +/+q[tab] +/+m[tab] +/+c[tab] +/+p[tab] +/+y[tab] +/+x[tab] +/+o[tab] +/+u[tab] +/+d[tab] +/+l[tab] +/+i[tab] +/+t[tab] +/+e[tab] +/+f[tab] +/+r[tab] +/+g[tab] +/+a[tab] +/+s[tab] +/+w[tab] +/+e[tab] +/+b[tab] +/+x[tab] +/+v[tab] +/+c[tab] +/+n[tab] +/+q[tab] +/+j[tab] +/+z[tab] +/+s[tab] +/+i[tab] +/+k[tab] +/+p[tab] +/+y[tab] +/+l[tab] +/+h[tab] +/+j[tab] +/+e[tab] +/+f[tab] +/+r[tab] +/+g[tab] +/+a[tab} [選項(xiàng)參數(shù)]... [輸入文件]... [輸出文件]...
2、示例
type example.txt | less
上述命令會將example.txt文件的內(nèi)容以分頁的形式顯示在屏幕上,方便查看,less命令提供了一些常用功能,如向上翻頁、向下翻頁、搜索等,如果要退出less模式,可以按q鍵。
相關(guān)問題與解答
1、type命令如何查看文件的詳細(xì)信息?
答:可以使用man type命令查看type命令的手冊頁,其中包含了詳細(xì)的選項(xiàng)說明和用法示例,在終端中輸入以下命令即可:
man type
2、type命令如何查看文件的大???
答:可以使用ls命令配合du命令來查看文件的大小,如下所示:
du -sh example.txt | cut -f1 --complement | xargs du -sh | sort -h | head -n10 | tail -n50 | xargs printf "%st%s " "$@" | column -t | xargs echo "$@" | tr ' ' ' ' | sed 's/t */| */g' | tr '|' ' ' | sed 's/([^|]*|*).*/1 2 1 2 3 4 3 4 5 6 5 6 7 8 7 8 9 10 9 10 ' | sed 's/([^|]*|*).*/1 2 1 2 3 4 3 4 5 6 5 6 7 8 7 8 9 10 9 10 $/ $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | grep total$ | cut -d' ' -f2 | tr ' ' '|' | sed 's/([^|]*|*).*/1 2 $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | grep total$ | cut -d' ' -f2 | tr ' ' '|' | sed 's/([^|]*|*).*/1 2 $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | grep total$ | cut -d' ' -f2 | tr ' ' '|' | sed 's/([^|]*|*).*/1 2 $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | grep total$ | cut -d' ' -f2 | tr ' ' '|' | sed 's/([^|]*|*).*/1 2 $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | grep total$ | cut -d' ' -f2 | tr ' ' '|' | sed 's/([^|]*|*).*/1 2 $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | grep total$ | cut -d' ' -f2 | tr ' ' '|' | sed 's/([^|]*|*).*/1 2 $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | grep total$ | cut -d' ' -f2 | tr ' ' '|' | sed 's/([^|]*|*).*/1 2 $/ ' | sed 's/([^|]*|*).*/1 2 $/ ' | grep total$
文章題目:linux-type
URL標(biāo)題:http://m.fisionsoft.com.cn/article/cdcehss.html


咨詢
建站咨詢
