AIX 5L Basics (Unit 14) – AIX Utilities – Part 1

xargs – Reads a group of arguments from stdin and runs an AIX command with that group of arguments.
Helps commands that can’t take input from the pipe | or stdin such as rm, ls, qprt, mv

cat oldfilelist | xargs -t rm
-t – means tell me or show me output
rm file1 file2 …

ls > printlist
xars -t qprt < printlist qprint file1 file2 ... ls | xargs -t -I {} mv {} {}.old -I - means insert mv apple apple.old find . -type f -mtime +30 | xargs -t rm rm ./file1 ./file2 ... find . -type f | xargs -t grep -l Hello grep -l Helo ./file5 .file7 ... -links: ---------- find /home -type f -links +1 | xargs ls -li ln myfile akafile - gives an addional name to the same file 127 -rm-r--r-- 3 wltest staff 156 Date /home/wltest1/myfile 127 -rm-r--r-- 3 wltest staff 156 Date /home/wltest2/yourfile 127 -rm-r--r-- 3 wltest staff 156 Date /home/wltest3/akafile same inodes of 127 number of links 3 same number of bytes 156 alias and find: ------------------- cat $HOME/.kshrc - ENV=$HOME.kshrc in .profile alias mylinks='find . -type f -links +1 | xargs ls -li' alias myrm='find . -type f -mtime +30 | xargs rm' which (find or grep): ----------------------------- Displays the location of the 'find' or 'grep' commands. which, whereis, whence file: ------ file filename - tells what type of file it is (ascii text, executable binary, directory) filename /home/wltest/.profile (ascii text) filename /usr/bin (directory) filename /usr/bin/vi (executable) ls > filename
cat filename
file -f filename
-f tells file type of all files in filename

Leave a Reply

Your email address will not be published. Required fields are marked *