Linux File Processing commands touch cat tac more less head tail and tactail

Source: Internet
Author: User

Linux File Processing commands touch cat tac more less head tail and tactail

Touch

Command name: touch

Path:/bin/touch

Execution permission: All Users

Function Description: creates an empty file.

Syntax: touch [file name]

Touch test.txt

Touch/root/test.txt? ? Create the test.txt file under the rootdirectory

Touch test test1 test2 create multiple files

Touch "program file" creates a file with spaces

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

Cat?

Command name: cat

Path:/bin/cat

Execution permission: All Users

Function Description: displays the file content.

Syntax: cat [-n]? [Test1.txt]? ? ??

? ? ? ? ? ? ? ? ? ? ? -N: display the row number

Cat/etc/issue? Show System Version

Cat-n/etc/issue

 

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

Tac

Command name: tac

Path:/usr/bin/tac

Execution permission: All Users

Function Description: displays the file content? Opposite to cat? Reverse display

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

More

Command name: more

Path:/bin/more

Execution permission: All Users

Function Description: displays the file content by page.

Syntax: more [file name]

? ? ? ? ? ? ? ? (Space) or f? ? Flip

? ? ? ? ? ? ? ? ? (Enter )? ? Line feed

? ? ? ? ? ? ? ? ? ? Q or Q? ? ? ? ? Launch

More/etc/services

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

Less

Command name: less

Path:/usr/bin/less

Execution permission: All Users

Syntax: less [file name]

Function Description: displays the file content by PAGE (pages can be turned up). You can use/[search content] to search for the next file by n.

Example: less/etc/services,

? ? ? ? ? ? The operation is the same as that of more. For less operations, you can flip pages by PAGE pageup, or click the up arrow to flip pages online by line.

? ? ? ? ? ? Available? /[Search content], press n to continue searching

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

Head

Command name: head

Path:/usr/bin/head

Execution permission: All Users

Function Description: displays the first few lines of a file.

Example: head-n 20/etc/services? (Display the first 20 rows of/etc/services)

? ? ? ? ? ? Head/etc/services? ? The first 10 rows are displayed by default.

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

Tail?

Command name: tail

Path:/usr/bin/tail

Execution permission: All Users

Function Description: displays the following lines of a file.

Syntax: tail [file name]

? ? ? ? ? ? -N: number of specified rows

? ? ? ? ? ? ? -F dynamically displays the content at the end of the file

Example: tail-n 18/etc/services (18 rows at the end)

? ? ? ? ? ? Tail-f/var/log/messages? Dynamic Display of 10 lines at the end

? ? ? ? ? ? Tailf/etc/services dynamically displays the last 10 lines

? ? ? ? ? ? ??

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.