for i in *; do file $i | grep -q ELF || continue; readelf -d $i | grep -q RPATH || echo $i; done

Check if the files in current directory has the RPATH variable defined

Using gentoo prefix portage I got in a situation where some packages did not contain the needed RPATH variable. This command helped me to find out which ones I should recompile
Sample Output
libapr-1.so.0.4.5
libct.so.4.0.0
libsqlite3.so.0.8.6
libsybdb.so.5.0.0

0
By: keymon
2011-08-16 17:37:23

These Might Interest You

  • Set a bookmark as normal shell variable p=/cumbersome/path/to/project To go there to p This saves one "$" and is faster to type ;-) The variable is still useful as such: vim $p/<TAB> will expand the variable (at least in bash) and show a list of files to edit. If setting the bookmarks is too much typing you could add another function bm() { eval $1=$(pwd); } then bookmark the current directory with bm p


    4
    to() { eval dir=\$$1; cd "$dir"; }
    hfs · 2010-10-15 13:40:35 3
  • Uses the PHP binary to check the syntax of all .php files in or below the current working directory. Really handy for doing that last minute check before you commit code to the repository. Show Sample Output


    1
    find . -name "*.php" -exec php -l {} \; | sed -e "/^No syntax/d"
    TomNomNom · 2009-02-10 09:14:25 0
  • You could do the following, however, brace expansion with {} is not defined in POSIX, and therefore not guaranteed to work in all shells. But, if it does, it's more convenient (although it's certainly not less typing): cp -r {*,.??*} /dest Sometimes there are times when I need to cp(1), mv(1) or rm(1) files recursively, but don't want to traverse the previous directory by following ../../../../ etc out of the current directory. This command prevents that. The secret sauce is ".??*". The file globbing ensures that it must start with a dot, and be followed by at least two characters. So, three characters must exist in the filename, which eliminates "." and "..".


    6
    cp -r * .??* /dest
    atoponce · 2011-12-16 23:41:03 6
  • Here is how to replicate the directory structure in the current directory to a destination directory (given by the variable DESTDIR), without copying the files.


    1
    find . -type d -print0 | (cd $DESTDIR; xargs -0 mkdir)
    rocketraman · 2010-11-18 09:33:51 0
  • I use this on Debian to rename files that exist in directories but do not have the year in the file name. The directory has the year but the files inside don't. How I explain how this runs: The dir variable grabs the name of the folder. Using rename, substitute the name of the first file and remove the extension, then rename it to the directory name. To test this before you run it, change -v to -vn. Show Sample Output


    0
    dir=${PWD##*/}; rename "s/`ls -b1 | head -n1 | sed 's/.\{4\}$//'`/$dir/" -v *
    codycook · 2014-07-08 03:20:04 0
  • fcd : file change directory A bash function that takes a fully qualified file path and cd's into the directory where it lives. Useful on the commadline when you have a file name in a variable and you'd like to cd to the directory to RCS check it in or look at other files associated with it. Will run on any ksh, bash, likely sh, maybe zsh. Show Sample Output


    1
    function fcd () { [ -f $1 ] && { cd $(dirname $1); } || { cd $1 ; } pwd }
    relay · 2009-09-03 18:58:13 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: