Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Jul 012012
 

How to find a class in a Jar file

Answer:

To find a class file in a given Java Jar file, e.g. to find the class "KeyToken" in the file "selenium-server-standalone.jar",

# jar -tf selenium-server-standalone.jar | grep KeyToken
org/yaml/snakeyaml/tokens/KeyToken.class
Jun 292012
 

How to ignore error in Bash script

Answer:

We have learned in the past on how to show the exit status of a given command.

But is it possible ignore the error and return normal exit code even the command has failed?

Yes, pipe "|| true" to the end of command, e.g.

# foo || true
-bash: foo: command not found
# echo $?
0

As you can see even the command foo was not found, our last exit code is still zero.

Jun 232012
 

Show hidden files in Mac OSX

Answer:

To show all the files in Finder, you can open the terminal and type:

defaults write com.apple.finder AppleShowAllFiles TRUE

Then restart Finder

killall Finder