Different Terminal operation methods

I'm writing a report on my blog on some Terminal operations I performed recently to rescue a drive that was locked and with corrupt ACL. I want to get some things straight in my mind before I spread errouneous info.
When using a command like:
sudo cd /Volumes/Media
sudo find . -flags uchg -exec chflags nouchg {} \;
Which as I understand it will find all locked files on /Volumes/Media and unlock them
or using a command like:
sudo chflags -R nouchg /Volumes/Media
Which as I understand it will unlock ALL files recursively from the given directory, which effectively does the same thing as above.
What is the functional or operational difference between those two methods? Is there a safer or more preferable method?
Also, what is the difference between find . and find /
The Apple Discussions have been greatly helpful the past few weeks as I've learned more and more about how to get things done in Terminal. Thanks to all who share their knowledge here. I want to make sure I understand things fully before I make incorrect assumptions.
cheers
Adam

As as been explained above the
sudo cd ...
command is useless.  Frank Caggiano has explained why the sudo cd does not work as you think, but if you do not understand what he said, you need to come back and ask, as the concept of what happens iin a subprocess stays in a subprocess.  Things like your current working directory and shell variable and environment variable changes in a subprocess do not affect the originating shell (namely the one issuing the command prompt).  If you do not understant this, you will get tripped up again and again in the shell.
I'm assuming you have access to /Volume/Media, you cd without the sudo.  If for some reason you cannot cd to /Volume/Media, then you will need to take a totally different approach.
etresoft has mentioned that the 'find' approach will only modify the files that are locked, where as the chflags -R approach will blindly modify every file.  On the surface this may not appear to affect the end result, but the chflags -R approach will also change the ctime (Change Time) of every file, where as the 'find' approach will only change the ctime for the files that need changing.
The change to ctime may cause an incremental backup utility to backup every file in /Volume/Media instead of just the few files that have had their flags changed.
Also, what is the difference between find . and find /
. in Unix file systems is the current directory.  .. is the parent directory ../../ is the grandparent directory, etc...
/ is the top level of the boot file system.  From here every other file accessible via the operating system is somewhere under /
As has been explained, both . and / can be dangerous.  . is dangerous if you are not where you think you are, such as the case of using sudo cd no actually placing you where you think are going.  / is dangerous as depending on what you are doing with the 'find' command you can make some non-reversable file system modifications.
When playing with 'find' you might want to NOT include -exec until you absolutely know that the 'find' command you are creating spits out exactly what files you need to modify.  Or if you want to test with -exec, then use echo first
find . -flags uchg -exec echo chflags nouchg {} \;
where the echo command will display the chflags command that you plan to exeucte, but will not actually change anything.  You can then verify that the commands look good and the files being changed are what you expect.  You can later either remove the 'echo' or just pipe the command into sh
cd /Volumes/Media
find . -flags uchg -exec echo chflags nouchg {} \; | sudo sh

Similar Messages

  • How to apply different Logical operations to N.of Signals

    Hello all,
    Please help me if anyone have idea about this.
    I have “N” number of signals. I want to apply different Logical operations for this.
    For Example:
          (((SigA >= 30 && SigB <=55) || (SigC = 42)) && (SigD > 45))
    ((((SigD >= 89.25 && SigF <=55.568) ||(SigG = 156.89)) && (SigA >= 45)) || ((SigF – Sig A) >25))
    Here Conditions will change every time. User can input different conditions (like Excel calculations). I need to check signals as per these type of conditions. Is there is any tool kits available in LabVIEW / we need to develop?
    Currently I’m thinking about string manipulations to extract the each condition . Once first condition is finished then check this results with next conditions (so on..)
    Munna

    Hi GerdW,
    After long time again I stated doing this task. Could you please help me in this.
    As per my snippet, at 1st making array based on given String. From that string I need to check where open & closed brackets are coming to do logical operations.
    For Example: (2 OR ((1 AND 2) OR 3))
    Index
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    String
    2
    O
    R
    1
    A
    N
    D
    2
    O
    R
    3
    Please give me any idea/sample VI for the same.
    Here, 1,2 & 3 are Indices of Boolean 2D Array.
    Munna

  • What is the different between payment methods Wire and EFT

    Hi All
    can anybody tell me What is the different between payment methods Wire and EFT ?
    Regards ;

    WIRE:
    Wire is transfer of amount due directly to the supplier's bank it is an electronic transfer of funds
    This mode of payment is used for international suppliers.
    It can be paid in foreign currency or USD.
    Wire payments are same day payments.
    EFT:
    EFT ensures funds transfer from one bank account to another using electronic links.
    Can be used to make payments into domestic banks (within US) in USD only.
    It is faster than check payments.
    Hope this helps.

  • Trying to uderstand different types of methods.

    Well, basically, I'm trying to uderstand the different types of methods there are.
    I uderstand private static, public static, private void and public void. Public means the method can be called from another class, private means method can only be called from within its own class. Static - some value is going to be returned, Void - no values are returned.
    These are the ones I don't understand for sure;
    static {
       try { ... }
       catch(...) { ... }
    } This method tries to do something and catches exception. But, it isn't public or private and it doesn't have a name, how does it fire?
    A void someName() method with no public or private prefix. Who can fire this method?
    final void someName(), static class someName(), and protected void someName() are other methods I don't understand.
    All help appreciated.

    Static - some
    value is going to be returned, No. Static means the method is associated with the class as a whole, not with any particular instance of the class. It has nothing to do with what, if anything, it returns.
    These are the ones I don't understand for sure;
    static {
    try { ... }
    catch(...) { ... }
    This method tries to do something and
    catches exception. But, it isn't public or private
    and it doesn't have a name, how does it fire?It's not a method. It's a static initializer. It runs when the class is loaded.
    A void someName() method with no public or
    private prefix. Who can fire this method?Without public, protected, or private, it's "default access" or "package access." It's only accessible within that class or to classes in the same package.
    >
    final void someName()[/i
    ], static class
    someName(), and protected void someName()
    are other methods I don't understand.
    You should go through a tutorial or introductory text.
    See Resources for Beginners for a list.
    http://www.thejword.com/3.html#beginner_resources

  • Multiple integration flows for different business operations

    Hi - I have following business requirement & need ur advice.
    There are different business operations (read as INSERT/DELETE/QUERY) to performed on same business object (read as CUSTOMER). In order to develop these integration use case I can have following three approaches.
    *1. Single Requestor ABCS & Single Provider ABCS -* Develop single integration flow & implement logic for the business operations in them. That means, Develop single Requestor ABCS for all business operations, which will call the EBS and again EBS would call same Provider ABCS. Both Requestor & Provider ABCS would implement business logic for all business operations required.
    *2. Single Requestor ABCS & Multiple Provider ABCS -* In this case the flows for all business operations starts with single point service. That means, Develop single Requestor ABCS for all business operations, which will call the EBS and again EBS would call different Provider ABCS based on the business operations. The Requestor ABCS would implement business logic for all business operations required. There would be different ABCS service for different business operations.
    *3. Multiple Requestor ABCS & Multiple Provider ABCS -* In this case the completely independent flows are to be developed for all business operations. Independent Requestor ABCS and independent Provider ABCS. Off course if there some common business logic for all or some business operations, those can be implemented as common service & can used across all independent flows for different business operations.
    Please do suggest what approach would be best one to pick up. Or it is case to case basis. In case yes, please suggest the criteria on which the decision can be taken.
    Thanks In Advance
    Priyadarshi

    Hi Pryadarshi,
    AIA recommends having an ABCS for each Verb and Noun combination for a specific Business Process, i.e. CreateCustomerABCS and UpdateCustomerABCS. Therefore, #3 would be the preferred approach. This is to allow for maximum flexibility. However, you may have a process that demands to model the integration as #2.
    The decision would depend on how the participating application services are modeled and the granularity of individual service call. For example, a ProcessCustomer invocation at the source end may call CreateCustomer provider service.
    Regards
    Rohit

  • Booting different Mac operating systems.

    In the Windows world, the user can set up a computer to allow the selection of different operating system versions, such as Win98, WinXP, WinVista, to be chosen at startup.
    Can this be done with Leopard, or possibly Snow Leopard? I'd like to upgrade, yet keep the existing system installed. I am not referring to using an emulator like Parallels Desktop, I'm already doing that.
    One of the things that's the most frustrating to me is the different terminology used. Took me awhile to figure out that Airport is wireless networking, and today I discovered that Automator appears to be a macro recorder. Yet I've got a friend who could never figure out the other terms but the Mac terms make perfect sense to her!! Go figure!!! LOL
    And before someone suggests it, I bought a Leopard book last spring when I bought this Mac, but a summer job I took involved 10-12 hour workdays and I just haven't had the time or energy to get it read.
    Ken

    Supported different Mac operating systems (and unix-like Linux for Mac) can be
    booted in the same computer; in order for multiple Mac OS X systems to work,
    they need to be in their own partition so as to not mix up their differences, and
    applications that may work well in one may not do so well in another. So, each
    OSX has its own Applications and other folders, in their own home partitions.
    Snow Leopard 10.6.x is intended for Intel-based Macs; Leopard 10.5.x is the
    last version supporting PPC-based Macs. Some PPC Macs did not like 10.5.
    You could probably use a bootable externally enclosed hard disk drive to have
    additional system(s) available for the computer, instead of reformatting the HD
    & partitioning it for several systems. The OEM drive may be too small for more
    than one OS installed, depending on the uses expected and storage demands.
    Computers that can't support the latest OS X 10.6.x won't, and they can't use
    an older OS X than the one they shipped with, the exact as-shipped version.
    Some models can run several OSs including variants of Linux or unix for Mac,
    and select supported OS X versions; plus older Macs running dualboot OS9/X.
    The Support pages on the Apple site have helpful information on specific Macs
    & other hardware, so that may be of help to read about each model in question.
    Also, the free download offline database: http://mactracker.ca is fairly handy.
    Good luck & happy computing!

  • Extend abstract class & implement interface, different return type methods

    abstract class X
    public abstract String method();
    interface Y
    public void method();
    class Z extends X implements Y
      // Compiler error, If I don't implement both methods
      // If I implement only one method, compiler error is thrown for not
      // implementing another method
      // If I implement both the methods,duplicate method error is thrown by 
      //compiler
    The same problem can occur if both methods throw different checked exceptions,or if access modifiers are different..etc
    I'm preparing for SCJP, So just had this weired thought. Please let me know
    if there is a way to solve this.

    Nothing you can do about it except for changing the design.
    Kaj

  • Calling a different AM's method from a controller

    PAGE STRUCTURE:
    Main Page - FirstCO, FirstAM
    Main page's nested AM, nestedAM
    A method, newmethod in nestedAM
    A subregion - SecondCO, SecondAM
    A submit button 'applyButton'
    WHAT I WANT TO DO:
    When applyButton is hit I want to call a method in FirstAM;s nested AM from SecondCO.
    I tried using this code:
    OAApplicationModule oaapplicationmodulem= pageContext.getRootApplicationModule();
    OAApplicationModule oaapplicationmodule3 = (OAApplicationModule)oaapplicationmodulem.findApplicationModule("nestedAM");
    if(oaapplicationmodule3 != null)
    oaapplicationmodule3.invokeMethod("newmethod",null);
    RESULT:
    oaapplicationmodulem says 'Out of scope' when I place breakpoints and debug this, and oaapplicationmodule3 is always null.
    QUESTION:
    Can anyone suggest why this is happening?
    Another way I thought this might be done:
    When applybutton is pressed the FirstCO is always getting executed before SecondCO. If there is anyway to make the FirstCO run first, then secondCO, and then FirstCO again?
    Thanks in advance
    Kalp

    Since you said a sub region I thought it is a sub region of the Main page. You cannot access methods in a different page. If you really need that either add the relevant VOs in your secondAM and add the method, or nest the firstAM in the second page.

  • How to call different managed bean methods on a page template button

    Dear All,
    Use Case:
    I have a Page Template and inside this page template is a popup screen which is common to all my
    pages. My popup has OK and Cancel button only.
    My question is this, there are lots of pages that uses this template.
    How is it possible to invoke a managed bean methods dialoglistener when say for example the user clicks the OK button?
    One thing common among the pages is that they are included in some kind of a taskflow and I have configured
    a managedbean in a pageflowscope variable in each taskflow and I just wanted to pass the
    My Template
         - TaskFlow 1 (ManagedBean1.dialogListener)
         - TaskFlow 2 (ManagedBean2.dialogListener)
         - TaskFlow 3 (ManagedBean3.dialogListener)
    Each dialog listener does different things.     
    How to do this?
    JDEV 11G PS3
    Thanks

    Found my answer here... http://www.oracle.com/technetwork/developer-tools/adf/learnmore/79-global-template-button-strategy-360139.pdf
    Thanks!

  • RE-POST: different request, same method

    Hi:
    Sorry, I have to re-post as Anamitra acquired my thread. :)
    I have a strange requirement.
    It is to expose a session bean method that could take different xml inputs.
    For example:
    TestBean exposes testMethod(String xmlstr)
    xmlstr could be of schema xmlSchema1.xsd
    or xmlstr could be of schema xmlSchema2.xsd
    In future it could also represent xmlSchema3.xsd... and so on.
    What is the right approach in this scenario?
    I was thinking to create a different web service for different xsd.
    Say, webservice1 imports xmlSchema1.xsd, webservice2 imports
    xmlSchema2.xsd...
    Unfortunately due to some design restrictions, I cannot create different
    methods in my session bean like testMethod1, testMethod2....
    Is there any other better way to do this in one web service?
    Thanks in advance for any suggestions.
    /k

    Bruce,
    Thanks for your response.
    If I use attachments, how do I represent the attachment content in the WSDL?
    As I mentioned earlier, my requirement is to associate the requests against
    more than one some schema definition.
    /k
    "Bruce Stephens" <[email protected]> wrote in message
    news:[email protected]..
    Hello,
    Why not just send your data using attachments instead of creating
    multiple methods.
    http://edocs.bea.com/wls/docs81/webserv/implement.html#1072763
    HTHs,
    Bruce
    Karthik V wrote:
    Hi:
    Sorry, I have to re-post as Anamitra acquired my thread. :)
    I have a strange requirement.
    It is to expose a session bean method that could take different xml
    inputs.
    >>
    For example:
    TestBean exposes testMethod(String xmlstr)
    xmlstr could be of schema xmlSchema1.xsd
    or xmlstr could be of schema xmlSchema2.xsd
    In future it could also represent xmlSchema3.xsd... and so on.
    What is the right approach in this scenario?
    I was thinking to create a different web service for different xsd.
    Say, webservice1 imports xmlSchema1.xsd, webservice2 imports
    xmlSchema2.xsd...
    Unfortunately due to some design restrictions, I cannot create different
    methods in my session bean like testMethod1, testMethod2....
    Is there any other better way to do this in one web service?
    Thanks in advance for any suggestions.
    /k

  • I have this idea - Copying between different terminal directories.

    Hi,
    I have no idea if a program that does the following exists. The concept is a bit hard to explain but I'll do my best.
    Lets say that you have to terminals opened. In terminal 1 you are currently working in ~/build/foobar and in terminal 2 you are working in ~/archiscool/foobar/letshaveadrink/ and you want to copy a file from ~/build/foobar to ~/archiscool/foobar/letshaveadrink. The usual way of doing this would be to type
    "[user@host ~/build/foobar/]$ cp foobar ~/archiscool/foobar/letshaveadrink/"
    and it is usually very quick to do with completion, but it would be much easier if one could build a script (lets call it "t2dir") that could identify the working dir of terminal 2. Then you'd only have to type
    "[user@host~/build/foobar/]$ cp foobar t2dir".
    Would it possible to probe terminals for their working directories?
    Last edited by Ashren (2008-04-17 09:47:00)

    Here's an alternative: use `ls /dev/pts` to get a list of running ttys and present that list to the user and let them choose the destination. That way they won't have to know the "/dev/pts" number of the tty they want to copy to. It will be nice to people who use title-bar-less windows (like me).
    #!/bin/sh
    # Find out the PIDS of running ttys
    PIDS=""
    for PTS in $(ls /dev/pts); do
    #echo "$PTS"
    PID=$(pgrep -nt "pts/$PTS")
    #echo "$PID"
    if [ $PID != $$ ]; then
    PIDS="$PIDS $PID"
    fi
    done
    # Count the PIDS
    i=0
    for PID in $PIDS; do
    i=$(($i + 1))
    done
    # Behave differently based on number of available destinations
    case $i in
    0)
    echo "No other tty to copy to. Ignoring."
    exit 1
    1)
    DEST=$(pwdx $PIDS)
    #echo "$DEST"
    echo "Only one possible destination. Copying to $DEST."
    exit $(cp "$1" "$DEST")
    *) # Many destinations
    j=0
    for PID in $PIDS; do
    j=$(($j + 1))
    echo "$j. $(pwdx $PID | sed -r -e's/^[0-9]+: //')"
    done
    echo "Select destination by entering its number (1, 2, etc.): "
    read NUM
    if [ $NUM -lt 1 ]; then
    echo "Error: there is no number smaller than 1 in the list."
    exit 2
    elif [ $NUM -gt $j ]; then
    echo "Error: there is no number greater than $j in the list."
    exit 3
    elif [ $NUM -gt 0 ] && [ $NUM -le $j ]; then
    k=1
    for PID in $PIDS; do
    if [ $k -eq $NUM ]; then
    DEST="$(pwdx $PID | sed -r -e's/^[0-9]+: //')"
    exit $(cp "$1" "$DEST")
    fi
    k=$(($k + 1))
    done
    else
    echo "Error: cannot understand what you wrote."
    exit 4
    fi
    esac
    When in sh, I'm paranoid about spaces and metacharacters and globs and I don't know how to use arrays. I guess this explains the weird structure of the script.
    It sucks that it doesn't check for duplicates when listing out possible destinations... I should write this in a more comfortable language like perl. But I should go do some real work now.
    Last edited by peets (2008-04-18 14:39:04)

  • Interested in Performance Difference Between Different SL Install Methods?

    Go here: http://discussions.apple.com/thread.jspa?messageID=10077299&#10077299.

    Run a benchmark for your specific case??
    Yes. If you are to implement such an operation, try both, using your actual data, and see which performs best. I can't speak to this particular case, but very often to performance questions is
    it depends. So the only way to find out when you are interested for a specific case is to test. And keep in mind that next time it could be different.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Different Oracle Operating system user

    Hi
    I must install in a Solaris system an Oracle Management System (9i) with an Operating system user different that Oracle. (oramaster)
    When I begin the installation, the Universal Installer, require the oracle user.
    How to avoid this required oracle user?
    Thank you

    I have to install Oracle Enterprise manager (OEM)
    (9i) with a o.s. user different than OracleYou can install oracle/OEM with OS user different than Oracle. Add that user to dba group or dba and oinstall group.

  • Differing Proximity Operator Results by Invocation Style

    I'm kicking the tires on SES 10.1.8.2. In particular I am using proximity as a test of different invocation methods in 10.1.8.2.
    The 10.1.8.2 admin guide states that ["foo bar"~30] should be equivalent to issuing [otext::near((foo, bar),30)], however I'm seeing that the latter returns 1 fewer documents. Interestingly enough, if I issue the same near() criteria in a SQL statement I get the "right" number of documents.
    Any ideas?
    SES Basic Search (proximity)
    "license subscriber"~30
    ==> 18 Documents Returned
    SES Basic Search (Oracle Text pass through to equivalent NEAR() statement)
    otext::near((license, subscriber),30)
    ==> 17 Documents Returned (??)
    Database Direct (my swag at the equivalent SQL statement)
    SELECT DOC.title, DOC.display_url, SCORE(1)
    from eqsys.eq$_data_source DS,
    eq_test.eq$doc DOC
    WHERE CONTAINS(DOC.cache_file_path, 'near((license, subscriber), 30)', 1) > 0
    AND DOC.ds_id = DS.ds_id
    AND DS.ds_name = 'Qualcomm'
    order by SCORE(1);
    ==> 18 Documents Returned

    I'm kicking the tires on SES 10.1.8.2. In particular I am using proximity as a test of different invocation methods in 10.1.8.2.
    The 10.1.8.2 admin guide states that ["foo bar"~30] should be equivalent to issuing [otext::near((foo, bar),30)], however I'm seeing that the latter returns 1 fewer documents. Interestingly enough, if I issue the same near() criteria in a SQL statement I get the "right" number of documents.
    Any ideas?
    SES Basic Search (proximity)
    "license subscriber"~30
    ==> 18 Documents Returned
    SES Basic Search (Oracle Text pass through to equivalent NEAR() statement)
    otext::near((license, subscriber),30)
    ==> 17 Documents Returned (??)
    Database Direct (my swag at the equivalent SQL statement)
    SELECT DOC.title, DOC.display_url, SCORE(1)
    from eqsys.eq$_data_source DS,
    eq_test.eq$doc DOC
    WHERE CONTAINS(DOC.cache_file_path, 'near((license, subscriber), 30)', 1) > 0
    AND DOC.ds_id = DS.ds_id
    AND DS.ds_name = 'Qualcomm'
    order by SCORE(1);
    ==> 18 Documents Returned

  • Setup and save different terminal sessions

    Hi, all.
    I use some terminal-based applications, i.e.TeX-related unix utilities, and MySQL on Snow Leopard (latest version, I suppose).
    I like to set a different screen and starting folder for each application. For example, 'Grass' for TeX, 'Pro' for MySQL, and so on.
    I had attempted it by copying the 'termina.appl', assigning a copy to each application, and naming them distinctively.
    I'm very sorry that each copy of 'terminal.app' remembers always the last setting. They are all same appearance.
    Is that possible in Mac?

    Don't make copies of the Terminal application. That won't do any good at all.
    Set up the windows the way you want them, then select "Save Windows as Group" from the Window menu.

Maybe you are looking for