Get the App
SLTechnology News&Howtos  ›  Servers  › 

"input and output in product Linux"

Shulou Source: shulou.com Published: 2022-06-03 09:30:22 09月21日 Update

Input and output in Linux

Input

Stdin [standard input stream]

Input refers to the information transferred to the system by the external connection of the system

The way in which the system externally transfers data to the system is as follows

1. Keyboard

two。 Mouse

3. Enter a command

Output

Output standout [standard correct input] stderr [standard error output] the string generated after the successful execution of the command, the output signal of the string in linux is 1stderr in linux, the output signal of the string in linux is 2

Character equipment

A character device refers to a device that transmits characters in units during Istroke O transmission, such as keyboards, printers, etc.

A character device is a virtual device that is turned on in memory and is real.

Redirect output find / etc/-name passwd

Note: must be under the ordinary user

1 > 2 > & > correct output, error output, all output

Mini App: > westos clears files

2 find / etc/-name passwd append: do not overwrite the original file

Find / etc/-name passwd > westos.out correct output is stored in westos.out

Additional

Append right / wrong / all

Pipeline

Pipe definition: turn the output into the input of the last command

Symbolic usage 2 > & 1 converts the output numbered 1 to 2lee copy output to the specified location''conduit character

Example: display history 3'5 lines output

[student@workstation Desktop] $ls / bin | wc-l # # Statistics / how many files are there in bin 1612 [student@workstation Desktop] $find / etc/-name passwd | wc-l # # by default only the correct output can be obtained through the pipeline find:'/ etc/pki/rsyslog': Permission deniedfind:'/ etc/dhcp': Permission deniedfind:'/ etc/polkit-1/rules.d': Permission deniedfind:'/ etc/polkit-1/localauthority': Permission deniedfind :'/ etc/sssd': Permission deniedfind:'/ etc/grub.d': Permission deniedfind:'/ etc/audit': Permission deniedfind:'/ etc/firewalld': Permission deniedfind:'/ etc/sudoers.d': Permission deniedfind:'/ etc/lvm/archive': Permission deniedfind:'/ etc/lvm/backup': Permission deniedfind:'/ etc/lvm/cache': Permission deniedfind:'/ etc/libvirt': Permission deniedfind:'/ etc/cups/ssl': Permission denied2 [student@workstation Desktop] $find / etc/-name passwd 2 > & 1 | wc-l # # directs the error output to the correct output location 16 [student@workstation Desktop] $find / etc/-name passwd | tee file | wc-l # copy the output to the file file and count the output through the pipeline find:'/ etc/pki/rsyslog': Permission deniedfind:'/ etc/dhcp': Permission deniedfind:'/ etc/polkit-1/rules .d': Permission deniedfind:'/ etc/polkit-1/localauthority': Permission deniedfind:'/ etc/sssd': Permission deniedfind:'/ etc/grub.d': Permission deniedfind:'/ etc/audit': Permission deniedfind:'/ etc/firewalld': Permission deniedfind:'/ etc/sudoers.d': Permission deniedfind:'/ etc/lvm/archive': Permission-** input redirection

Take changing the password as an example

Enter redirection symbol

Command

Tags: Output input characters files pipes devices commands passwords systems errors standards symbols locations signals strings identifiers keyboards transmissions statistics ordinary Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Shulou Tech Info OPPO Reno Shulou Information