Display total RAM (Memory) on the server
Tru64 Unix uerf –r 300 grep –i mem
Solaris prtconf grep –i mem
Linux free
HP-UX swapinfo –tm
AIX lsdev –C grep mem
lsattr –El
$ lsdev -C grep mem
Top ten process -Memory usage on the server:
# svmon -Pau 10
Displaying the No. of CPU processors in UNIX:
AIX lsdev –C grep Process wc –l
HP-UX ioscan –C processor grep processor wc –l
Solaris psrinfo –v grep “Status of Processor” wc –l
Linux cat /proc/cpuinfo grep processor wc –l
Display top CPU Consumers with ps:
$ ps –ef sort +7 tail
$ps auxgw sort +2 tail
$ps augxww grep “RSS “ head
The third column of this listing (%CPU) shows the percentage of CPU used.
To display processes consuming CPU% & elapsed time
ps -aef -o ruser,pid,pcpu,args,etime,
To list the tapes on your system
$ lsdev -C -c tape
To list the disks on your system
$ lsdev -C -c disk
Viewing UNIX volume groups
$ lsvg –o
-o Lists only the active volume groups (those that are varied on). An active volume group is one that is available for use.
Output on AIX
appvg1
rootvg
lsvg –l
For details on a specific volumne group, you can use lsvg –l, passing the volume group name as a parameter
$ lsvg -l rootvg
To see the previous logons and logoffs
last
Searching for a particular Text in the directory and sub-directories under that
find . -name "*" -exec grep -il
Find all files except owned by a specific user
Will list the file names containing the search string.
find . ! -user oracle9i -print
‘ ! ‘ negates the expression. The other example will list all the files not owned by user oracle9i.
Find files having some specific permission
find . –name *.* -perm 664 -print
Searching for links in all the folders under the directory and output to a text file to create a script to change the links.
find . -type l -print -exec ls -trl {} \; grep -i uat awk '{ print $11, $9 }' tee change_link.sh
Sending Mails
Sending a file as the body of the mail
For HP-UX
mailx –s “SUBJECT” yourmailid@id.com
For AIX
mail –s “
Sending file as attachment
uuencode file1.test file1.test mail yourmailid@id.com
You can’t specify the subject with mail.
Using mailx instead of mail will send the file as body of the mail and not as an attachment.
vi editor commands
Movement Commands
l or SPACEBAR or -> Moves right one character
h or CTRL-H or BACKSPACE or <- moves left one character j or CTRL-J or CTRL-N or down arrow move down one line k or CTRL-P or up arrow move up one line 0 beginning of line $ End of Line + or Enter Beginning of next line - Beg of Previous line w Move to next word or punctuation mark W Move to next word e Move to end of current word or punctuation E Move to end of current word b move back to beginning of word or punct B move back begning of word ) start of next sentence ( start of current sentence } start of next paragraph { start of current paragraph ]] start of next section [[ start of current section CTRL-F Move forward one full screen CTRL-D Move forward one half screen CTRL-B Move back one full screen CTRL-U Move back one half screen G Move to end of file
Modifying Text
rn replace current char with ‘n’
R
cwstringESC change the current word by replacing. The change continues until ESC is pressed. Vi puts $ over the last character of the work do be changed.
c$stringESC will change from current cursor position to end of line.
3c$ will change next three lines
Deleting Text
x deletes current character
dw delete from cursor to end of the word
d$ delete to the end of line
D deletes to end of line (Same as d$)
d) deletes to beg of next line
d} deletes to beg of next paragraph
d]] deletes to be of next section
dd deletes current line
dENTER deletes 2 lines
dG Deletes from Cursor to End of File
Undoing changes and deletions
u undo most recent change or deletion
U undo all changes made ina line since you last moved to that line
p put the contents to of the buffer to the right of the cursor (immediately below the current line)
P put the contents of the buffer to the left of the cursor (immediately above the current line)
:e! undo all the changes made since last time you save the file
Searching for text
/
/ENTER continue searching
?
n continue searching in the same direction
Copying and moving text
yw yanks (copies) a word
y$ yanks to the end of line
y) yanks to the end of sentence
y} yanks to the end of paragraph
y]] yanks to the end of section
yy or Y yanks the current line
p paste to the right of the cursor
P paste to the left of the cursor
