{"id":3105,"date":"2014-06-06T14:38:06","date_gmt":"2014-06-06T06:38:06","guid":{"rendered":"http:\/\/rmohan.com\/?p=3105"},"modified":"2014-06-06T14:44:20","modified_gmt":"2014-06-06T06:44:20","slug":"aix-commands","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3105","title":{"rendered":"Aix commands"},"content":{"rendered":"<p>Commands<\/p>\n<p>CUT:<\/p>\n<p>lspv | cut -c 6-7            lists the hdisks numbers (cuts the 6th and 7tn character (disk nubers))<br \/>\ndlnkmgr view -drv | grep -w 00000 | awk &#8216;{print $4}&#8217; | cut -d . -f 3<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>EXPR: integer arithmetic<\/p>\n<p>\\*                           multiplication (\\ is needed to tell * is not a special character)<br \/>\n\/                            division<br \/>\n%                            remainder<br \/>\n+                            addition<br \/>\n&#8211;                            substraction<\/p>\n<p>expr \\( 6 + 4 \\) \/ 2        5<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>FIND: recursively searches the directory tree<\/p>\n<p>find \/ -xdev -type f -name &#8220;cor*&#8221; -size +10000c -exec ls -l {} \\;<\/p>\n<p>    \/                        where to find<br \/>\n    -xdev                    looks only in the given fs<br \/>\n    -type f                  what type to look for (f: file, d: direcory)<br \/>\n    -name &#8220;cor*&#8221;             name to look for<br \/>\n    -size +10000c            search for the given size (+10000c : greater than 10000 character (larger then 10kbyte))<br \/>\n    -size +2                 search for greater than 1kbyte (bloxk size is 512 byte, that&#8217;s why +2 is given)<br \/>\n    -exec ls -l {} \\;        what command to execute<br \/>\n                             ({}: it represents each findings and \\; is needed at the end of line)<br \/>\n                             e.g. find \/home -xdev -name &#8220;*.old&#8221; -exec rm {} \\;<br \/>\n    -mtime -1                file modifocation date is less then 1 day (+1 means older than 1 day)<\/p>\n<p>find . -name &#8216;*.ksh&#8217; -ok rm {} \\; this will ask if the command (rm) should be executed or not (much safer if find is not perfect)<br \/>\nfind \/etc\/rc.d -ls           it lists the files and dirs in the given dir<br \/>\nfind \/tmp\/bb -exec awk &#8216;\/func\/ {print FILENAME}&#8217; {} \\;   it will check in \/tmp\/bb if any files contains the word &#8220;func&#8221; and list those<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>GREP: (Global Regular Expression Parser) The grep command searches for the pattern.<\/p>\n<p>grep -i                      ignore case (small letter or capital)<br \/>\ngrep -c                      displays only a count of matching lines<br \/>\ngrep -n                      shows line number at the beginning of the matching line<br \/>\ngrep -v                      invert the sense of matching, to select non-matching lines<br \/>\ngrep -w                      selects only whole words<br \/>\ngrep -l                      lists the name of the files (once) which contain matching line  (grep -l paging00 *)<\/p>\n<p>ps -ef | egrep &#8216;ssh|aix&#8217;     select lines with ssh and aix<br \/>\nerrpt -a|grep -A1 &#8216;NAME&#8217;     selects lines with NAME and shows 1 line after that (A: after, B: before)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>HEAD, TAIL:<\/p>\n<p>head filename                displays first 10 lines of the file<br \/>\nhead -50 filename            displays first 50 lines<\/p>\n<p>tail filename                displays last 10 lines of the file<br \/>\ntail -50 filename            displays last 50 lines<br \/>\ntail +15 filename            displays the file starting from the 15th line<br \/>\ntail -f filename             used when we are monitoring the file (interactively shows how the file is changing)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>LSOF:<\/p>\n<p>NETWORK<br \/>\n-n                           no host name resolution<br \/>\n-P                           not converts port numbers to port names<\/p>\n<p>lsof -i                      show all network connections<br \/>\nlsof -i| grep LISTEN         shows what ports are waiting for connections<br \/>\nlsof -i | grep ESTABLISHED   shows current active connections<\/p>\n<p>lsof -i tcp                  list only TCP connections (works with udp as well)<br \/>\nlsof -i :<port>              shows all connections of a given port (lsof -i :22 or lsof -i :ssh)<br \/>\nlsof -i @<host>              shows connections to a specific host (lsof -i @192.168.1.5)<br \/>\nlsof -i protocol:@ip:port    this is the syntax for network findings (protocol: tcp or udp, @ip: any ip address, port: a port number)<br \/>\nlsof -a -u <user> -i         shows all network activity of a user (-a combines -u and -i)<\/p>\n<p>USER, FILES, PROCESSES<br \/>\nlsof -u <user>               shows what is open for a user (lsof -u oracle)<br \/>\nlsof <file>                  shows what is using a file (lsof \/var\/adm\/syslog.log)<br \/>\nlsof <directory>             shows what pids are using the filesystem (directory) (it can be good if we cannot umount)<br \/>\nlsof +D <directory>          shows which file is open by which process in a directory (lsof +D \/usr)<br \/>\n                             (+D will show recurcively the open files, otherwise only device name would be shown)<br \/>\nlsof -N                      list all NFS files<br \/>\nlsof -c <command>            shows files and network connections a command is using (lsof -c ssh)<\/p>\n<p>lsof -p <pid>                shows what a proccess ID has open (lsof -p 335545)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>HOW TO FIND WHAT FILES ARE OPENED BY A PID<\/p>\n<p>1.<br \/>\nroot@aix20: \/root # lsof -p 319660<br \/>\nCOMMAND    PID USER   FD   TYPE   DEVICE SIZE\/OFF  NODE NAME<br \/>\novcd    319660 root   32r  VREG     10,5    12153 69705 \/usr (\/dev\/hd2)<\/p>\n<p>(it will show the filesystem and the indode number (69705))<\/p>\n<p>2.<br \/>\nroot@aix20: \/root # find \/usr -inum 69705<br \/>\n\/usr\/lpp\/VV\/msg\/en_US\/sec.cm.client.cat<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>METACHARACTERS, VARIABLES:<\/p>\n<p>                     GREP    SHELL<br \/>\nsingle character      .       ?<br \/>\nmulticharacter        .*      *<br \/>\ncharacter range     [x-z]    [x-z]<br \/>\nbegins a line         ^       N\/A<br \/>\nends a line           $       N\/A<br \/>\nvariable             N\/A      $   <\/p>\n<p>HOME                         home directory<br \/>\n$PS1                         prompt symbol<br \/>\nset                          displays the values of all shell variables<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>RPM:<\/p>\n<p>rpm -qa                       shows what rpm packages are installed<br \/>\nrpm -ql <package name>        shows where the files are installed (rpm -qlp .. shows the absolut paths???)<br \/>\nrpm -q &#8211;filesbypkg cdrecord  list all the files on installed rpm package<br \/>\nrpm -qf \/usr\/bin\/lynx         query a file to find the source rpm package<br \/>\nrpm -qi <package name>        list information on an installed rpm package<br \/>\nrpm -qR <package name>        list all dependencies on any rpm package<\/p>\n<p>rpm -ivh httpd-2.2.8.aix5.1.rpm install the rpm package<\/p>\n<p>rpm -ivh &#8211;force *.rpm<br \/>\nrpm -ivh &#8211;force &#8211;nodeps <package name>    does not check dependency (same can be done with &#8220;rpm -Uvh&#8230;&#8221; for upgrade)<br \/>\nrpm -e <package name>         removes the rpm package<\/p>\n<p>rpm -Va                       shows which files are missing from the RPM database<br \/>\nrpm -Vv <package name>        verifies a package<br \/>\nrpm &#8211;rebuilddb               compress and rebuild the RPM database<\/p>\n<p>\/usr\/sbin\/updtvpkg            enables the rpm command to recognize that the libraries have been installed<\/p>\n<p>In some cases you might get an error about failed dependencies when you install RPMs on AIX (for example, error: failed dependencies: libX11.a(shr4.o) is needed by tk-8.3.3-1). Most likely the error occurs because the rpm command does not recognize the shared library. If the error occurs, check to see if the X11 libraries are installed in the directory \/usr\/lpp\/X11\/lib. If they are not installed, use the AIX product media to install them. After you have installed the libraries, run the above command (updtvpkg). The command enables the rpm command to recognize that the libraries have been installed.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>RSYNC:<\/p>\n<p>Much like cp, rsync copies files from a source to a destination. Unlike cp, the source and destination of an rsync operation can be local or remote. rsync can resume a transfer after interruption; it transfers only those portions of a file that differ between source and destination; and rsync can perform entire or incremental backups.<\/p>\n<p>By default, rsync uses Secure Shell (SSH) as its transport mechanism; you can reuse your machine aliases and public keys with rsync<\/p>\n<p>rsync -av \/tmp\/bb_rs30 \/tmp\/bb        it will copy the directory (\/tmp\/bb_rs30) and its contents under \/tmp\/bb<br \/>\nrsync -av \/tmp\/bb_rs30\/ \/tmp\/bb       it will copy the contents of the named directory but not the directory itself (check \/ at the end)<br \/>\n                                      -v option enables verbose messages<br \/>\n                                      -a option (stands for archive), is a shorthand for -rlptgoD:<br \/>\n                                      recurse, copy symbolic links as symbolic links, preserve permissions, preserve file times,<br \/>\n                                      preserve group, preserve owner, and preserve devices and special files, respectively<\/p>\n<p>rsync -n -av \/tmp\/bb_rs30\/ \/tmp\/bb   -n: previews what will happen but does not move a single byte (it is good for testing)<\/p>\n<p>rsync -av \/tmp\/bb_rs30\/ aix2:\/tmp\/bb_rs20  it will copy the contents of the given dir to the other host<br \/>\n                                           (assuming the same login name on the remote machine)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>SORT:<\/p>\n<p>cat \/etc\/passwd | sort -t: -n +2<br \/>\n    -t:                      gives the delimeter character (here :, deafult is the space)<br \/>\n    -n                       numerical order<br \/>\n    +2                       sort by the 3rd column<br \/>\n    -r                       reverse order<\/p>\n<p>df -m | sort -n +3 | egrep &#8216;9.%|100%&#8217;    sorts by the 4th column (%) of the filesstems, which are 90-100% full<br \/>\ncat animals | sort +0.1      sort the file animals by the second character of the first word<br \/>\nls -lR |sort -nk 5|tail -20  sorts the 20 largest file<br \/>\nlspv | sort -k1.6n           list hdisk in numerical order (lspv|sort -tk +1 -n <--it is the same (delimiter is \"k\")\nlspv | sort -k1,1.5 -k1.6n   list hdisks then vpaths in numeric order\n\n--------------------------------------------------------------------------------\n\nTAR:\n\ntar -cvf \/tmp\/file.tar .                       saves where we are to the given path (-c: create, -v: verbose, -f: file)\ntar -cvf conf.tar conf                         creates conf.tar of the dir conf\ntar -xvf \/tmp\/file.tar                         extracts the tar file (-x: extract)\ntar -xvf -C \/home\/bb \/tmp\/file.tar             it will extract the tar file to \/home\/bb\ntar -tvf \/tmp\/file.tar                         list (verify) the content of a tar file\n\ntar -cf - * | gzip -9 > vmi.tar.gz             makes tar and zip wehere we are<br \/>\ntar cvf &#8211; openssh5.8p1 | gzip -c > openssh5.8p1.tgz   creates tgz in one command<\/p>\n<p>tar: 0511-197 DirectorServer: Cannot write data extracted with the tar command:<br \/>\nA file cannot be larger than the value set by ulimit.<\/p>\n<p>I changed these ulimit settings after that it was OK (dont&#8217;t forget to logout and login again)<br \/>\nroot@bb_lpar: \/bb # chuser fsize=-1 fsize_hard=-1 root<br \/>\nroot@bb_lpar: \/bb # chuser data=-1 data_hard=-1 root<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; <\/p>\n<p>TRUSS:<\/p>\n<p>truss <command>              it will show what system calls a command makes<br \/>\ntruss -c -p <pid>            it will trace a process (-c: counts the system calls rather than displaying them, -p: pid)<br \/>\ntruss -d -p <pid> -o<br \/>\ntruss -t open lsps -a        shows whatis needed for the given command (here lsps -a)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>XARGS:<\/p>\n<p>lspv|awk &#8216;{print$1}&#8217;|xargs   it will list the elements in a line separated with space<br \/>\ncat list | xargs -t rm       will rm all the files which are in the file list<br \/>\nls | xargs -t -I {} mv {} {}.old it will rename to .old all the file in the current dir<br \/>\n    -t                       it echoes the constructed command (trace mode) (it is optional)<br \/>\n    -I {}                    insert each line of the ls to that place where the {} symbol appear<\/p>\n<p>lsdev -Cc disk | xargs -n1 rmdev -dl removes all the listed disks<br \/>\n    -n1                      1 element will be passed each time to xargs (if n2 then the command will be created with 2 elements)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>ZIPPING:<\/p>\n<p>gzip-V                       shows gzip version<br \/>\ngzip file1                   zip<br \/>\ngzip -d file1.gz             unzip<\/p>\n<p>gzip -9 filename             will zip (and remove the file automatically)<br \/>\ngunzip filename              unzipping it<\/p>\n<p>gzip -c file > file.gz       it creates a zip file but leave the original file as well<br \/>\n> filename                   after that original file can be emptied<\/p>\n<p>compress file1               the original file will be deleted and a new compressed file will be created with a .Z at the end<br \/>\nzcat file1.Z                 displays the compressed files (without uncompression)<br \/>\nuncomress file1.Z            uncompressing a file (the compressed one will be deleted)<\/p>\n<p>if you receive this:<br \/>\ngunzip SysDir6_2.tar.gz<br \/>\ngunzip: SysDir6_2.tar: File too large<\/p>\n<p>this is because gzip 1.2.4 (or lower gzip versions) need a patch to accept large files, workaround for this problem:<br \/>\ngzip -d -c SysDir6_2.tar.gz| tar xvf &#8211;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>OTHER:<\/p>\n<p>file <filename>              shows the type of a file<\/p>\n<p>diff file1 file2             compares only text files<br \/>\ncmp file1 file2              compares all types of files<br \/>\ndircmp dir1 dir2             compares directories<\/p>\n<p>time cp file1 \/home          show the time to accomplish the command (godd for performance analysis)<\/p>\n<p>ps $$                        shows which shell is in use<br \/>\necho $SHELL                  shows the current shell<br \/>\nprintenv                     view environmental variables<\/p>\n<p>cat -vet file                shows tabs, enters&#8230; as viewable characters<br \/>\n    -v                       displays non-printing characters as visible characters<br \/>\n    -t                       displays tab as ^I<br \/>\n    -e                       displays enter as $<\/p>\n<p>!!! sh -xv <command...>      for troubleshooting, if a command fails, you can see where exactly it failed in the command script!!!<br \/>\n                             (sh -xv exportvg rootvg)<\/p>\n<p>dd if=\/dev\/zero of=\/home\/user\/bb\/4GB_file bs=1m count=4000  it creates a 4GB file<br \/>\nlmktemp <filename> <size_in_bytes>   it creates a file with given size<\/p>\n<p>alias dir=&#8217;ls&#8217;               creates an alias<br \/>\nunalias dir                  removes an alias<br \/>\nset &#8211; unset<\/p>\n<p>df -g | awk &#8216;{sum = sum + $3} END {print sum}&#8217; it sums up the fs in gigabyte (by the 3rd column)<br \/>\nfor i in `ls -l | grep old | awk &#8216;{print $9}&#8217;` ;  do du -sk $i; done | awk &#8216;{sum = sum + $1} END {print sum}&#8217;<\/p>\n<p>CPU &#8211; PROCESSES:<\/p>\n<p>Physical &#8211; Virtual &#8211; Logical CPU:<\/p>\n<p>Physical Processors are cores in the machine. Virtual Processors are assigned to an LPAR manually when LPAR is created. Logical Processors are created automatically by AIX, depending on the SMT setting.<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2014\/06\/1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2014\/06\/1.jpg\" alt=\"1\" width=\"320\" height=\"171\" class=\"aligncenter size-full wp-image-3109\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2014\/06\/1.jpg 320w, https:\/\/mohan.sg\/wp-content\/uploads\/2014\/06\/1-300x160.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2014\/06\/1-150x80.jpg 150w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><\/p>\n<p>Simultaneous Multi-Threading (SMT)<br \/>\nSMT is that feature of a Power Processor, when multiple hardware threads can run on one physical processor at the same time (a processor appears as 2 or 4 logical CPU). Within a CPU (core\/cpu\/processor are the same thing) there are multiple execution units. For example: floating point arithmetic unit, load and store execution units&#8230; A single thread would use only 1 or 2 of those units at any point in time. So most of the executional units within a core will not be utilized. With the ability of multi-threading 2 (or 4) threads could be running in a core at same time. One of them will use the floating processor while the other doing load and store &#8230;(If there are collisions, one of them would be delayed but it happens no too often.)<\/p>\n<p>How threads will be dispatched to multiple cores:<br \/>\nFirst thread will be dispatched to the primary hw thread of a physical cpu. If we have another CPU then next thread will be dispatched there (to avoid collision)<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2014\/06\/Capture.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2014\/06\/Capture.jpg\" alt=\"Capture\" width=\"970\" height=\"554\" class=\"aligncenter size-full wp-image-3110\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2014\/06\/Capture.jpg 970w, https:\/\/mohan.sg\/wp-content\/uploads\/2014\/06\/Capture-300x171.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2014\/06\/Capture-150x85.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2014\/06\/Capture-400x228.jpg 400w, https:\/\/mohan.sg\/wp-content\/uploads\/2014\/06\/Capture-900x514.jpg 900w\" sizes=\"(max-width: 970px) 100vw, 970px\" \/><\/a><\/p>\n<p>IMPORTANT:<\/p>\n<p>&#8211; Prior AIX6 TL4: if only a single hw thread was busy, processor reported as 100% utilized (this is an error because all the secondary threads were not utlized)<\/p>\n<p>&#8211; AIX6 TL4 and later: potential capacity of unused hw threads are from TL4 reported as idle time for the processor (it measures the capacity of the unused hw threads.)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>SMT behaviour and intelligent SMT threads:<\/p>\n<p>AIX default behaviour is to use all the VPs for maximun performance. If workload grows it will use up all VPs (CPU cores) quickly, but AIX first uses SMT thread 1 on all CPU cores before allocating work to the 2nd, 3rd and 4th SMT threads.<\/p>\n<p>SMT threads can be seen as Logical CPUs on AIX. If SMT=4 then 1 VP shows up as 4 Logical CPU. From Power7 there is a thing called &#8220;intelligent SMT threads&#8221;. If there are not enough processes to run on all SMT threads (official mode is SMT=4) it will be dynamically switched to 2 or 1.<\/p>\n<p>mpstat or topas -L is showing it:<\/p>\n<p>At the column &#8220;lpa&#8221; the sign &#8220;-&#8221; will show turned off SMT threads<\/p>\n<p># mpstat 2<\/p>\n<p>cpu  min  maj  mpc  int   cs  ics   rq  mig lpa sysc us sy wa id   pc  %ec  lcs<br \/>\n  0    0    0    0  265   35   24    2    0 100   64 100  0  0  0 0.63 31.7   99<br \/>\n  1    0    0    0   12   12    0    0    0 100    9  0  0  0 100 0.12  6.1   22<br \/>\n  2    0    0    0    9    0    0    0    0   &#8211;    0  0  0  0 100 0.12  6.1   20  <--this SMT thread is turned off\n  3    0    0    0    9    0    0    0    0   -    0  0  0  0 100 0.12  6.1   19  <--this SMT thread is turned off\n  4    0    0    0  100   12    8    1    0 100    0 100  0  0  0 0.64 31.8   99\n  5    0    0    0   19   59    0    0    0 100    9  0  0  0 100 0.12  6.1   69\n  6    0    0    0    9    0    0    0    0   -    0  0  0  0 100 0.12  6.1    9  <--this SMT thread is turned off\n  7    0    0    0    9    0    0    0    0   -    0  0  0  0 100 0.12  6.1    9  <--this SMT thread is turned off\nALL    0    0    0  432  118   32    3    0   0   82 63  0  0 37 2.00 999.8  346\n--------------------------------------------------------------------------------\n\n------------------------\n\nContext Switch:\nIt is inherent in any multiprocessing operating system. Different appl. threads are sharing a CPU. Every time 1 thread is leaving a CPU and a new thread  is dispatched to the CPU, a context switch occurs. The environment of the leaving one has to be saved and new environment ha to be reestablished for the new process. High context switch rates can cause many work (overhead) for the CPU, which can be a problem.\n\n------------------------\n\n\nPROCESS:\n\nYou use commands to tell the operating system what task you want it to perform. When commands are entered, they are recognized by a command interpreter (also known as a shell), and the task is processed.\n\nA program or command that is actually running on the computer is referred to as a process.\n\nThe commom types of processes:\n\nForeground processes\nProcesses that require a user to start them or to interact with. Programs and commands run as foreground processes by default.\n\nBackground processes\nProcesses that are run  independently of a user. To run a process in the background, type the name of the command with the appropriate parameters and flags, followed by an ampersand (&#038;). When a process is running in the background, you can perform additional tasks by entering other commands at the command prompt. Most processes direct their output to standard output (stdout), even when they run in the background. Because the output from a background process can interfere with your other work on the system, it is usually good practice to redirect the output of a background process to a file.\n\nDaemon processes\nDaemons are processes that run unattended. They are constantly in the background and are available at all times. Daemons are started usually when the system starts, and they run until the system stops. A daemon process typically performs system services. For example qdaemon (provides access to system resources such as printers) and sendmail are daemons.\n\nZombie processes\nA zombie process is a dead process that is no longer executing but is still recognized in the process table (in other words, it has a PID number). Zombie processe have been killed or have exited and continue to exist in the process table until the parent process dies or the system is shut down and restarted. Zombie processes display as <defunct> when listed by the ps command. The only way to remove zombies is to reboot the system.<\/p>\n<p>Thread<br \/>\nEach process is made up of one or more kernel threads. A thread is a single sequential flow of control. Rather than duplicating the environment of a parent process, as done via fork, all threads within a process use the same address space and can communicate with each other through variables.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Process priority<\/p>\n<p>A priority is a number assigned to a thread. The kernel maintains a priority value (0-255). A smaller priority value indicates a more important thread. Real time thread priorities are lower than 40.<\/p>\n<p>Nice value<br \/>\nA nice value is a priority adjustment factor added to the base user priority of 40 (for non-fixed priority threads). The nice value is used by the system to calculate the current priority of a running process. The first process in the system (init) has a nice value of 20, and therefore an effective priority of 60. (PRI heading in the below output) A foreground process has a nice value of 20 (24 for a background process).<\/p>\n<p>ps -el                 shows process priorities<br \/>\nps -ekl                shows process priorities including kernel processes<br \/>\nps -kmo THREAD         shows processes with their threads priorities<\/p>\n<p>root@aix31: \/ # ps -el    <--shows the nice values under the NI heading (-- means it is running with fixed prio.\n       F S UID    PID   PPID   C PRI NI ADDR    SZ    WCHAN    TTY  TIME CMD\n  200003 A   0      1      0   0  60 20 7037000   784               -  0:39 init\n  200103 A   0 311326 352456   0  24 -- 81d8400  4676               -  1:15 xmtopas\n\nThe nice value can be set at process creation time by using the nice command. If the process already created the renice command is used.\n(ksh will add automatically 4 to the default nice value (20) if a process is started in the background (&#038;))\n\nThe nice value can be ranged from 0 to 39, with 39 being the lowest priority.\nnice -10 <command>         add 10 to current nice value (lower priority)<br \/>\nnice &#8211;10 <command>        subtract 10 from current nice value (higher priority)<\/p>\n<p>The renice value can be -20 to 20. (1-20: lowers the priority, 0:sets to the base scheduling priority, -20 to -1:highers the priority)<br \/>\nrenice 10 -p <pid>         add 10 to the default nice value (20) (lower priority)<br \/>\nrenice -n 10 -p <pid>      add 10 to current nice value  (lower priority)<br \/>\nrenice -10 -p <pid>        subtract 10 from the default nice value (20) (higher priority)<br \/>\nrenice -n -10 -p <pid>     subtract 10 from current nice value (higher priority)<br \/>\n                           (-n: incerment is added to the current nice value, not default)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>CPU infos:<\/p>\n<p>lscfg | grep proc            shows how many (virtual) processors we have (lsdev -Cc processor, shows also how many virt. proc we have)<br \/>\nbindprocessor -q             shows how many logical (SMT) processors we have<br \/>\nlsattr -El procX             shows the processor settings<br \/>\npmcycles -m                  shows the processors speed (if smt is enabled it will show for all the logical processors)<br \/>\nsmtctl                       it will show how many processor we have (if smt is turned on or not)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Process handling:<\/p>\n<p>Ctrl-C or Ctrl-Backspace   cancels a foreground process<\/p>\n<p>ps                         lists processes (by default lists only processes started from the current terminal)<br \/>\n    -e                     every process runnning on the system<br \/>\n    -f                     full listing (username, PPID&#8230;)<br \/>\n    -L <pid>               lists all processes which PPID is <pid>\n    -u <user>              lists all processes running under <user><br \/>\n    -T                     lists the tree of a given process (shows the children of a given process)<\/p>\n<p>ps -elmo THREAD            lists processes and its threads (shows pids and the threads (tid) which belong to a given process)<\/p>\n<p>proctree <pid>             displays the process tree of the specified process<\/p>\n<p>kill <pid>                 notification to the process to terminate (it is using the default, 15, signal)<br \/>\nkill -9 <pid>              kills the process without notification<br \/>\nkill -1 <pid>              restarts the process (rereads the config files as well) (HUP &#8211; hangup)<br \/>\n                           (when a background process is running and you log off a hangup signal is sent)<br \/>\nkill -2 <pid>              interrupt signal (same as ctrl+c)<br \/>\nkill -l                    lists all the signals supported by kill (cat \/usr\/include\/sys\/signal.h will show as well, with details)<\/p>\n<p>ls -R \/ > ls.out &#038;         starts ls in the background (standard output is ls.out)<br \/>\nnohup ls -R \/ > ls.out &#038;   nohup allows a background process to continue after logging off the system<br \/>\n                           (if output isn&#8217;t redirected, it will create nohup.out)<br \/>\necho &#8220;<command>&#8221; | at now  this also starts in the background (and you can log off)<br \/>\njobs                       lists which processes are running in the background<\/p>\n<p>nohup alt_disk_copy -d hdisk1 -B &#038; can&#8217;t be hanged up and in backgound (kill command can stop it)<\/p>\n<p>Restarting a stopped foreground process (jobs command):<br \/>\n1. Ctrl-Z                  stops a foreground process, its PID is still in the process table (it goes to background)<br \/>\n2. jobs                    this will list stopped processes<br \/>\n[1] + Stopped (SIGTSTP)        .\/myscript    <--you will see a line like this (here #1 is the job id)\n3. fg %1                   put given job into foregeound (bg %1 puts into background)\n\n\nRestarting a stopped foreground process (ps -ef <pid>):<br \/>\n1.Ctrl-Z                   stops a foreground process, its PID is still in the process table (it goes to background)<br \/>\n2.ps -ef | grep <PROC.NAME>    find the process ID (PID)<br \/>\n3.fg <PID>                 restarts that stopped proces (it will go to foreground)<\/p>\n<p>Removing a background process:<br \/>\n1.find \/ -type f > output &#038;    run the find command in the background<br \/>\n2.ps                      lists the PID numbers<br \/>\n3.kill <PID>              cancel the process<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>The operating system allows you to manipulate the input and output (I\/O) of data to and from your system. For example you can specify to read input entered on the keyboard (standard input) or to read input from a file. Or you can specify to write output data to the screen (standard output) or to write it to a file.<\/p>\n<p>When a command begins running, it usually expects that the following files are already open: standard input, standard output and standard error. A number, called a file descriptor, is associated with each of these files:<\/p>\n<p>0     represents standard input (stdin)<br \/>\n1     represents standard output (stdout)<br \/>\n2     represents standard error (stderr)<\/p>\n<p>The redirection symbols and their meanings:<br \/>\n<     redirects input (stdin) (< filename is added to the end of the command)\n>     redirects output (stdout) (> filename is added to the end of the command)<br \/>\n>>    appends output<br \/>\n<<    inline input (see pg. 574)\n2>    redirects output (stderr)<br \/>\n1>&#038;2  redirects stdout to stderr<br \/>\n2>&#038;1  redirects stderr to stdout<\/p>\n<p>mail denise < letter1        sends the file letter1 to user denise with the mail command\necho $PATH > path1           saves the value of the PATH variable on the file path1<br \/>\ncat file2 >> file1           append file2 to file1 (the cat commands can concatenate not only display files)<br \/>\nls -l file1 2> list1         save the stderr to file list1 (if file1 does not exist)<br \/>\nls *.dat *.txt > files.out 2> files.err    (files.out: stdout, file.err: stderr)<br \/>\ncommand > output 2>&#038;1        saves all the output (stdout and stderr) in one single file<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commands<\/p>\n<p>CUT:<\/p>\n<p>lspv | cut -c 6-7 lists the hdisks numbers (cuts the 6th and 7tn character (disk nubers)) dlnkmgr view -drv | grep -w 00000 | awk &#8216;{print $4}&#8217; | cut -d . -f 3<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>EXPR: integer arithmetic<\/p>\n<p>\\* multiplication (\\ is needed to tell * is not a special character) \/ division [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3105"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3105"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3105\/revisions"}],"predecessor-version":[{"id":3112,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3105\/revisions\/3112"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}