|
| cool Statistics |
| | coolcommands: | 1313 | | Categories: | 82 | | Total queries: | 523831 | | Members: | 4281 | |
|
|
|
 |
|
|
Search coolcommands.com
 |
Submitted by:
lvo   |
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
|  |  |  |  |
|
|
|
|
 |
|
|
|
Top 5 Submitters
|
|---|
| lvo | 1138 |
| audet | 37 |
| kah00na | 32 |
| Mariom | 24 |
| lebjf000 | 13 |
Top 5 Searches
|
| Category Solaris | 42690 |
| Category AIX | 38082 |
| Category General UNIX | 34254 |
| solaris | 20802 |
| aix | 19388 |
|
|
|
|