Linux Commands

Introduction

This page is meant to be a central source of Linux commands (mostly Debian-based) used in the real world.

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

dpkg

Put a package on hold

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

Remove the hold

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

Display the status of your packages

dpkg --get-selections

Display the status of a single package

dpkg --get-selections | grep "package"

apt

Hold a package

sudo apt-mark hold package_name

Remove the hold

sudo apt-mark unhold package_name

aptitude

Hold a package

sudo aptitude hold package_name

Remove the hold

sudo aptitude unhold package_name

List and Kill Screen Sessions

List all screen sessions

screen -list

Send the command quit to the session you want to kill

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

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

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

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