• <output id="aynwq"><form id="aynwq"><code id="aynwq"></code></form></output>

    <mark id="aynwq"><option id="aynwq"></option></mark>
  • <mark id="aynwq"><option id="aynwq"></option></mark><label id="aynwq"><dl id="aynwq"></dl></label>
  • 學習啦 > 學習電腦 > 操作系統 > Linux教程 > Linux命令more/less文件和目錄管理

    Linux命令more/less文件和目錄管理

    時間: 志藝942 分享

    Linux命令more/less文件和目錄管理

      使用 cat 命令查看文件時,如果文件有很多內容,會出現滾屏現象,這時可以使用 more 或者 less 命令來查看,more 和 less 可以單獨使用,也可以和其他命令組合使用。接下來是小編為大家收集的Linux 命令more/less文件和目錄管理,歡迎大家閱讀:

      Linux 命令more/less文件和目錄管理

      more 是 一個過濾器,用于分頁顯示(一次一屏)文本。

      命令選項

      交互式命令

      more 的交互命令基于 vi,有些命令以一個十進制數字開始,在下面的描述里稱之為 k。后面的描述中,^X 指 control-X。

      h 或 ?:幫助,顯示這些命令的摘要,如果忘掉所有其他的命令, 請記住這個。 SPACE :顯示接下來的 k 行文本,缺省值是當前的屏幕大小。 z:顯示接下來的 k 行文本,缺省值是當前的屏幕大小,參數成為新的缺省值。 RETURN:顯示接下來的 k 行文本,缺省值是 1,參數成為新的缺省值。 d 或 ^D:卷屏 k 行,缺省值是當前的卷屏大小,初始化為 11,參數成為新的缺省值。 q 或 Q 或 INTERRUPT:退出 more 命令 s:向前跳過 k 行文本,缺省值是 1。 f:向前跳過 k 屏文本,缺省值是 1。 b 或 ^B:向后跳回 k 屏文本,缺省值是 1。 ':跳到上一次搜索開始的地方。 =:顯示當前行號 /pattern:搜索第 k 個 符合正則表達式的文本串,缺省值是 1。 n:搜索最后第 k 個符合正則表達式的文本串,缺省值是 1。 ! 或 :!:在子 shell 中執行 。 v:啟動 /usr/bin/vi,指向當前行。 ^L:刷新屏幕。 :n:跳到后面第 k 個文件,缺省值是 1。 :p:跳到前面第 k 個文件,缺省值是 1。 :f:顯示當前文件名和行號。 .:重復上次命令。

      more 命令一次顯示一屏文本,滿屏后停下來,并且在屏幕的底部出現一個提示信息,給出至今己顯示的該文件的百分比:--More--(XX%),可以用上述命令進行交互。

      使用范例

      1.查看文件內容

      查看一個關于 Python 安裝包中的 README 文件,由于文件內容過多,使用 more README 來分頁顯示。

      [root@localhost Python-3.5.2]# more README

      This is Python version 3.5.2

      ============================

      Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,

      2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved.

      Python 3.x is a new version of the language, which is incompatible with the

      2.x line of releases. The language is mostly the same, but many details,

      especially how built-in objects like dictionaries and strings work,

      have changed considerably, and a lot of deprecated features have finally

      been removed.

      Build Instructions

      ------------------

      On Unix, Linux, BSD, OSX, and Cygwin:

      ./configure

      make

      make test

      sudo make install

      This will install Python as python3.

      You can pass many options to the configure script; run "./configure --help" to

      find out more. On OSX and Cygwin, the executable is called python.exe;

      elsewhere it's just python.

      On Mac OS X, if you have configured Python with --enable-framework, you should

      use "make frameworkinstall" to do the installation. Note that this installs

      the Python executable in a place that is not normally on your PATH, you may

      want to set up a symlink in /usr/local/bin.

      On Windows, see PCbuild/readme.txt.

      If you wish, you can create a subdirectory and invoke configure from there.

      For example:

      --More--(15%)

      可以看到,屏幕的底部出現一個提示信息,給出至今己顯示的該文件的百分比(15%)。

      2.設定每屏顯示行數

      使用選項 -NUM,指定每屏顯示的行數為,這里指定顯示 5 行。

      [root@localhost Python-3.5.2]# more -5 README

      This is Python version 3.5.2

      ============================

      Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,

      2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved.

      --More--(2%)

      3.從文件第 NUM 行開始顯示

      使用選項 +NUM,從文件第 NUM 行開始顯示,這里從第 10 行開始顯示。

      [root@localhost Python-3.5.2]# more +10 README

      have changed considerably, and a lot of deprecated features have finally

      been removed.

      Build Instructions

      ------------------

      On Unix, Linux, BSD, OSX, and Cygwin:

      ./configure

      make

      make test

      sudo make install

      This will install Python as python3.

      You can pass many options to the configure script; run "./configure --help" to

      find out more. On OSX and Cygwin, the executable is called python.exe;

      elsewhere it's just python.

      On Mac OS X, if you have configured Python with --enable-framework, you should

      use "make frameworkinstall" to do the installation. Note that this installs

      the Python executable in a place that is not normally on your PATH, you may

      want to set up a symlink in /usr/local/bin.

      On Windows, see PCbuild/readme.txt.

      If you wish, you can create a subdirectory and invoke configure from there.

      For example:

      mkdir debug

      cd debug

      ../configure --with-pydebug

      make

      make test

      (This will fail if you *also* built at the top-level directory.

      You should do a "make clean" at the toplevel first.)

      --More--(18%)

      4.從匹配搜索字符串 STRING 的文件位置開始顯示

      使用選項 +/STRING,從文件中查找第一個出現“Unix”字符串的行,并從該處前兩行開始顯示輸出。

      [root@localhost Python-3.5.2]# more +/Unix README

      ...跳過

      ------------------

      On Unix, Linux, BSD, OSX, and Cygwin:

      ./configure

      make

      make test

      sudo make install

      This will install Python as python3.

      You can pass many options to the configure script; run "./configure --help" to

      find out more. On OSX and Cygwin, the executable is called python.exe;

      elsewhere it's just python.

      On Mac OS X, if you have configured Python with --enable-framework, you should

      use "make frameworkinstall" to do the installation. Note that this installs

      the Python executable in a place that is not normally on your PATH, you may

      want to set up a symlink in /usr/local/bin.

      On Windows, see PCbuild/readme.txt.

      If you wish, you can create a subdirectory and invoke configure from there.

      For example:

      mkdir debug

      cd debug

      ../configure --with-pydebug

      make

      make test

      (This will fail if you *also* built at the top-level directory.

      You should do a "make clean" at the toplevel first.)

      If you need an optimized version of Python, you type "make profile-opt" in the

      top level directory. This will rebuild the interpreter executable using Profile

      Guided Optimization (PGO). For more details, see the section bellow.

      --More--(21%)

      5.和其他命令組合使用

      列出一個目錄下的文件,如果內容過多,可以用 more 來分頁顯示,需要和管道 | 結合起來。

      [root@localhost Python-3.5.2]# ls -l

      總用量 34676

      -rw-r--r--. 1 wang wang 8464 6月 26 05:38 aclocal.m4

      drwxr-xr-x. 5 root root 79 9月 7 20:30 build

      -rwxr-xr-x. 1 wang wang 42856 6月 26 05:38 config.guess

      -rw-r--r--. 1 root root 835023 9月 7 15:06 config.log

      -rwxr-xr-x. 1 root root 40031 9月 7 15:06 config.status

      -rwxr-xr-x. 1 wang wang 35740 6月 26 05:38 config.sub

      -rwxr-xr-x. 1 wang wang 474932 6月 26 05:38 configure

      -rw-r--r--. 1 wang wang 155069 6月 26 05:38 configure.ac

      drwxrwxr-x. 18 wang wang 4096 6月 26 05:47 Doc

      drwxrwxr-x. 2 wang wang 20 6月 26 05:38 Grammar

      drwxrwxr-x. 2 wang wang 4096 6月 26 05:38 Include

      -rwxr-xr-x. 1 wang wang 7122 6月 26 05:38 install-sh

      drwxrwxr-x. 47 wang wang 8192 9月 7 20:29 Lib

      -rw-r--r--. 1 root root 21053416 9月 7 20:29 libpython3.5m.a

      -rw-r--r--. 1 wang wang 12767 6月 26 05:38 LICENSE

      drwxrwxr-x. 8 wang wang 4096 6月 26 05:38 Mac

      -rw-r--r--. 1 root root 66393 9月 7 15:06 Makefile

      -rw-r--r--. 1 root root 58147 9月 7 15:06 Makefile.pre

      -rw-r--r--. 1 wang wang 58449 6月 26 05:38 Makefile.pre.in

      drwxrwxr-x. 2 wang wang 4096 9月 7 15:06 Misc

      drwxrwxr-x. 11 wang wang 8192 9月 7 20:29 Modules

      drwxrwxr-x. 4 wang wang 4096 9月 7 20:28 Objects

      drwxrwxr-x. 2 wang wang 4096 9月 7 20:28 Parser

      drwxrwxr-x. 4 wang wang 4096 6月 26 05:38 PC

      drwxrwxr-x. 2 wang wang 4096 6月 26 05:38 PCbuild

      drwxrwxr-x. 2 wang wang 4096 9月 7 20:30 Programs

      -rw-r--r--. 1 root root 26 9月 7 20:29 pybuilddir.txt

      -rw-r--r--. 1 root root 43899 9月 7 15:06 pyconfig.h

      -rw-r--r--. 1 wang wang 41897 6月 26 05:38 pyconfig.h.in

      -rwxr-xr-x. 1 root root 12284727 9月 7 20:29 python

      drwxrwxr-x. 3 wang wang 4096 9月 7 20:29 Python

      -rw-r--r--. 1 root root 3080 9月 7 15:14 python-config

      -rw-r--r--. 1 root root 2042 9月 7 15:14 python-config.py

      -rw-r--r--. 1 root root 61170 9月 7 15:14 python-gdb.py

      -rw-r--r--. 1 wang wang 8060 6月 26 05:38 README

      -rw-r--r--. 1 wang wang 99778 6月 26 05:38 setup.py

      drwxrwxr-x. 22 wang wang 4096 6月 26 05:38 Tools

      [root@localhost Python-3.5.2]# ls -l | more -5

      總用量 34676

      -rw-r--r--. 1 wang wang 8464 6月 26 05:38 aclocal.m4

      drwxr-xr-x. 5 root root 79 9月 7 20:30 build

      -rwxr-xr-x. 1 wang wang 42856 6月 26 05:38 config.guess

      -rw-r--r--. 1 root root 835023 9月 7 15:06 config.log

      --More--

      less 命令的作用與 more 十分相似,都可以用來按頁顯示文件,不同之處在于 less 命令在顯示文件時允許用戶既可以向前又可以向后翻閱文件。而 more 命令只能向前瀏覽。用 less 命令顯示文件時,用 PageUp 鍵向上翻頁,用 PageDown 鍵向下翻頁。若要在文件中往前移動,按 b 鍵;要移動到文件的百分比表示的某位置,則指定一個 0 ~ 100 之間的數,并按 p 鍵盤即可。less 命令使用與 more 類似,在此就不再贅述了,如有不清楚的地方查看聯機幫助。

      
    看了“Linux 命令more/less文件和目錄管理”還想看:

    1.Linux的翻頁命令more和less怎么使用

    2.Linux系統中less命令的用法

    3.Linux系統中的翻頁命令more和less使用教程

    4.Linux 命令 rm文件和目錄管理詳解

    5.less命令怎么用

    熱門文章

    2963227 主站蜘蛛池模板: 99久热任我爽精品视频| 2022天天操| 报告夫人漫画画免费读漫画在线观看漫画ag| 亚洲熟妇无码爱v在线观看| 美国式禁忌3在线观看| 国产精品久久亚洲一区二区| a视频免费观看| 成人午夜视频网站| 久久精品国产99国产精品| 欧美日韩第一区| 免费在线黄网站| 美女胸又大又www又黄的网站| 国产成人精品免费久久久久| 337p人体大胆扒开下部| 天天影视综合色| 东京一本一道一二三区| 日本永久免费a∨在线视频| 亚洲中文字幕伊人久久无码| 毛片女女女女女女女女女| 免费无遮挡无码永久在线观看视频| 色在线亚洲视频www| 国产女人高潮抽搐叫床视频| 亚洲综合色区中文字幕| 国产美女久久精品香蕉69| AV中文无码乱人伦在线观看| 少妇无码av无码专区线| 中文字幕免费在线视频| 日本强不卡在线观看| 久久精品国产精品青草| 桃子视频观看免费完整| 亚洲成a人不卡在线观看| 永久黄网站色视频免费| 免费国产午夜高清在线视频| 精品无码av无码专区| 国产91伦子系列沙发午睡| 贰佰麻豆剧果冻传媒一二三区| 国产成人久久777777| 久久亚洲最大成人网4438| 国产精品99久久久| 在线私拍国产福利精品| 国产精品日韩欧美一区二区|