Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

"input and output in product Linux"

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report