Learn basic Linux commands - text file editor command (c)

A rookie to learn programming techniques, record and share knowledge to everyone, hope you can enjoy.

Today to write an article on the basis of learning Linux commands - Bowen working directory commands, but also a lot of practice, summed up for everyone to learn together!

When using the following commands, you can use the aliascommand to view the Properties command you want to use.

cat命令

To view plain text files (less contents)

  • -nOr -number: starting from number 1 to number all output lines
  • cat: Entering the interactive mode
  • Ctrl + C: The trap command execution
  • Ctrl + D: Exit interactive mode
  • cat >test.txt: The content written to the test.txt file, Ctrl + Dsave and exit
    Here Insert Picture Description
    Here Insert Picture Description
    Here Insert Picture Description
    Here Insert Picture Description
    Here Insert Picture Description
    Here Insert Picture Description

more命令

To view plain text files (more content); format: more [options] file
[Basic Instructions]

  1. space -> Next to display
  2. enter -> scroll down one line
  3. b -> a back display
  4. q -> Stop showing
    Here Insert Picture Description

less命令

Paging file output for display, using the [pageup]和[pagedown]other key file can look back and forth, using the 'q'exit status view;
Here Insert Picture Description

head命令

To display the contents of a file header (default 10 lines); head [mandatory option] [select Options] File

  • -n: The number of lines designated by numbers embodiment shown:head -4 /etc/passwd
    Here Insert Picture Description
    Here Insert Picture Description

tail命令

Tail is used to display the contents of the file (the default line 10); Format: head [mandatory option] [select Options] File

  • -n: The number of lines designated by numbers embodiment shown:tail -4 /etc/passwd
    Here Insert Picture Description

wc命令

Number of specified number of lines for text, bytes; Format: wc [Option] Text

  • -l: Displays the number of rows
  • -w: Displays the number of words
  • -c: Only bytes
    Here Insert Picture Description
    Here Insert Picture Description

cut命令

Press for the "column" extract text character; Format: cut [parameters] Text

  • -b: Divided in units of bytes
  • -c: The characters are divided into units
  • -d: Custom delimiter, default tab
  • -fAnd -dused together: the designated display area
    Here Insert Picture Description
    Here Insert Picture Description

diff命令

It used to compare two different file contents; Format: diff [options] source file destination

  • -y: In a parallel way to show similarities and differences files
  • -b: Ignore spaces get a different result
  • -B: Ignore spaces different result
  • -q: Report only what different places, does not report specific information
  • -i: Ignore case changes
  • -W: The use -ywhen parameter specifies the column width
    Here Insert Picture Description
Published 13 original articles · won praise 74 · views 7396

Guess you like

Origin blog.csdn.net/qq_44723773/article/details/105183437