Linux View File command

Source: Internet
Author: User

  1. Cat

    NAME
    cat-concatenate files and print on the standard output

    Synopsis
    Cat [OPTION] [FILE] ...

    DESCRIPTION

    -N,--number
    Number all output lines

    -E,--show-ends
    Display $ at end of each line

    [Email protected] ~]# cat-e/etc/inittab
    #$
    # Inittab This file describes how the INIT process should set up$
    # The system in a certain run-level.$
    #$
    # Author:miquel van Smoorenburg, <[email protected]>$
    # Modified for RHS Linux by Marc Ewing and Donnie barnes$

  2. More

    NAME
    More-file perusal filter for CRT viewing

    Synopsis
    more [-DLFPCSU] [-num] [+/pattern] [+ linenum] [file ...]

    SPACEBAR--Turn back 1 pages, turn to the last page to exit directly

    b--11 Pages forward

    Enter-1 lines down

    Up to 1 lines are not supported

  3. Less

    More or less, more convenient than more

    SPACEBAR--Turn back 1 pages

    b--1 Pages forward

    Enter--Turn 1 lines down

    k--up 1 rows

    Q-Exit

  4. Head

    NAME
    Head-output the first part of the files

    Synopsis
    Head [OPTION] ... [FILE] ...

    DESCRIPTION
    Print the first lines of each FILE to standard output.

    [Email protected] ~]# Head/etc/inittab
    #
    # Inittab This file describes how the INIT process should set up
    # The system in a certain run-level.
    #
    # Author:miquel van Smoorenburg, <[email protected]>
    # Modified for RHS Linux by Marc Ewing and Donnie Barnes
    #

    # Default RunLevel. The runlevels used by RHS is:
    # 0-halt (do not set Initdefault to this)

    -N,--lines=[-]n
    Print the first N lines instead of the first 10

    [Email protected] ~]# head-n 5/etc/inittab
    Head:5/etc/inittab:invalid Number of lines
    [Email protected] ~]# head-n 5/etc/inittab
    #
    # Inittab This file describes how the INIT process should set up
    # The system in a certain run-level.
    #
    # Author:miquel van Smoorenburg, <[email protected]>

  5. Tail

    NAME
    Tail-output the last part of the files

    Synopsis
    tail [OPTION] ... [FILE] ...

    DESCRIPTION
    Print the last ten lines of each FILE to standard output.
    [Email protected] ~]# Tail/etc/inittab
    # Run Gettys in standard runlevels
    1:2345:respawn:/sbin/mingetty tty1
    2:2345:respawn:/sbin/mingetty Tty2
    3:2345:respawn:/sbin/mingetty Tty3
    4:2345:respawn:/sbin/mingetty Tty4
    5:2345:respawn:/sbin/mingetty Tty5
    6:2345:respawn:/sbin/mingetty Tty6

    # Run XDm in RunLevel 5
    X:5:respawn:/etc/x11/prefdm-nodaemon

    -N,--lines=n
    Output the last N lines, instead of the last 10

    [email protected] ~]# man tail
    [Email protected] ~]# tail-n 5/etc/inittab
    5:2345:respawn:/sbin/mingetty Tty5
    6:2345:respawn:/sbin/mingetty Tty6

    # Run XDm in RunLevel 5
    X:5:respawn:/etc/x11/prefdm-nodaemon

    -F,--follow[={name|descriptor}]
    Output appended data as the file grows; -F,--follow, and--follow=descriptor are equivalent

  6. Cut

    NAME
    Cut-remove sections from all line of files

    Synopsis
    Cut [OPTION] ... [FILE] ...

    DESCRIPTION
    Print selected parts of lines from each FILE to standard output.

    -D,--delimiter=delim
    Use DELIM instead of the TAB for field delimiter

    -F,--fields=list
    Select only these fields; Also print any line this contains no delimiter character, unless the-s option is specified

    [Ro[email protected] ~]# cut-d:-F 1/ETC/PASSWD
    Root
    Bin
    Daemon
    Adm
    Lp
    Sync
    Shutdown

Linux View File command

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.