- page 3

Regexp hints

Regexp hints

echo "bla bla word word1 = string1 string2" | sed -e 's/.* \([^ ]*\)=.*/\1/g' Some basic regexp hints: the first /…/ is what your string should match s means substitute/replace the last /…/ is the replacement g means global, replace all occurrences a . will…

Continue reading →

Checking the Validity Date of an SSL Certificate

Checking the Validity Date of an SSL Certificate

echo | openssl s_client -connect maven.escenic.com:443 2>/dev/null | openssl x509 -noout -dates

Continue reading →

How to restart network interface

How to restart network interface

ifdown eth0 ifup eth0

Continue reading →

How can I monitor the memory usage?

How can I monitor the memory usage?

watch -n 5 free -m

Continue reading →

Default max heap size

Default max heap size

If you need to get the default max heap size used by your machine: java -XX:+PrintFlagsFinal -version 2>&1 | grep MaxHeapSize

Continue reading →

How to convert the ^M linebreak to ‘normal’ linebreak in a file opened in vim?

How to convert the ^M linebreak to ‘normal’ linebreak in a file opened in vim?

:%s/<Ctrl-V><Ctrl-M>/\r/g Where means type Ctrl+V then Ctrl+M. Explanation :%s substitute, % = all lines <Ctrl-V><Ctrl-M> ^M characters (the Ctrl-V is a Vim way of writing the Ctrl ^ character) /\r/ with new line (\r) g And do it globally (not just the first occurrence on…

Continue reading →

find difference between two text files with one item per line

find difference between two text files with one item per line

grep -Fxvf file1 file2 Where -F, –fixed-strings Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. -x, –line-regexp Select only those matches that exactly match the whole line. -v, –invert-match Invert the sense of matching, to…

Continue reading →

how to extract the first and the last x lines of a big file

how to extract the first and the last x lines of a big file

If you are debugging big txt files, i.e. 6G+, a good start is to check what is at the top and at the end of it. export file=/Users/racoonlab/Downloads/engine.out; head -n 1000 $file >/tmp/extract; echo … skipping … >> /tmp/extract; tail -n 1000 $file >> /tmp/extract

Continue reading →

Find a particular request and its relative url

Find a particular request and its relative url

If you need to find the url that serves a particular requests, i.e.: 400, you can try running this on the varnish server: varnishlog -i RxURL,TxStatus | tee /tmp/varnish.log It gives significantly less output and shows the URL and status code for each request. For…

Continue reading →

How to remove the ^M return character on Linux

How to remove the ^M return character on Linux

dos2unix -n oldfile.txt newfile.txt or if the error is within a script: sed -i -e 's/\r$//' your-script.sh Executing a shell script, might end with /bin/bash^M: bad interpreter: No such file or directory The ^M is a carriage return character. Linux uses the line feed character…

Continue reading →

Page 3 of 16 1 2 3 4 5 ... Last →