Get the App
SLTechnology News&Howtos  ›  Servers  › 

Cloud Computing Learning Route course syllabus material: parameter passing Xargs

Shulou Source: shulou.com Published: 2022-06-02 06:04:46 10月01日 Update

Today, I would like to share with you some course outline materials on cloud computing learning routes. This article is about some learning notes on parameter passing Xargs. I hope I can give you some help:

=

Awk sed grep sort uniq less more xargs

Xargs: ls cp rm

Case 1

[root@localhost ~] # touch / home/file {1.. 5}

[root@localhost ~] # vim files.txt

/ home/file1

/ home/file2

/ home/file3

/ home/file4

/ home/file5

[root@localhost ~] # cat files.txt | ls-l

[root@localhost ~] # cat files.txt | rm-rvf

Cont.

[root@localhost ~] # cat files.txt | xargs ls-l

-rw-r--r--. 1 root root 0 Mar 11 10:35 / home/file1

-rw-r--r--. 1 root root 0 Mar 11 10:35 / home/file2

-rw-r--r--. 1 root root 0 Mar 11 10:35 / home/file4

-rw-r--r--. 1 root root 0 Mar 11 10:35 / home/file5

[root@localhost ~] # cat files.txt | xargs rm-rvf

Removed'/ home/file1'

Removed'/ home/file2'

Removed'/ home/file4'

Removed'/ home/file5'

Case 2

[root@localhost ~] # touch / home/file {1.. 5}

[root@localhost ~] # cat files.txt | xargs-I {} ls-l {}

-rw-r--r--. 1 root root 0 Mar 11 10:40 / home/file1

-rw-r--r--. 1 root root 0 Mar 11 10:40 / home/file2

-rw-r--r--. 1 root root 0 Mar 11 10:40 / home/file4

-rw-r--r--. 1 root root 0 Mar 11 10:40 / home/file5

[root@localhost ~] # cat files.txt | xargs-I {} cp-rvf {} / tmp

'/ home/file1'->' / tmp/file1'

'/ home/file2'->' / tmp/file2'

'/ home/file4'->' / tmp/file4'

'/ home/file5'->' / tmp/file5'

[root@localhost ~] # cat files.txt | xargs-I YANG cp-rvf YANG / var/tmp

'/ home/file1'->' / var/tmp/file1'

'/ home/file2'->' / var/tmp/file2'

'/ home/file4'->' / var/tmp/file4'

'/ home/file5'->' / var/tmp/file5'

Case 3

[root@localhost ~] # find / etc-iname "* ifcfg*" | xargs-I {} cp-rf {} / tmp

Tags: Cases materials studies parameters outlines courses routes notes articles help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Docker macOS Linux Xiaomi