nohup egrep -rnw '=\s112' --include=*.java ./ 2>&1 | tee ~/112-audit-nick.txt
Tag: linux
-
Recursively GREP for specific content
-
Run MD5 check sum against all files in a directory
Couple snippets that allow us to run checksum and get unique md5 checksums.
This is two step process. First, we obtain our md5 checksum for all files
find -type f -exec md5sum "{}" + > /opt/checklist.chkThis produces file with following contents
71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif6712032974632727465.tiff 71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif174464329785828524.tiff 71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif6775939766281585264.tiff 71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif7205305688614612348.tiff 71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif3909999865608008175.tiff
Next we parse and get only unique checksums.
cat /opt/checklist.chk | awk '{split($0, a, " "); if(!seen[a[1]]++) print a[1]}'This produces our distinct checksums
71cc452a8ac5a27c32a83e6a0909e7ae
-
Configuring Java JDK on Ubuntu
This is an easy way to configure java on a linux box, all this information is available online.
First we need to obtain the build.
sudo wget http://192.168.201.47:8000/jdk-7u75-linux-x64.gz
Extract from tar
sudo tar xzvf jdk-7u75-linux-x64.gz
Create symbolic link so we can later update the version
sudo ln -s /opt/jdk1.7.0_75/ /opt/java
we edit the /etc/profile and add following two lines
export JAVA_HOME=/opt/java export PATH=$JAVA_HOME/bin:$PATH
finally we ‘source’ the file
source /etc/profile
At this point you should be ready to go, we can verify this by executing
java -version
-
Grepping for multiple strings in a file
We will use egrep which accepts a regular expression to grep for multiple strings.
tail -f localhost_access_log.txt | egrep "\" 404|\" 500"
Here our example looks at logs to see if we got 404 or 500 request.
"GET /favicon.ico HTTP/1.1" 404 973 "GET /login.html HTTP/1.1" 500 1230 "GET /favicon.ico HTTP/1.1" 404 973
-
Apache 408 Connection timedout
nohup tail -f access.log | grep ‘408’ –line-buffered | awk ‘{split($0,a,” “); print a[1]; fflush()}’ | tee -a bad-408.txt
-
Starting jetty via command line an nohup
Somehow I am getting problems starting Jetty via
service jetty start
We will be using unix command called
nohup
“Nohup is a unix command, used to start another program, in such a way that it does not terminate when the parent process is terminated.”I have opted out for using this
nohup java -jar start.jar -Djetty.port=8085
while this works it shown an message
nohup: ignoring input and appending output to `nohup.out'
to fix that up we need to redirect in put and output to /dev/null
nohup java -jar start.jar -Djetty.port=8085 /dev/null &