Archive for Linux

determine CPU and Memroy top users

So your system is acting screwy and you are tying to figure out what is going wrong.  Listing the processes in order to determine who the CPU or memory hogs are.

List how much CPU percent and time each process is uing

ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed ‘/^ 0.0 /d’

In order to list the process with how much memory each process is using, listed from lease to most memory hogs.

ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS

Comments

list installed packages on debian

I just want to share this simple command to show you how to list out all installed packages on a system.  It is often useful when you need to compare two system, or easily check to see if you installed a package already.

dpkg –get-selections

server:/var/log/openvpn# dpkg –get-selections
acpi-support-base                               install
acpid                                           install
adduser                                         install
apache2                                         install
apache2-mpm-prefork                             install
apache2-utils                                   install
apache2.2-common                                install
apt                                             install
… and losts more

This also works on Debian like operating systems like Ubuntu.  Below is a example from my Debian desktop.

user@server:~$ dpkg –get-selections|grep xserver
x11-xserver-utils                               install
xserver-common                                  install
xserver-xorg                                    install
xserver-xorg-core                               install
xserver-xorg-input-all                          install
xserver-xorg-input-evdev                        install
xserver-xorg-input-mouse                        install
xserver-xorg-input-synaptics                    install
xserver-xorg-input-vmmouse                      install
xserver-xorg-input-wacom                        install
xserver-xorg-video-all                          install
xserver-xorg-video-apm                          install
xserver-xorg-video-ark                          install
xserver-xorg-video-ati                          install
xserver-xorg-video-chips                        install
xserver-xorg-video-cirrus                       install
xserver-xorg-video-fbdev                        install
xserver-xorg-video-geode                        install
xserver-xorg-video-i128                         install
xserver-xorg-video-i740                         install
xserver-xorg-video-intel                        install
xserver-xorg-video-mach64                       install
xserver-xorg-video-mga                          install
xserver-xorg-video-neomagic                     install
xserver-xorg-video-nv                           install
xserver-xorg-video-openchrome                   install
xserver-xorg-video-r128                         install
xserver-xorg-video-radeon                       install
xserver-xorg-video-rendition                    install
xserver-xorg-video-s3                           install
xserver-xorg-video-s3virge                      install
xserver-xorg-video-savage                       install
xserver-xorg-video-siliconmotion                install
xserver-xorg-video-sis                          install
xserver-xorg-video-sisusb                       install
xserver-xorg-video-tdfx                         install
xserver-xorg-video-trident                      install
xserver-xorg-video-tseng                        install
xserver-xorg-video-v4l                          install
xserver-xorg-video-vesa                         install
xserver-xorg-video-vmware                       install
xserver-xorg-video-voodoo                       install

Comments

Easiest way to relay mail through GMail using Postfix and Debian

There are times when you need need to send E-Mail from your Linux server.  The reason that I had to set up E-Mail was because I had a php script that E-Mailed me once some one filled out their information on the website.  The easiest way to get your server sending mail is using GMail to send the mail.  This tutorial will describe how to set it up on Ubuntu / Debian.

sudo aptitude install postfix libsasl2 ca-certificate libsasl2-modules

You want to add the fowling lines to your /etc/postfix/main.cf

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/
gmail_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

You need to edit /etc/postfix/gmail_passwd and add the fowling information below, edit it to fit your needs.

[smtp.gmail.com]:587    UserMame@gmail.com:PassWord

Next you need to turn the gmai_passwd file into something that postfix can understand, you can use the command below to accomplish that.

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd

Now you can restart postfix but it will complain about not being able to authenticate the certificate.  In order to fix the problem we will use the ca-certificate package we installed earlier to tell it where it can validate the certificate.

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

Now restart postfix for the final time.

/etc/init.d/postfix

Comments

« Previous entries Next Page » Next Page »