Linux file Operations Command Touch, cat, more, less, head, tail

Source: Internet
Author: User

Touch/bin/touch Creating an empty file

Linux Create files can use special symbols, except

Touch test Test1 created two files
Touch "Test Test1" creates a file with spaces in the file name
Touch ' Test test1 ' created a file with spaces in the file name

Cat/bin/cat displaying file contents

-N Display Line number
TAC upside down shows that this command does not support-n

Cat-n/etc/services
Tac/etc/services

Cat is suitable for viewing files with less content

More/bin/more page display of file contents

Space or F page
Carriage return line break
Q or Q exit

More/etc/services

More can't page up, not support pageup/pagedown/↑/↓

Less/usr/bin/less page displays the contents of the file, in addition to having more features, you can also page up, support pageup/pagedown/↑/↓

Less/etc/services
In addition, less also supports search, such as enter a/a enter, and then enter N to indicate the next

Head/usr/bin/head display the first few lines of the file

-n Specifies the number of rows
Head-n 20/etc/services default 10 rows

Tail/etc/services Show the end of the file a few lines

-N Default 10 rows
-F dynamically displays the end of the file, head does not support this option
Tail-f/var/log/messages

Linux file Operations Command Touch, cat, more, less, head, tail

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.