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

How to use xargs of sehll

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

In this article, the editor introduces in detail "how to use sehll's xargs". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use sehll's xargs" can help you solve your doubts.

Introduction to xargs

Xargs is a filter that passes parameters to a command

It is also a tool for combining multiple commands (some commands cannot be piped, we use xargs to solve this problem)

Xargs can convert pipe or standard input (stdin) data into command line arguments, or read data from the output of a file

Xargs can also convert single-line or multi-line text input to other formats, such as multi-line to single-line, single-line supplement to multi-line.

The input to xargs will contain line breaks and whitespace, but with xargs processing, line feeds and whitespace will be replaced by spaces

Xargs is a powerful command that captures the output of one command and passes it to another command.

Xargs usage example

1. Find the file and change the user to which the file belongs

# will change the file user starting with test in the current directory to zhangy [root@BlackGhost download] # find. -name "test*"-print | xargs chown zhangy:users# to view the file that begins with test in the current directory belongs to the user [root@BlackGhost download] # find. -name "test*"-print-exec ls-al {}\;. / test.sql.zip-rw-r--r-- 1 zhangy users 1981 Feb 2 16:05. / test.sql.zip./test.zip-rw-r--r-- 1 zhangy users 16 May 23 22:54. / test.zip

2. Count the users of the system.

[zhangy@BlackGhost download] # cut-d:-F1 > / home/zhangy/userlist.txt

3. Back up files

[zhangy@BlackGhost ddd] $ls | xargs-I cp {} {}. Bakcp test test.bak, this article "how to use xargs in sehll" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, please follow the industry information channel.

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

Development

Wechat

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

12
Report