System resources (over) utilization

http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html

Sander van Vugt is Linux Master, Trainer and Author

Uncategorized

ps

Options

-e show all proccesses
-f
full description
-F
extra full
-u user list only processes belonging to user
–forest lists processes as a tree structure
-T show the threads with SPID
-L show the threads with LWP/NLWP columns
-C list by command name
r restricts to only running processes
e shows the environment after the command

Process state codes

D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to complete)
T Stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z Defunct (“zombie”) process, terminated but not reaped by its parent

Example:

ps -Lu mysql -o tid,state,%cpu,%mem,etime,nlwp,comm,sgi_p

The above lists all mysql threads with these columns: thread id, state of the process (short description; for long use stat), cpu percentage usage (per thread), memory percentage usage (shared), elapsed time, number of lightweight processes (threads), name of the command and the number of the used CPU / core with * if the process is sleeping.

Processes commands

yum

Repositories

  • The DAG repository
  • ATrpms repository
  • RPMforge repository
  • FreshRPMS repository
  • Dries repository
  • Relevant paths

    /etc/yum.conf
    /etc/yum.repos.d

    Installs a package

    yum install package

    Checks for updates

    yum chech-update [pack]

    Updates a package

    yum update package

    Information

    yum info package

    Listing packages

    yum list [all]
    yum list [regexp]
    yum list available [regexp]
    yum list updates [regexp]
    yum list installed [regexp]
    yum list obsoletes [regexp]

    Cleaning

    yum clean packages (erases the downloaded packages)
    yum clean headers (cleans the syncing headers)
    yum clean all

    Erases package

    yum erase package

    Searches for a package after a word

    yum search keyword

    Options

    -y to assume yes to all confirmation questions (for scripting automation)

    Uncategorized

    rpm

    Installs the pack verbosely and printing 50 hash marks

    rpm -ivh pack

    Forces a pack install even if the dependencies are not met

    –force

    Searches all the installed packages

    rpm -qa

    Searches to what package a file belongs

    rpm -f file

    Queries all files that belong to a pack

    rmp -ql pack

    Queries documentation for a package

    rpm -qd pack

    Queries all the dependencies

    rpm -qR pack

    Updates an existing package

    rpm -F pack

    Updates pack if it exists or installs it if it doens’t exist

    rpm -U pack

    Erases a package

    rpm -e pack

    Rebuilds the RPM database if it becomes corrupt

    rpm –rebuilddb

    Uncategorized

    exim commands

    Show the mail queue

    exim -bp

    Process the mail queue (non force)

    exim -q

    Process the mail queue forcing delivery except for the frozen messages

    exim -qf

    Process the mail queue forcing even the frozen messages into delivery

    exim -qff

    Stat the mail queue

    exim -bp | exiqsumm

    Print out what exim is doing right now

    exiwhat

    Count the mail messages in the queue

    exim -bpc

    For further research

    exiqgrep -o 86400 -i | xargs exim -MrmThe above command will delete the messages older than 1 day. To delete email more than one day you can multiply with the number of days with 86400.

    Further reference: http://bradthemad.org/tech/notes/exim_cheatsheet.php

    Uncategorized

    diff

    Lists differences between 2 files

    -i case insensitive

    -y list on columns

    -w ignores whites (spaces)

    -B ignores spaces

    -c full compare

    Uncategorized

    du

    Lists the disk utilisation.

    -k displays in KB

    -s sumarises

    -h human readable

    Uncategorized

    file

    Lists the file type

    file file_in_question

    Lists the file type without changing the atime

    file -p file_in_question

    Uncategorized

    stat

    Lists size, owner, group, device, inode, file type, file perms, atime, ctime, mtime about file

    stat file

    Uncategorized

    wc

    Counts the lines from a file

    wc -l file

    Counts the words from a file

    wc -w file

    Counts the chars from a file

    wc -m file

    Uncategorized