Showing posts with label Bash. Show all posts
Showing posts with label Bash. Show all posts

Friday, June 19, 2015

How to find a Java class file in your Maven repository (or any other directory full of jar files)


find . -name "*.jar" | xargs grep -r [CLASS NAME]

In case you are ever wondering why your builds aren't working.

Tuesday, December 18, 2012

find and mv files in bash

I thought I would document this shell command for posterity's sake.  My bash skills are sketchy so I will need to look it up again.

I downloaded a few zip files this morning and needed to move them to a new directory.  Moving them to a new directory from the command line was trivial:


for i in $(find . -type f -newermt 2012-12-18); do cp $i /[NEW DIRECTORY PATH/; done;

Tuesday, October 12, 2010

xlcip or How to copy past from the command line to x-windows

Brain Ashburn, my colleague in the Atlanta Red Hat office, introduced me to the xclip utility today. It copies output from the command line and puts it into x-windows.

For example, to copy the current directory :
 pwd | xclip -i -sel "clip"

There are of course more useful things that can be piped to it. To try it out create a file, add some text and :
cat newfile | xclip -i -sel "clip"

Its available through yum :
sudo yum install xclip