Linux Utilities


This page is an on-going compilation of anything useful I’m typing into a shell. For a convenient downloadable listing of all of my bash/shell scripts go check out Don’t wait too long though, since I will probably either password protect the directory or remove it completely.

You will need sudo privileges on most of the commands

Hold Packages on Debian/Ubuntu

When you do not want packages to be upgraded when you run apt-get upgrade then you can put them on hold or unhold with the following commands


Put a package on hold

echo "package hold" |  dpkg --set-selections

Remove the hold

echo "package install" |  dpkg --set-selections

Display the status of your packages

dpkg --get-selections

Display the status of a single package

dpkg --get-selections | grep "package"



Hold a package

 apt-mark hold package_name

Remove the hold

 apt-mark unhold package_name

Update and Upgrade and Clean-up one-liner

sudo bash -c 'apt-get update && apt-get upgrade -y && apt-get autoremove -y'



Hold a package

 aptitude hold package_name

Remove the hold

 aptitude unhold package_name


List and Kill Screen Sessions

List all screen sessions

screen -list

Kill a screen session without being inside of it

screen -X -S [session # you want to kill] quit


File Manipulation

Copy one file into multiple files

Combine cat (retrieves the contents of a file) with tee (writes the content away to the files specified in the arguments)

cat original-file | tee file1 file2 file3 file4 file5 file6 blahblah >/dev/null



Count Local HTTPS Port Connections

watch -n 1 "netstat -n | awk '{print $4}' | grep :443 | wc -l"



Export Linux SSL Cert to Windows

Related posts:
Convert x509/PEM SSL Certificate to PFX/P12 from Linux to Windows
Export SSL certificates from Windows to Linux

openssl pkcs12 -export -out "certificate.pfx" -inkey "privkey.pem" -in "cert.pem" -certfile chain.pem


OpenSSL Commands

Convert PEM

Convert PEM to DER:
openssl x509 -outform der -in certificate.pem -out certificate.der

Convert PEM to P7B:

openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer

Convert PEM & Private Key to PFX/P12:

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

Convert full chained PEM & Private Key (Let’s Encrypt) to PFX/P12
(full chain = your cert + intermediate/root cert in a single file)

openssl pkcs12 -export -out -inkey privkey.pem -in fullchain.pem

OpenSSL Convert DER

Convert DER to PEM:

openssl x509 -inform der -in certificate.der -out certificate.pem

OpenSSL Convert P7B

Convert P7B to PEM:

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

Convert P7B to PFX:

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.cer

OpenSSL Convert PFX

Convert PFX to PEM and Private Key

openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes

Remove Private key password

openssl rsa -in




Enter the passphrase and [file2.key] is now the unprotected private key.

The output file:� [file2.key] should be unencrypted. To verify this open the file using a text editor (such as MS Notepad) and view the headers

Bash Profile

Reload ~/.bashrc

To reload your .bashrc/.bash_profile file you can do it with the source command without logging out and back in for changes to take effect

[email protected]:/# source ~/.bashrc
Advertisment ad adsense adlogger