Convert .pem into .key

Convert .pem into .key

root# openssl rsa -in privkey.pem -out private.key

.pem – Defined in RFCs 1421 through 1424, this is a container format that may include just the public certificate (such as with Apache installs, and CA certificate files /etc/ssl/certs), or may include an entire certificate chain including public key, private key, and root certificates. Confusingly, it may also encode a CSR (e.g. as used here) as the PKCS10 format can be translated into PEM. The name is from Privacy Enhanced Mail (PEM), a failed method for secure email but the container format it used lives on, and is a base64 translation of the x509 ASN.1 keys.

.key – This is a PEM formatted file containing just the private-key of a specific certificate and is merely a conventional name and not a standardized one. In Apache installs, this frequently resides in /etc/ssl/private. The rights on these files are very important, and some programs will refuse to load these certificates if they are set wrong.

Character Names

Character Name Character

Accent `
Ampersand &
Angle Brackets < >
Apostrophe ’
Asterisk *
At Symbol @
Braces [ ]
Brackets { }
Circumflex ^
Colon :
Comma ,
Dollar Sign $
Equal Sign =
Exclamation Point !
Hyphen –
Number Sign #
Parentheses ( )
Percent Symbol %
Period .
Pipe |
Plus Sign +
Question Mark ?
Quotation Mark “
Semicolon :
Forward Slash /
Tilde ~
Underscore _
Uppercase Letters A-Z
Lowercase Letters a-z
Numerals 0-9

Enable or disable query logging in Bind.

To enable query logging use:

root# rndc querylog on

To disable query logging use:

root# rndc querylog off

Query logging can also be enabled by explicitly directing the queries category to a channel in the logging section of named.conf or by specifying “querylog yes;” in the options section of “named.conf”.
By default query logging will go to /var/log/messages to avoid this situation, create the logging channels:

logging {
channel default_file {
file "/var/log/named.log" size 100m;
severity dynamic;
print-time yes;
print-severity yes;
print-category yes;
channel queries_file {
file "/var/log/queries.log" size 100m;
severity dynamic;
print-time yes;
print-severity yes;
print-category yes;
category queries { queries_file; };
category default { default_file; };

How to convert bytes to KB and MB in Excel?

In Excel, to convert “bytes” from a cell D2 to KB/MB in a cell C2, insert the following to a cell C2:

=IF(D2>=1048576,D2/1000000&" MB",IF(AND(D2<1048576,D2>1024),D2/1000&" KB",D2&" BYTES"))

And then copy the formula down by dragging the bottom right-hand corner of the cell with the formula to the end of your KB/MB info already entered.

Resizing images on Linux – ImageMagick convert command

With the resolution of today’s digital cameras it is often necessary to resize the files to make them smaller. You may want to reduce the file size before publishing them on the web, or sending in an email. There is however the convert command which is part of the ImageMagick suite. If you are running Linux then you most likely have that installed already, just man convert for more information. The most basic way to use convert is to give a file at a time on the command line:

convert -resize 50% original.jpg newsize.jpg

Alternatively you could replace the percentage with the actual size such as 640×480

convert -resize 640x480 original.jpg newsize.jpg

Where this really comes into it’s own is when you have a directory full of images that you want to convert. This can be used by using the xargs and find commands in conjunction with convert.

find . -iname "*.jpg" | xargs -l -i convert -resize 640x480 {} ../small/{}

Understanding I/O streams numbers.

Handle Name Description
0 stdin Standard input
1 stdout Standard output
2 stderr Standard error

Redirecting the standard error stream to a file. The following will redirect program error message to a file called error.log:

$ program-name 2> error.log
$ command1 2> error.log

Redirecting the standard error (stderr) and stdout to file
Use the following syntax:

$ command-name &>file


$ command > file-name 2>&1

Another useful example:
$ find /usr/home -name .profile 2>&1 | more