[Bird Brother Linux Video tutorial organized]04_03_linux management and IO redirection

Source: Internet
Author: User

First, several major parts of the computer:

Arithmetic, controller: CPU

Memory: RAM

Input/Output devices:


Program: instruction and data composition

The entire computational process is done by the operator.

Controller: reads the instruction and reads the operation to be performed, including the data and the calculation to be performed, in the control of the instruction. So the controller controls where the operator is going to fetch the data, and then the operator makes the operation, and the result of the operation is output to the memory by the controller's control.

The arithmetic device:

Memory:



Address bus: Memory addressing

Data bus: Transferring data

Control Bus: Control instructions


Register: CPU Ephemeral memory


Second, system settings:

Default output device: Standard output, STDOUT 1

Display

Default input device: standard input, STDIN 0

Keyboard

Standard error Output: STDERR 2

Display


III. I/O redirection:

1. Output redirection:

: Overwrite output

>>: Append output

SET-C: Disables the use of output redirection for already existing files;

Force overwrite output, use >|

Set +c: Turn off the above functions;

2>: Redirect Error output

2>>: Append mode redirect Error output

&>: Redirect standard output or error output to the same file

2. Input redirection:

<: Input redirection

<<:here Document


Iv. Pipeline:

The output of the previous command, as input to the latter command

Example: 1. Display the number of rows in a file does not display the file name

Wc-l/etc/passwd | Cut-d '-f1

2. Count the number of files in the/usr/bin directory;

Ls/usr/bin | Wc-l

3. Remove all shells from the current user, requiring each shell to be displayed only once and sequentially;

Cut-d:-f7/etc/passwd | Sort-u

4. How to display the content type of each file in the/var/log directory;

Ls/var/log | file/var/log/*

5. Remove the 6th line of the/etc/inittab file;

Head-6/etc/inittab | Tail-1

6. Remove the user and shell of the 9th user in the/etc/passwd/file and display it to the screen and save it to the/tmp/users file

Head-9/etc/passwd | Head-1 |cut-d:-f1,7 | Tee/tmp/users

7. Show all files starting with PA in/etc directory and count them

Ls-d/etc/pa* | Wc-l

8. Do not use a text editor to add an alias Cls=clear line to the current user's. bashrc file;

echo "Alias Cls=clear" >> ~/.BASHRC

This article is from the "Linux Blind Advanced Road" blog, please be sure to keep this source http://blindbird.blog.51cto.com/12338383/1880341

[Bird Brother Linux Video tutorial organized]04_03_linux management and IO redirection

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.