in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

June 2008 - Posts

  • Using the find command to find non executable files

    I had a bunch of dll's I had checked out of a subversion repo that needed to have the execute bit set on them.

    Enter the find command.

    I have never had a great grasp on how to use find, but finally my laziness got the best of me such that I not only figured out how to use it to find the files I wanted, but also how to send them through xargs to make the change.

    So here's the command I used:

    find . -name '*.dll' ! -perm -a+x -print | xargs chmod +x
    

    And here's the breakdown of the arguments . Is the directory we start our search from -name Says that the next argument is the name of the file we are searching for '*.dll' Is the pattern of the file we are looking for. In this case we are looking for *.dll or any file that ends with a .dll extension ! Says to negate the next argument -perm Says that the next argument will be some type of expression that qualifies the file based on its permissions -a+x There are multiple parts to this. The first - says that any permissions can match, if that wasn't there then the match would need to be exact? a+x (see man chmod(1)) is a way to specify permissions. It goes [user or group][operator][permission] so in this case it says Angelll(user, group, owner) [+]have e[x]ecute -print To be honest I'm not sure why this is needed, but all the examples I found with find and xargs seemed to use it

    Then the point of xargs is to take the output of the previous command and pass it as input to the command (in this case chmod +x)

  • My new git alias

    git alias's are very handy and powerful.

    Frequently I want to look through the log and have a quick view of who did what, so I created this alias

    git config --global --add alias.who-did-what 'log --pretty="format:%an - %s"'

     

    the output of which will be something like

    chriso - Fixed bug 145
    matt - Added some neat feature
    wes - fixed one of chris's bugs

    ...

     

    Enjoy

    Technorati tags:
Powered by Community Server (Commercial Edition), by Telligent Systems