Check X memory usage
$ xrestop
Check system memory usage
$ top
just about anything found on the net
$ dd if=/dev/cdrom0 of=output.iso
Change cdrom0 with devices you need to make image from, and output.iso with image file result.
To mount it, use
$ mount -o loop output.iso /path/to/mntdir
$screen
Print a list of pid.tty.host of screen identification
$screen -ls
Reattach/resume screen session
$screen -r pid.tty.host
Detach a screen
ctrl-a d
... Fetched 69.7kB in 50s (1,388B/s) Reading package lists... Done W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5A9BF3BB4E5E17B5 $
sudo apt-key adv --recv-keys --keryserver keyserver.ubuntu.com <public key number>
$sudo apt-key adv --recv-keys --keryserver keyserver.ubuntu.com 5A9BF3BB4E5E17B5 Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 5A9BF3BB4E5E17B5 gpg: requesting key 4E5E17B5 from hkp server keyserver.ubuntu.com gpg: key 4E5E17B5: public key "Launchpad PPA for chromium-daily" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) $
$sudo apt-get install postgresqlanswer yes to all questions.
$sudo apt-get install pgadmin3again, just answer yes to the questions.
$sudo -u postgres psql postgres enter your password. psql (8.4.2) Type "help" for help. postgres=# \password postgres Enter new password: Enter it again: postgres=# CREATE DATABASE database_name; CREATE DATABASE postgres=# \quitdone. Refer to https://help.ubuntu.com/community/PostgreSQL for complete tutorial.
$ cat /etc/services
$ cat /etc/services | grep postgre postgresql 5432/tcp postgres # PostgreSQL Database postgresql 5432/udp postgres $
#! /bin/sh # This is the log that will be monitored. # If any changes occur to this, then take appropriate action. MONITORED_LOG=/tmp/goreb.log # We will need this log to see whether any changes occured to /tmp/goreb.log TEMP_LOG=/tmp/.goreb.log.1 # This is a 1-time command i.e. create the log file if it does nto exist. [ ! -f $TEMP_LOG ] && touch -r $MONITORED_LOG $TEMP_LOG [ $MONITORED_LOG -nt $TEMP_LOG ] && echo "$MONITORED_LOG is newer than $TEMP_LOG. Carry out your required operations" # Update $TEMP_LOG with the new modified date of $MONITORED_LOG touch -r $MONITORED_LOG $TEMP_LOG
touch /tmp/testdirb.$$ while true do ls /testdir > /tmp/testdira.$$ diff /tmp/testdira.$$ /tmp/testdirb.$$ || echo "changed" cp /tmp/testdira.$$ /tmp/testdirb.$$ sleep 300 doneIf you were looking for a particular file to change, you'd use "ls -l", and if your interest was in if the file was being used or executed, "ls -lut" would give you that. This example justs echoes when something changes, but you would more likely call some other script that did more testing. One obvious issue that comes up if a file has been created is waiting for the creating program to have finished up: lsof or fuser can help you with that.
MAIL=/tmp/watchthis MAILCHECK=10You can watch multiple files, each with its own message, by using MAILPATH instead of MAIL. You need to "unset MAIL", and set and export MAILPATH:
unset MAIL MAILPATH='/tmp/foo/h?"H is changed":/tmp/foo/a?"A has changed"' export MAILPATHStat
testdir 4096 8 41ed 5001 5001 303 82022 2 2b 1d 1070127877 1070128608 1070128608which is everything you want to know about the file or directory for this purpose. Security Enhanced Linux versions add another field which we need to strip out for our purposes here:
OLD=`stat -t testdir` # OLD=`stat -t testdir | sed 's/[0-9][0-9]*$//'` # if SE linux stat while true do NEW=`stat -t testdir` # NEW=`stat -t testdir | sed 's/[0-9][0-9]*$//'` if SE linux stat [ "$NEW" == "$OLD" ] || echo "changed!" sleep 3 doneYou could get fancier by splitting out the fields into separate variables. That isn't a lot of fun at the shell level, so we'll move up a notch.
#!/usr/bin/perl
@info=stat("testdir") or die "Can't stat testdir $!";
while (1) {
@newinfo=stat("testdir") or die "Can't stat testdir $!";
@what=qw(Device Inum Mode Links Owner Group Rdev Size Atime Mtime Ctime PBlock Blocks);
$x=0;
while ($info[$x]) {
system("/bin/echo $what[$x] $info[$x] $newinfo[$x]") if ($info[$x] ne $newinfo[$x]);
$x++;
}
@info=@newinfo;
sleep 1;
}