In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
# input and output management in the system #
1. Understand the input and output redirection of the system
Input redirection refers to importing a file into a command, while output redirection refers to writing data information that would otherwise be output to the screen to a specified file.
two。 Symbols for managing input and output
# # output redirection
> # # redirect correct input
2 > # # redirect error output
& > # # redirect all output
Note:
Redirection overwrites the contents of the original file
> > # # will not overwrite the contents of the original file
2 > # # error output, not overwritten
& > > # # all outputs are not overwritten
# find command #
Used to find files in the specified directory. Any string that precedes a parameter is treated as the name of the directory you are looking for. If you use this command without setting any parameters, the find command looks for subdirectories and files under the current directory. And all the subdirectories and files found are displayed.
Common options:
-group: find files or directories that match the specified group name
-name: specifies a string as a template style for finding files or directories
-nouser: find files or directories that do not belong to the user identification code of the local host
-user: the file or directory of the finder and the specified owner name
Examples are as follows:
# Application of pipeline #
1. The role of pipes
The function of the "|" pipe is to change the output of the previous command into the input of the latter command.
Note:
The pipe only allows the correct output to pass through
The output through the pipe will become input, and the output that becomes input will be processed by the second command
If you need to save the output, you need to copy a copy of the output, using the command "tee"
This lab is operated under ordinary users:
Find / etc/-name passwd | wc-l # # will see a result of 2, because the error output cannot go through the pipeline find / etc-name passwd 2 > & 1 | wc-l # # will see 19, because the output numbered 2 is converted to the number 1find / etc-name passwd 2 > & 1 | tee file | wc-l # saves a copy to file and counts the number of rows
Summary: gap between 2 > & 1 and & >
& > is a redirected output, so you need to explain where to redirect it.
2 > & 1 is not redirected, or the output instruction of find is converted to input with pipe characters.
# input redirection #
Cat > file add characters-> Press [esc]
5) replacement of characters
:% s / characters to be replaced / characters to be replaced / g
The full text of:% sUniPUBG # # is replaced by: @
: 1recover5sCompact hammer raceme g # # instead of lines 1-5: @
Note:
% s marks all lines
G Mark all columns
6) split screen function of vim
Ctrl+w s # # split screen up and down
Ctrl+w v # # split screen around
Ctrl+w c # # close the screen where the cursor is located
Ctrl+w up and down, left and right # # move the cursor to the specified screen
: sp file2 # # Editing both the current file and file2
7) cursor movement in command mode
Gg # # move the cursor to the first line of the file
G # # move the cursor to the end of the file
: the number # # move the cursor to the specified line
# insert mode #
one
) cursor movement in insert mode
I # # insert where the cursor is located
I # # insert at the beginning of the line where the cursor is located
O # # insert the next line of the cursor
O # # insert the previous line of the cursor
A # # insert the next character of the character where the cursor is located
A # # insert at the end of the line where the cursor is located
S # # the character of the cursor is deleted and inserted
S # # the line of the cursor is deleted and inserted
# exit mode of vim #
: Q # # exit, used when the contents of the file have not been changed
: wq # # exit save
: Q! # # forced exit does not save, used when you do not want to save after changing the file
: wq! # # force exit save to use when writing read-only files
Note:
The edited read-only file must be the current user's file
Or the user of the current operation is root
Summary
The above is the common functions of linux system input and output management and vim introduced by the editor. I hope it will be helpful to you. If you have any questions, you are welcome to leave a message. The editor will reply you in time!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.