Keep Track of Changes Made to a File s Group with chgrp


Keep Track of Changes Made to a File's Group with chgrp

chgrp -v
chgrp -c

You've probably noticed that chgrp, like all well-behaved Linux applications, only gives you feedback if there's a problem. If a program works and does its job correctly, it doesn't bother you with "Hey! I did it, and it worked!" Instead, Linux command-line applications are only noisy when an issue needs to be resolved.

If you want to know what chgrp is doing while it's doing it, first try the -v (or --verbose) option. This tells you, every step of the way, just what tasks chgrp performs.

$ ls -lF drwxr-xr-x 4 scott scott ... by_pool/ -rw-r--r-- 1 scott scott ... libby_arrowrock.jpg -rw-r--r-- 1 scott family ... libby.jpg -rw-r--r-- 1 scott scott ... libby_on_couch.jpg drwxr-xr-x 2 scott scott ... on_floor/ $ chgrp -v family * changed group of 'by_pool' to family changed group of 'libby_arrowrock.jpg' to family group of 'libby.jpg' retained as family changed group of 'libby_on_couch.jpg' to family changed group of 'on_floor' to family $ ls -lF drwxr-xr-x 4 scott family ... by_pool/ -rw-r--r-- 1 scott family ... libby_arrowrock.jpg -rw-r--r-- 1 scott family ... libby.jpg -rw-r--r-- 1 scott family ... libby_on_couch.jpg drwxr-xr-x 2 scott family ... on_floor/ 


Notice what happened in this example. The libby.jpg file was already a member of the family group, but -v went ahead and reported on it anyway, making sure that you knew that libby.jpg's group was kept as family. If you're changing groups, you probably don't need to know about items that already belong to the new group. In cases like that, you want to use the -c (or --changes) option, which (unsurprisingly) only reports changes made.

$ ls -lF drwxr-xr-x 4 scott scott ... by_pool/ -rw-r--r-- 1 scott scott ... libby_arrowrock.jpg -rw-r--r-- 1 scott family ... libby.jpg -rw-r--r-- 1 scott scott ... libby_on_couch.jpg drwxr-xr-x 2 scott scott ... on_floor/ $ chgrp -c family * changed group of 'by_pool' to family changed group of 'libby_arrowrock.jpg' to family changed group of 'libby_on_couch.jpg' to family changed group of 'on_floor' to family $ ls -lF drwxr-xr-x 4 scott family ... by_pool/ -rw-r--r-- 1 scott family ... libby_arrowrock.jpg -rw-r--r-- 1 scott family ... libby.jpg -rw-r--r-- 1 scott family ... libby_on_couch.jpg drwxr-xr-x 2 scott family ... on_floor/ 


This time, nothing was reported to you about libby.jpg because it was already in the family group. So if you want a full report, even for files that won't be changed, use -v; for a more concise listing, use -c.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net