Showing posts with label Linux/Unix/Vi Commands. Show all posts
Showing posts with label Linux/Unix/Vi Commands. Show all posts

Monday, May 23, 2011

OS specific commands

To Find Swap, RAM, and OS Version

OS

SWAP

RAM

OS VERSION

AIX

/usr/sbin/lsps -a

/usr/sbin/lsattr -HE -l sys0 -a realmem

oslevel

HP PA-RISC

swapinfo -a

grep "Physical:" /var/adm/syslog/syslog.log

uname -a

HP Itanium

swapinfo -a

/usr/contrib/bin/machinfo | grep -i Memory

uname -a

Tru64

swapon -s

vmstat -P

/usr/sbin/sizer -v

Solaris

swap -s

/usr/sbin/prtconf | grep -i memory

uname -r

Linux

free

free

uname -a

Mac OS X

# df -h /

# /usr/sbin/system_profiler SPHardwareDataType | grep Memory

# sw_vers

To Determine the Unix Kernel Parameters

OS

LOCATION

COMMAND TO SEARCH

AIX

automatically configured

do 'env' for LINK_CNTRL,
To determine if AIX is 64 bit enabled do 'genkex | grep 64' or 'genkex | grep call' (see Note 1019106.102)

HP

/stand/system or use SAM -->Kernel Configuration

/etc/sysdef, /usr/sbin/kmtune (kmtune desupported in 11.31, use /usr/sbin/kctune -v), or /usr/sbin/kcweb -F

Tru64

/etc/sysconfigtab

/sbin/sysconfig -q ipc or /sbin/sysconfig -q vm or /sbin/sysconfig -q proc

Solaris

/etc/system

"/etc/sysdef | grep SHM" or "/etc/sysdef | grep SEM"

Linux

/usr/src/linux/include/asm/shmparam.h
/usr/src/linux/include/linux/sem.h
/proc/sys/kernel/sem
/proc/sys/kernel/shmall
/proc/sys/kernel/shmmax
/proc/sys/kernel/shmmni

ipcs -lms

Mac OS X

/etc/sysctl.conf

"# /usr/sbin/sysctl -a | grep "

O/S Software Installed Packages and Patches

OS

COMMAND FOR PACKAGES

COMMAND FOR PATCHES

AIX

lslpp -w | grep -i "software title" (applies to APARs and PTFs)

/usr/sbin/instfix -ik patch number

HP

Prior to 11: /usr/sbin/swlist -lproduct PH\* hp-ux 11 and after: * /usr/sbin/swlist -l patch \*\.*,c=patch * /usr/contrib/bin/show_patches (from patch PHCO_19550)

/usr/sbin/swlist -l fileset | grep -i

Solaris

/bin/pkginfo -l | grep -i "software title"

/bin/showrev -p

Tru64

/usr/sbin/setld -i | grep -i "software title"

/usr/sbin/setld -i | more
For patchkits:
/usr/sbin/dupatch -track -type kit

Linux


To see if a particular RPM is installed (without the architectur):
$ rpm -qa | grep "package name"

To see if a particular RPM is installed (with the architectur):
$ rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}_%{ARCH}\\n" | grep "package name"

To see what RPM provided a particular object/library:
$ rpm -q --whatprovides --qf "%{NAME}-%{VERSION}-%{RELEASE}_%{ARCH}\\n" "full path/library name"

To see the contents listing of an RPM:
$ rpm -ql "RPM name"
For example: $ rpm -ql compat-libstdc++-33-3.2.3-47.3.ppc
/usr/lib/libstdc++.so.5
/usr/lib/libstdc++.so.5.0.7


Mac OS X

to be supplied later

to be supplied later

To Check if an OS is 64 bit Capable or not

OS

COMMAND

RESULTS

Aix

lslpp -L | grep 64bit

It should return "bos.64bit"

HP

getconf KERNEL_BITS

It should return "64"

Solaris

/bin/isainfo -kv

If the isainfo command does not exist it is not 64-bit. It should return "64-bit sparcv9 kernel modules"

To Check version of Compiler

COMPILER

COMMAND

C/C++

do a "which cc", then cd to the directory it is in, then do a "what cc"
except for Linux, on Linux do a "rpm -qa | grep egcs

COBOL

cd $COBDIR and do "more cobver"

Fortran

do a "which f77", then cd to directory it is in, then do a "what f77"

Friday, February 18, 2011

sudo and cpio UNIX commands

sudo: super user do, that allows users to run programs with the security privileges of another user (normally the superuser, aka. root). By default, sudo will prompt for a user password but it may be configured to require the root password, or require it only once per pseudo terminal, or no password at all.

cpio: Copies files into and out of archive storage and directories.
cpio -o [ a ] [ c ] [ v ] [ B | C Value ] Output

cpio -i [ b ] [ c ] [ d ] [ f ] [ m ] [ M ] [ r ] [ s ] [ t ] [ u ] [ v ] [ S ] [ 6 ] [ B | C Value ] [ Pattern... ] Input

cpio -p [ a ] [ d ] [ l ] [ m ] [ M ] [ u ] [ v ] Directory FileName

iostat , vmstat and netstat are three most commonly used tools for performance monitoring . These comes built in with the operating system and are easy to use .iostat stands for input output statistics and reports statistics for i/o devices such as disk drives . vmstat gives the statistics for virtual Memory and netstat gives the network statstics .

The most common shells available on UNIX systems are the Bourne Shell (sh), the C Shell (csh) and the Korn shell (ksh)


Directions
To extract the cpio file, move the cpio file to an empty directory, then do: cat filename.cpio | cpio -icd

Extract from each uncompressed downloadable using "cpio" (example: cpio -idmv <>

Sunday, February 28, 2010

Vi editor commands

All commands listed below should be run in escape mode:

h -> move left by one char
j -> move down by one line
k -> move up by one line
l -> move right by one char

q -> quit
q! -> force quit without any changes
wq -> save and quit

i -> insert mode where cursor is
a -> insert after the cursor

dd -> delete a line
2dd [OR] 2D --> delete 2 lines from cursor
x -> delete a char
dw -> To delete from cursor to start of next word
d3w [OR] 3dw -> To delete 3 words from cursor
d$ [OR] D-> To delete from cursor to end of line
dL -> To delete from current line to bottom of screen
dh -> To delete one character before cursor


yy -> copy a line
5yy -> copy 5 lines
p -> paste after cursor
P -> paste before cursor

0 -> move cursor to start of the line
$ -> move cursor to end of the line

w -> move forward by one word
b -> move backward by preceding word
CTRL+f OR CTRL+u -> move up by one screen
CTRL+b OR CTRL+d -> move down by one screen

Move to top of screen H (home)
Move to middle of screen M (middle)
Move to last line of screen L (last)
Last line in file -> G
First line in a file -> 1G
Nth line in a file -> nG


u -> undo

CTRL+G [OR] :f--> Status of the current position and the file you are editing

Global search and replace --> :1,$ s/old/new/g

Open another file -> :e filename
Open another file (don't save most recent changes) -> :e! filename

Search for 'test' -> /test
search for next word foward -> n
Repeat search backward -> N

Convert lower-case to upper-case or vice-versa -> ~
See the hidden format in file -> :set list
ignore the case when searching in a file -> :set ic and then use / to search in a file

Set numbering in a file -> :set number [OR] :set nu
To unset numbering in a file -> :set nonumber [OR] :set nu!

Saturday, February 6, 2010

/dev/null significance and STDIN, STDOUT, STDERR

sample > /dev/null 2>&1

There are three standard sources of input and output for a program. Standard input usually comes from the keyboard if it’s an interactive program, or from another program if it’s processing the other program’s output. The program usually prints to standard output, and sometimes prints to standard error. These three file descriptors (you can think of them as “data pipes”) are often called STDIN, STDOUT, and STDERR. The built-in numberings for them are 0, 1, and 2, in that order. By default, if you don’t name or number one explicitly, you’re talking about STDOUT.

The command above is redirecting standard output into /dev/null, which is a place you can dump anything you don’t want (often called the bit-bucket), then redirecting standard error into standard output (you have to put an & in front of the destination when you do this).

All output from this command should be shoved into a black hole. 2 > &1 will redirect STDERR to STDOUT which in turn is redirected to a BLACK HOLE

Saturday, August 15, 2009

sar/iostat/vmstat/netstat/top/sed/cron

Display the activity for the CPU (system activity report) -> sar
07:20:01 AM CPU %user %nice %system %iowait %idle
07:30:01 AM all 0.18 0.00 0.01 0.01 99.80
07:40:01 AM all 0.15 0.00 0.01 0.01 99.83
07:50:01 AM all 0.15 0.00 0.01 0.01 99.83
08:00:01 AM all 0.15 0.00 0.01 0.01 99.83
08:10:01 AM all 0.15 0.00 0.01 0.01 99.83
08:20:01 AM all 0.15 0.00 0.01 0.01 99.83
08:30:01 AM all 0.15 0.00 0.01 0.01 99.83
08:40:01 AM all 0.15 0.00 0.01 0.01 99.83
08:50:01 AM all 0.15 0.00 0.01 0.01 99.83
09:00:01 AM all 0.15 0.00 0.01 0.01 99.83
09:10:01 AM all 0.18 0.00 0.01 0.01 99.80
09:20:01 AM all 0.18 0.00 0.01 0.01 99.80
09:30:01 AM all 0.18 0.00 0.01 0.01 99.80
09:40:01 AM all 0.15 0.00 0.01 0.01 99.83
09:50:01 AM all 0.16 0.00 0.01 0.01 99.82
10:00:01 AM all 0.15 0.00 0.01 0.01 99.83
10:10:01 AM all 0.15 0.00 0.01 0.01 99.83
10:20:01 AM all 0.15 0.00 0.01 0.01 99.83
10:30:01 AM all 0.15 0.00 0.01 0.01 99.82
Average: all 0.17 0.00 0.01 0.02 99.81

vmstat --> memory usage
[oracle@X345 ~]$ vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 1737732 32576 212864 0 0 1 1 109 7 0 0 100 0

iostat --> input output disk usage
[oracle@X345 ~]$ iostat
Linux 2.6.9-67.ELsmp (X345.localdomain) 08/14/2009

avg-cpu: %user %nice %sys %iowait %idle
0.17 0.00 0.01 0.02 99.80

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 0.12 2.53 0.71 188760 53004
sda1 0.01 0.01 0.00 946 4
sda2 0.03 0.03 0.00 2431 16
sda3 0.01 0.03 0.00 2330 16
sda4 0.00 0.00 0.00 2 0
sda5 0.00 0.02 0.00 1682 16
sda6 0.15 2.41 0.71 180273 52952
sdb 0.28 3.58 4.63 267713 346320
sdb1 0.01 0.03 0.00 2432 16
sdb2 0.03 0.03 0.00 2431 16
sdb3 0.01 0.02 0.00 1368 16
sdb4 0.00 0.00 0.00 2 0
sdb5 0.65 3.48 4.63 260264 346272
dm-0 0.79 5.88 5.34 439098 399224
dm-1 0.00 0.00 0.00 360 0

netstat --> network statistics
[oracle@X345 ~]$ netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 132 X345.localdomain:ssh ::ffff:192.168.168.165:4700 ESTABLISHED


top -> cpu usage (glance in HP-UX, topas in IBM AIX)

PID USER PR NI %CPU TIME+ %MEM VIRT RES SHR S COMMAND
5863 root 15 0 1 6:48.32 0.4 19612 8760 2440 S X
8413 oracle 16 0 0 0:00.01 0.0 1956 1000 784 R top
1 root 16 0 0 0:00.65 0.0 1956 548 468 S init
2 root RT 0 0 0:00.01 0.0 0 0 0 S migration/0
3 root 34 19 0 0:00.00 0.0 0 0 0 S ksoftirqd/0
4 root RT 0 0 0:00.00 0.0 0 0 0 S migration/1
5 root 34 19 0 0:00.00 0.0 0 0 0 S ksoftirqd/1
6 root RT 0 0 0:00.01 0.0 0 0 0 S migration/2
7 root 34 19 0 0:00.00 0.0 0 0 0 S ksoftirqd/2
8 root RT 0 0 0:00.00 0.0 0 0 0 S migration/3
9 root 34 19 0 0:00.00 0.0 0 0 0 S ksoftirqd/3
10 root 5 -10 0 0:00.00 0.0 0 0 0 S events/0
11 root 5 -10 0 0:00.00 0.0 0 0 0 S events/1
12 root 5 -10 0 0:00.00 0.0 0 0 0 S events/2
13 root 5 -10 0 0:00.00 0.0 0 0 0 S events/3
14 root 7 -10 0 0:00.01 0.0 0 0 0 S khelper
15 root 15 -10 0 0:00.00 0.0 0 0 0 S kacpid


sed is stream editor.
Ex: sed s/day/night/ new
The substitute command changes all occurrences of the regular expression into a new value. A simple example is changing "day" in the "old" file to "night" in the "new" file.

sed 's///g' {g for global replacement}

Crontab
Cron table is used to schedule the jobs to run automatically at particular day and time. It consists of 5 fields.

* * * * * command or shell script to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

/usr/bin/crontab or /usr/sbin/crontab

crontab -e Edit your crontab file, or create one if it doesn't already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file.

* * * * * => Execute every minute
0 * * * * => Execute every Hour
0 0 * * * => Execute every mid-night
0 0 0 * * => Execute every Month
0 0 0 0 * => Execute every Weekday

@reboot Run once, at startup. None
@yearly Run once a year 0 0 1 1 *
@annually (same as @yearly) 0 0 1 1 *
@monthly Run once a month 0 0 1 * *
@weekly Run once a week 0 0 * * 0
@daily Run once a day 0 0 * * *
@midnight (same as @daily) 0 0 * * *
@hourly Run once an hour 0 * * * *

Slash example: the following will run the script /home/user/test.pl every 5 minutes.

*/5 * * * * /home/user/test.pl

Run every 10 min and store the output in a log.
*/10 * * * * /bin/execute/this/script.sh 2>&1 >> /var/log/script_output.log

Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen. The specified range is inclusive. For example, 8-11 for an "hours" entry specifies execution at hours 8, 9, 10 and 11.

Lists are allowed. A list is a set of numbers (or ranges) separated by commas. Examples: "1,2,5,9", "0-4,8-12".

Step values can be used in conjunction with ranges. Following a range with "/" specifies skips of the number's value through the range. For example, "0-23/2" can be used in the hours field to specify command execution every other hour (the alternative in the V7 standard is "0,2,4,6,8,10,12,14,16,18,20,22"). Steps are also permitted after an asterisk, so if you want to say "every two hours", just use "*/2".

Basic Unix Commands

list files and directories -> ls
long listing of files and directories -> ls -l
mark directories with a '/' -> ls -F
list hidden files -> ls -a
Number of files and directories -> ls | wc -l
Number of files excluding directories -> ls -l | grep ^[^d] | wc -l [OR] find ./ -type f | wc -l
make directory -> mkdir
change directory -> cd
change to parent directory -> cd ..
print working directory -> pwd
copy files -> cp
move files -> mv
remove a file -> rm filename
remove a directory -> rmdir
force to remove all files recursively from all sub-directories -> rm -rf *
display contents of file on console -> cat hello.txt
display less contents of file on console -> less hello.txt {hit space bar to see more text}
display top lines in a file -> head -10 hello.txt
display bottom lines in a file -> tail -10 hello.txt
search for a pattern in a file -> /searchword {hit n to display next}
search for specific words in a file -> grep science science.txt or grep 'vinay kumar' vinay.txt
redirect output to a file -> ls -l > out.txt
append output to a file -> ls -l >>out.txt
redirect input to a command -> sort <>out.txt
pipe the output of command 1 to input of command 2 -> command 1 | command 2
list users currently logged in -> who
concatenate two files into one -> cat file1 file2 > file 0
change permissions on a file -> chmod
give owner permission to a file -> chown
kill a process -> kill -9 pid
list current processes -> ps
list current active jobs -> jobs
suspend a background job -> stop
repeat last command -> r (in ksh shell)
to check your current quota -> quota -v
space left on file system -> df [-k] [-m] [-h]
space used on file system -> du [-k] [-m] [-h]
show history command list -> history
to increase size of history buffer -> set history = 100

create a tar file -> tar -cvf sample.tar /dev/oradata
extract a tar file -> tar -xvf sample.tar
list files in tar -> tar -tvf sample.tar
c Create
x Extract from the tape
t List files on the tape
v Verbose
f Next argument is the name of the archive
tar, compress and transfer -> tar -cvf - *.dbf | compress | ssh stederey "cd /u02/backup/TEST/ ;zcat | tar xvf -" &


gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name . . . ]
Description
Compresses and expands data
Suffix .gz
Frequently Used Options
-c Write output on standard output
-d Uncompress
-h Help
-r Recursive
-v Verbose

gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
Description
Uncompresses files (Same as gzip –d )
Automatically detects input format
Frequently Used Options
-c Write output on standard output
-h Help
-r Recursive
-v Verbose

gzip myfile --> Compresses the file myfile, making it myfile.gz. Note. When doing this the original file will no longer exist on the drive.

gunzip -f myfile.gz --> Uncompress the file myfile.gz and if the uncompressed file(s) already exist force an overwrite. When doing this the file myfile.gz will no longer be on the drive.

zcat myfile --> Uncompress the file myfile.

unzip test.zip

compress
Compacts a file so that it is smaller. When compressing a file it will be replaced with a file with the extension .Z, while keeping all the same ownership modes.

Syntax

compress [-c] [-f] [-v] filenames

-c Write to the standard output; no files are changed and no .Z files are created. The behavior of zcat is identical to that of `uncompress -c'.

-f When compressing, force compression of file , even if it does not actually reduce the size of the file, or if the corresponding file .Z file already exists. If the -f option is not given, and the process is not running in the background, prompt to verify whether an existing file .Z file should be overwritten. When uncompressing, do not prompt for overwriting files. If the -f option is not given, and the process is not running in the background, prompt to verify whether an existing file should be overwritten. If the standard input is not a terminal and -f is not given, write a diagnostic message to standard error and exit with a status greater than 0.

-v Shows you how much the file shrank in size.

filenames The name of the file(s) that you wish to compress.

Ex:

compress -v test.exe - Would compress test.exe and rename that file to test.exe.Z.

uncompress
Uncompressed compressed files.

Syntax

uncompress [-c] [-f] [-v ] [file]

Ex:
uncompress sample.txt - would uncompress the file sample.txt.Z.

grep [-E| -F] [-c| -l| -q] [-insvx] pattern_list [file . . .]
Description
Searches the input files, selecting lines matching one or more patterns
Frequently Used Options
-i Case-insensitive search
-l Write file names only
-n Display line number

Examples
grep -i unix p1.c
grep -n UNIX *.c *.h
ps –ef | grep mary

wc [ -c|-m ] [ -lw ] [ file . . . ]
Description
Counts lines, words, and characters
Options
-c Count the number of bytes
-m Count the number of characters
-l Count the number of newline characters
-w Count the number of words
Examples
wc -l *.h *.c

move by word -> w
left -> h
down -> j
up -> k
right -> l
copy -> yy
paste -> p
delete -> x
find . -name 'oracle' -print
find the files with .ora extension in current directory and all sub directories -> find . -name *.ora
find within a specified directory -> find directoryPath -name *.ora -print
find . -name sam\*tet will search from the current directory down for sam*tet (that is, any filename that begins with sam and ends with tet)
find / -type f -mtime -7
will find any regular files (i.e., not directories or other special files) with the criteria "-type f", and only those modified seven or fewer days ago ("-mtime -7").
find / -mmin -10
to locate files modified less than 10 minutes ago
find . -mtime 0 # find files modified between now and 1 day ago
# (i.e., within the past 24 hours)
find . -mtime -1 # find files modified less than 1 day ago
# (i.e., within the past 24 hours, as before)
find . -mtime 1 # find files modified between 24 and 48 hours ago
find . -mtime +1 # find files modified more than 48 hours ago

find . -mmin +5 -mmin -10 # find files modified between
# 6 and 9 minutes ago

show user and its group -> id
which binary is used -> which sqlplus
go to previous directory path -> cd -

[oracle@vinay ~]$ set -o
allexport off
braceexpand on
emacs on
errexit off
errtrace off
functrace off
hashall on
histexpand on
history on
ignoreeof off
interactive-comments on
keyword off
monitor on
noclobber off


[oracle@vinay ~]$ nohup ls &
[1] 4628
[oracle@vinay ~]$ nohup: appending output to `nohup.out'
ls
afiedt.buf Desktop ed.hup nohup.out on.lst sqlnet.log
[1]+ Done nohup ls


$ jobs
[3] + Running first_one &
[2] - Stopped (SIGTSTP) second_one
[1] Stopped (SIGTTIN) third_one &

The reason for the plus and minus symbols on the jobs listing is that job numbers are reassigned when one
completes and another starts. In the previous example, if job number 2 finishes and you start another job, it is assignedjob number 2 and a plus sign because it is the most recent job.


[oracle@vinay ~]$ passwd
Changing password for user oracle.
Changing password for oracle
(current) UNIX password:


[oracle@vinay ~]$ id
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)


If command is successful, then exit status is 0 otherwise it would be not 0
[oracle@vinay /database]$ ls sysstat-5.0.5-19.el4.i386.rpm
sysstat-5.0.5-19.el4.i386.rpm
[oracle@vinay /database]$ echo $?
0
[oracle@vinay /database]$ ls sample.txt
ls: sample.txt: No such file or directory
[oracle@vinay /database]$ echo $?
1

Debugging the shell script
$ ksh -vx listener.sh LISTENER1


split
To split large files into smaller files in Unix, use the split command.
split [options] filename prefix

Replace filename with the name of the large file you wish to split. Replace prefix with the name you wish to give the small output files. You can exclude [options], or replace it with either of the following:
-l linenumber -b bytes

If you use the -l (a lowercase L) option, replace linenumber with the number of lines you'd like in each of the smaller files (the default is 1,000). If you use the -b option, replace bytes with the number of bytes you'd like in each of the smaller files.

split -l 500 myfile mytest

This will output six 500-line files: mytestaa, mytestab, mytestac, mytestad, mytestae, and mytestaf

test is a 160KB file: split -b 40k test mytest

This will output four 40KB files: mytestaa, mytestab, mytestac, and mytestad.


ls -lrt | grep "Dec" | grep 2008 | awk '{print $9}' --- this will list the log files created in the month of Dec, 2008. You can remove all of them at a time using:
rm `ls -lrt | grep "Dec" | grep 2008 | awk '{print $9}'`

Also, you can check which file is occupying more space using the below command:
du -sk /opt/oracle/*

Secure copy:
scp test.txt oracle@server1.com:/database/test
scp -p test.txt oracle@server1.com:/database/test -> Preserve modification times, access times, and modes from the original file.
scp -r testdir oracle@server1.com:/database/test -> recursively copy entire directory 'testdir'

Check memory
lsattr -El sys0 | grep realmem

fuser:
fuser is a UNIX command used to show which processes are using a specified file, file system, or socket
fuser

Disk space:
df -h | grep test | egrep 'uo|database'

Search for a word in file:
[oracle@vinay logs]$ grep -i parameter init10g.log
SQL> show parameter

To check the size of physical memory, execute:

grep MemTotal /proc/meminfo
MemTotal: 515700 kB

To check the size of swap space, execute:

grep SwapTotal /proc/meminfo
SwapTotal: 1004052 kB

AIX commands:

mpstat displays performance statistics for all logical processors in the system
ps -ef | grep TEST | wc -l will list sessions count that are using the instance TEST
k when used in escape mode will list backward command history
j when used in escape mode will list forward command history

Friday, March 6, 2009

Using ipcs to peek into kernel's storage mechanisms for IPC objects

The ipcs [-q] [-s] [-m] [-l] command gives you the kernel's storage mechanisms for IPC objects.
ipcs -q: Show only message queues
ipcs -s: Show only semaphores
ipcs -m: Show only shared memory
ipcs -l: Shows message queues, semaphores, and also shared memory

Commands for CPU/Memory/Process information on Linux/Unix servers

top displays all sorts of CPU/Memory/Process information
free -m will show you stats about RAM usage in MB
uptime will show you the load average for the past 1min, 5mins and 15mins

cat /proc/cpuinfo [OR] cat /proc/cpuinfo | more will give you general information about the CPU(s) and memory on server
vmstat will give you virtual memory statistics and vmstat n will give you a run down of memory use, disk operations and cpu usage every n seconds
i.e. vmstat 1 will get a run down of memory use, disk operations and cpu usage every 1 sec