coolcommands.com - the search engine for unix sysadmins :: unix commands and scripts
Monday September 6, 2010


 Home
 Search
 Advanced Search
 Category Search
 Affiliates
 Acknowledgements
 Cool Links

Username

Password

Remember me
Forgot your password?
Create an account

Who's Online
We have 26 guests online

Newest Member

Starmamex

Hit Counter
4760795 Visitors

cool Statistics
coolcommands:1313
Categories:82
Total queries:523831
Members:4281





Search coolcommands.com
Search Keyword:


coolcommand

xargs - build and execute command lines from stdin
Description

xargs allow you to build and execute command lines from standard input:

To find all files edited today and pipe to pr and then to printing:

# find . -type f -mtime -1 -print | xargs pr -n | lp

To find all unique owners of all files in /bin:

# find /bin -type f -follow | xargs ls -al | awk ' NF==9 {print $3}' | sort -u

To find all files with .txt extension, echo name and then delete:

# find . -type f -name "*.txt" | xargs -i ksh -c "echo deleting {}; rm {}"

To find all files with .txt extension, echo name and then delete

# find . -type f -name "*.txt" | xargs -I ksh -c "echo deleting {}; rm {}"

Creates in usr/project directory a copy of current working directory structure:

# find . -type d -print | sed 's@^@/usr/project@' | xargs mkdir

Output of both commands on one line:

# (logname; date) | xargs

Places all file names in current dir on one line and redirects to file:

# ls | xargs echo > file.ls

Display contents of file.ls to stdout, one name per line:

# cat file.ls | xargs -n1

List current dir, prompt user to remove each file individually:

# ls | xargs -p -n1 rm

Concatenate all contents of all files whose names are contained in file:

# xargs cat < file > file.contents

Move all files from dir $1 to dir $2 and echo each move as it happens (-t option)

# ls $1 | xargs -I {} -t mv $1/{} $2/{}
Example

xargs

Return to search results

Random coolcommands

coolcommand: lpstat - list status of all print queues defined
Example: lpstat
[show me the details]
coolcommand: get_partition_state - to get the partition state on a HMC
Example: get_partition_state –m < managed_system > –p < partition_name >
[show me the details]
coolcommand: vxprint - how to list all the volumes on a boot disk Veritas Volume Manager
Example: vxprint -t -v -e 'aslist.aslist.sd_disk="bootdisk"'
[show me the details]
coolcommand: lpr - print a file
Example: lpr -Pprintername /etc/hosts
[show me the details]

coolcommands.com - the search engine for UNIX sysadmins :: unix commands and scripts



FREE
myPMS

Password
Management
System

by

LVOware.com




Top 5 Submitters

lvo1138
audet37
kah00na32
Mariom24
lebjf00013

Top 5 Searches

Category Solaris42690
Category AIX38082
Category General UNIX34254
solaris20802
aix19388

Terms of Use
Privacy
Contact


 
coolcommands.com © 2010. All Right Reserved.
Programming by PRATTICO Consulting . Hosting by Apricusum