Text File View and creation

Source: Internet
Author: User
Tags rsyslog

viewing file paths
    1. Ls/path1/path2/filename----------------------Show full path
    2. Dirname/path1/path2/filename-------------Show only the folder path of FileName
    3. Basename/path1/path2/filename-----------Show Only FileName

View text files--cat, TAC, NL, more, less, tail, head ... Cat:
    1. Start from the first line, until the last line
    2. Cat-n xx.txt--Display line number
    3. Cat--help
Tac
    1. Start display from the last line until the beginning of the file
nl
    1. Displays from the first line, until the last row, and with the line number displayed
    2. When there is a blank line in the file, the number of rows is slightly too blank
    3. The blank line is also displayed with a line number, Nl-b Xx.txt
[[email protected] etc]# cat-n rsyslog.conf//Show All line numbers (including blank lines) [[email protected] etc]# cat-b rsyslog.conf//Display all line numbers (but not blank lines) or : [[email protected] etc]# Nl-ba rsyslog.conf//Show All line numbers (including blank lines) [[email protected] etc]# NL-BT rsyslog.conf//Show All line numbers (but not empty lines) Or: [[email protected] etc]# less-n rsyslog.conf//Display all line numbers (including blank lines) Cat options:-n Displays line numbers (including blank lines)-B displays line numbers (excluding blank lines) NL options: The display of the-B row//Line display There are two ways, a means displaying all rows (including blank lines), and t means displaying all non-blank rows (excluding blank lines), i.e.:-BA//Display all line numbers (including blank lines)-BT//Display all line numbers (but not blank lines) VI xx

MORE: Split screen display
    1. Press ENTER to display a line
    2. Press space, split screen display
    3. Disadvantage: can only page back, not forward
    4. Also supports keyword search/xxx n--top-down, n--bottom-up
    5. Exit More:ctrl+c
Less: Split-screen display, more powerful than more
    1. Press ENTER to display a line
    2. Press space, split screen display
    3. Also supports keyword search/xxx n--top-down, n--bottom-up
    4. pagedown--PAGE Down
    5. pageup--Page Forward
    6. Home key--go directly to the beginning of the file
    7. End key--directly to the end of the file
    8. Exit Less: Direct Q can
Head: View the first 10 lines of the file by default
    1. Head-n aa.txt: View the first 100 lines of the Aa.txt file
    2. head-100 aa.txt: View the first 100 lines of the Aa.txt file
Tail: The last 10 lines of the file are viewed by default
    1. Tail-n aa.txt: View the last 100 lines of the Aa.txt file
    2. tail-100 aa.txt: View the last 100 lines of the Aa.txt file
    3. Tail-f -100 aa.txt: Convenient monitoring log log,-f will always be displayed on the screen, press CTRL + C to exit '
    4. Tail-f = = Tailf
Touch: Time to create or modify a file
    1. Touch Aa.txt--if aa.txt does not exist, create
    2. Touch Aa.txt-If aa.txt exists, modify the file creation time to the current time and the current time
    3. Touch-t 201607061014 Aa.txt--Specify the Aa.txt file creation time as July 6, 2016 10 o'clock 14
OD: View non-text files
    1. Od-t c/bin/ls (t:type c:ascii code form)

    1. Strings/bin/ls

Text File View and creation

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.