More是一个命令,可一次查看一个屏幕(但不能修改)文本文件的内容。它在Unix和类似Unix的系统,DOS,OS / 2和Microsoft Windows上可用。这种程序称为寻呼机。More是一个非常基本的寻呼机,最初只允许通过文件进行前向导航,尽管较新的实现允许有限的向后移动。
更多命令的基础应该像这样–
$ more /var/log/dkpg.log
样本输出应如下所示–
2016-12-02 11:30:45 startup archives unpack 2016-12-02 11:30:45 install python-ptyprocess:all <none> 0.5-1 2016-12-02 11:30:45 status half-installed python-ptyprocess:all 0.5-1 2016-12-02 11:30:45 status unpacked python-ptyprocess:all 0.5-1 2016-12-02 11:30:45 status unpacked python-ptyprocess:all 0.5-1 2016-12-02 11:30:46 install python-pexpect:all <none> 4.0.1-1 2016-12-02 11:30:46 status half-installed python-pexpect:all 4.0.1-1 2016-12-02 11:30:46 status unpacked python-pexpect:all 4.0.1-1 2016-12-02 11:30:46 status unpacked python-pexpect:all 4.0.1-1 2016-12-02 11:30:46 install python-simplegeneric:all <none> 0.8.1-1 2016-12-02 11:30:46 status half-installed python-simplegeneric:all 0.8.1-1 2016-12-02 11:30:46 status unpacked python-simplegeneric:all 0.8.1-1 2016-12-02 11:30:46 status unpacked python-simplegeneric:all 0.8.1-1 2016-12-02 11:30:47 install ipython:all <none> 2.4.1-1 2016-12-02 11:30:47 status half-installed ipython:all 2.4.1-1 2016-12-02 11:30:47 status triggers-pending man-db:amd64 2.7.5-1 2016-12-02 11:30:47 status triggers-pending hicolor-icon-theme:all 0.15-0ubuntu1 2016-12-02 11:30:47 status half-installed ipython:all 2.4.1-1 .........................................................................................
Cat命令如下所示–
$ cat /var/log/boot.log | more
样本输出应如下所示–
[ OK ] Started File System Check on /dev/disk/by-uuid/8E9A-D511. Mounting /boot/efi... [ OK ] Mounted /boot/efi. [ OK ] Reached target Local File Systems. Starting Clean up any mess left by 0dns-up... Starting Set console font and keymap... Starting LSB: AppArmor initialization... Starting Tell Plymouth To Write Out Runtime Data... Starting Create Volatile Files and Directories... [ OK ] Started Tell Plymouth To Write Out Runtime Data. [ OK ] Started Clean up any mess left by 0dns-up. Starting Nameserver information manager... [ OK ] Started Nameserver information manager. [ OK ] Started Set console font and keymap. [ OK ] Created slice system-getty.slice. [ OK ] Started Create Volatile Files and Directories. Starting Update UTMP about System Boot/Shutdown... Starting Network Time Synchronization... [ OK ] Started Update UTMP about System Boot/Shutdown. [ OK ] Started Network Time Synchronization. [ OK ] Reached target System Time Synchronized. [ OK ] Started LSB: AppArmor initialization. [ OK ] Reached target System Initialization.
为了导航,请按Enter键或按空格键以浏览一页。要退出该命令,只需按q键或CTRL + C键。要设置页面应包含的行数,请使用以下命令-
$ more -5 /var/log/kern.log
上面的命令仅显示前10行。样本输出应如下所示–
Dec 6 12:27:33 khushboo-HP-15-Notebook-PC kernel: [ 2941.623182] nouveau 0000:09:00.0: DRM: resuming kernel object tree… Dec 6 12:27:33 khushboo-HP-15-Notebook-PC kernel: [ 2941.740892] nouveau 0000:09:00.0: bus: MMIO write of 0000001f FAULT at 6013d4 [ IBUS ] Dec 6 12:27:33 khushboo-HP-15-Notebook-PC kernel: [ 2941.741404] nouveau 0000:0
要获取有关更多命令的更多信息,请使用以下命令
$ more -h
样本输出应如下所示–
more: unknown option -h Usage: more [options] ... A file perusal filter for CRT viewing. Options: -d display help instead of ringing bell -f count logical rather than screen lines -l suppress pause after form feed -c do not scroll, display text and clean line ends -p do not scroll, clean screen and display text -s squeeze multiple blank lines into one -u suppress underlining - the number of lines per screenful + display file beginning from line number +/ display file beginning from search string match -V display version information and exit For more details see more(1).
Less命令允许您查看文件的内容并浏览文件。less命令的样本应该是这样的–
$ less /var/log/dpkg.log
样本输出应如下所示–
2016-12-02 11:30:48 status half-installed ipython:all 2.4.1-1 2016-12-02 11:30:48 status triggers-pending bamfdaemon:amd64 0.5.3~bzr0+16.04.20 160701-0ubuntu1 2016-12-02 11:30:48 status triggers-pending mime-support:all 3.59ubuntu1 2016-12-02 11:30:48 status unpacked ipython:all 2.4.1-1 2016-12-02 11:30:48 status unpacked ipython:all 2.4.1-1 2016-12-02 11:30:48 upgrade libmysqlclient20:i386 5.7.13-0ubuntu0.16.04.2 5.7.16-0ubuntu0.16.04.1 2016-12-02 11:30:48 status triggers-pending libc-bin:amd64 2.23-0ubuntu3 2016-12-02 11:30:48 status half-configured libmysqlclient20:i386 5.7.13-0ubuntu0.16.04.2 2016-12-02 11:30:48 status unpacked libmysqlclient20:i386 5.7.13-0ubuntu0.16.04.2
通过Enter键,您可以逐行浏览文件。要获得有关less命令的更多信息,请使用以下命令
$ less --help
样本输出应如下所示–
SUMMARY OF LESS COMMANDS Commands marked with * may be preceded by a number, N. Notes in parentheses indicate the behavior if N is given. A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. h H Display this help. q :q Q :Q ZZ Exit. --------------------------------------------------------------------------- MOVING e ^E j ^N CR * Forward one line (or N lines). y ^Y k ^K ^P * Backward one line (or N lines). f ^F ^V SPACE * Forward one window (or N lines). b ^B ESC-v * Backward one window (or N lines). z * Forward one window (and set window to N). w * Backward one window (and set window to N). ESC-SPACE * Forward one window, but don't stop at end-of-file. d ^D * Forward one half-window (and set half-window to N). u ^U * Backward one half-window (and set half-window to N). ESC-) RightArrow * Left one half screen width (or N positions).
如果需要查找每行的编号,请使用-N选项,如下所示–
$ less -N /var/log/dpkg.log
样本输出应如下所示–
1 2016-12-02 11:30:45 startup archives unpack 2 2016-12-02 11:30:45 install python-ptyprocess:all <none> 0.5-1 3 2016-12-02 11:30:45 status half-installed python-ptyprocess:all 0.5-1 4 2016-12-02 11:30:45 status unpacked python-ptyprocess:all 0.5-1 5 2016-12-02 11:30:45 status unpacked python-ptyprocess:all 0.5-1 6 2016-12-02 11:30:46 install python-pexpect:all <none> 4.0.1-1 7 2016-12-02 11:30:46 status half-installed python-pexpect:all 4.0.1-1 8 2016-12-02 11:30:46 status unpacked python-pexpect:all 4.0.1-1 9 2016-12-02 11:30:46 status unpacked python-pexpect:all 4.0.1-1 10 2016-12-02 11:30:46 install python-simplegeneric:all <none> 0.8.1-1 11 2016-12-02 11:30:46 status half-installed python-simplegeneric:all 0.8.1 11 -1 12 2016-12-02 11:30:46 status unpacked python-simplegeneric:all 0.8.1-1 13 2016-12-02 11:30:46 status unpacked python-simplegeneric:all 0.8.1-1 14 2016-12-02 11:30:47 install ipython:all <none> 2.4.1-1 15 2016-12-02 11:30:47 status half-installed ipython:all 2.4.1-1 16 2016-12-02 11:30:47 status triggers-pending man-db:amd64 2.7.5-1 17 2016-12-02 11:30:47 status triggers-pending hicolor-icon-theme:all 0.15- 17 0ubuntu1 18 2016-12-02 11:30:47 status half-installed ipython:all 2.4.1-1 19 2016-12-02 11:30:47 status triggers-pending gnome-menus:amd64 3.13.3-6ub 19 untu3.1 20 2016-12-02 11:30:47 status triggers-pending desktop-file-utils:amd64 0.2
要退出less命令,请使用q键或CTRL + C键。若要更改此行为并在到达文件末尾时自动退出文件,请使用以下命令
在阅读完本文之后,您将能够理解–如何在Linux中结合示例使用“更少”和“更多”命令,我们将提供更多基于Linux的技巧和窍门。继续阅读!
因此,我已经阅读了大约半年的关于x86处理器内部发生的事情。所以我决定尝试一下x86程序集的乐趣,只从80386指令开始,以保持它的简单性。(我主要是在学习,而不是优化) 几个月前我做了一个用C语言编写的游戏,所以我去那里用汇编代码从头重写了位图blitting函数。我不明白的是,循环的主要像素绘制主体使用C代码(18条指令)比我的汇编代码(只有7条指令,我几乎100%确定它不会跨越缓存行边界)更
问题内容: 许多Java书籍都将该语句描述为比该语句快。但是我没有找到任何地方为什么切换比if更快。 例 我有一种情况,我必须选择两项中的任何一项。我可以使用 要么 考虑item和BREAD是一个恒定的int值。 在上面的示例中,哪个操作更快,为什么? 问题答案: 因为有很多情况下,有一些特殊的字节码可以有效地评估switch语句。 如果使用IF语句实现,则将进行检查,跳转到下一个子句,进行检查,
问题内容: 阅读此内容后,引人注目: BSON还被设计为快速编码和解码。例如,整数存储为32(或64)位整数,因此不需要在文本之间进行解析。对于小整数,此方法比JSON使用更多的空间, 但解析速度要快得多 。 根据我的阅读,使用BSON的全部目的是因为它对CPU的负担更少,并且编码/处理速度更快。 但是,我对Node.js进行了一些测试,并使用本机JSON方法使BSON脱颖而出。一些测试表明J
我正在编写C++来解决这个问题,从leetcode:https://leetcode.com/problems/remove-element/ 给定数组nums和值val,移除该值的所有实例并返回新的长度。 不要为另一个数组分配额外的空间,您必须用O(1)个额外内存修改输入数组。 元素的顺序可以更改。你在新长度之外留下什么并不重要。 您的函数应该返回长度=2,nums的前两个元素为2。 在返回长度
维基百科说A*在O(E)中运行,其中E是图中的边数。但我的朋友说a*只是Dijkstra算法的一般情况,而Dijkstra算法运行在O(E+V log V)中。所以我很困惑为什么A*比Dijkstra的算法跑得更快。
问题内容: 我使用INNER JOIN进行查询,结果为1200万行。我喜欢把它放在桌子上。我做了一些测试,当我使用AS SELECT子句创建表时,比先创建表并在运行SELECT之后运行INSERT更快。我不明白为什么。有人可以为我解释吗?ks 问题答案: 如果您使用“选择创建表”(CTAS) 您会自动对数据进行 直接路径插入 。如果你做一个 您执行 常规插入操作 。如果要执行直接路径插入,则必须使
我想看看我是否在正确的轨道上,或者有没有更有效的方法来实现这一点?
问题内容: 我试图理解 为什么Java的ArrayDeque比Java的LinkedList更好, 因为它们都实现了Deque接口。 我几乎看不到有人在他们的代码中使用ArrayDeque。如果有人对ArrayDeque的实现方式有了更多的了解,那将是有帮助的。 如果我理解它,我会更自信地使用它。对于JDK实现管理头和尾引用的方式,我不清楚。 问题答案: 链接结构可能是最糟糕的结构,要在每个元素上