Some Common AIX/Unix Commands

   Posted August 13, 2004 by Jimmy Selix in Korn shell

The following list contains some common AIX commands.

• lsps –a (list paging space)
• lsattr –El mem0 (list current physical memory)
• extendlv hd6 16 (doubled paging space from 512MB to 1024MB)
(only use with IBM direction)
• smit lsmksysb (list files on a tape from a mksysb)
• lsdev –Cc disk (shows all disk drives)
• lscfg –vl hdisk1 (shows info on individual disk drives, s/n, p/n, etc…)
• lspv (shows disks installed on system)
• df –k (shows file system size information)
• lp filename (prints file to network printer)
• lpstat (shows print jobs)
• cancel # (cancels print job by #, found with lpstat)
• enq –U (restarts print que if status shows it is down–must be root)
• enq –Q prtx -#xxx (redirects a print job to another print que)
• ps –ef (shows current system processes)
• errpt –a (shows system error report including power outages)
• errclear 0 (completely clears the system errlog viewed with errpt –a)
• errclear –N sysplanar0 0
(clears only select items specified by the resource name, ex: sysplanar0)
• diag (system diagnostics, use the advanced diagnostics section; This helps determine the exact cause of a problem like sysplana0, queries system errlog for info.)
• sort –o list list (stores the sorted output of list back into list)
• sort –u list (sorts and eliminates duplicate lines)
• grep –vxf combinedlist masterlist (lists of #’s in masterlist not found in combinedlist)
ex: combinedlist=mulitple distribution lists containing SAs already downloaded to masterlist=list of all SA salons
This grep will list out the salons in the master list to which nothing has been downloaded.
• tail –f filename (shows last ten lines of a file and monitors for any updates)
• lsattr –El sys0 | grep maxuproc (shows maximum number of processes allowed for any one users; This can be increased by going into “smit system”.)
• lsvg –l rootvg (displays disk info including number of logical and physical partitions for each file system; PPs should be double that of LPs if disk is mirrored.)
• comm -12 file1 file2 (shows only what lines are in both file1 and file2; Sort both files before running the command. The -12 suppress columns 1 and 2 and what is only in file1 and only in file2,)
• wc filename (lists number of lines, number of words, number of characters in file; useful for distribution lists; can use –c for characters, -w for words, or –l for lines [e.g., wc –l filename, etc] )
• df –Ik [shows filesystem disk space; total, used and free (no Inodes)]
• (in vi) :r filename (reads in the contents of a file)
• (in vi) :r !command (reads in the output of a command)
• (in vi) yy p (copy and paste) – yy = yank, p = paste below line, P = paste above line.
• (in vi) dd p (cut and paste) – dd = cut, p = paste below line, P = paste above line.
• Ksh –n filename (checks for syntax errors in kornshell programs)
• cfgmgr (command to get system to recognize new hardware; can be run while system is running; A system boot runs it 3 times.)
• cfgmgr –i /dev/cd0 [installs drivers from cd for new hardware (best method)]
• lscfg –vp|grep CL (shows current firmware version)
• instfix –i | grep –i aix (shows maintenance level for AIX)
• oslevel –r (shows operating system level with maintenance level)
• nslookup server name (shows the IP address of the server name as it is on the network’s DNS server via the RS6000’s /etc/resolv.conf file; If it cannot resolve the server name, either the “name server” is stopped on the RS6000 (no resolv.conf file present) or there is something wrong with the DNS.)
• /etc/netsvc.conf file containing hosts=local,bind4 [This will force the RS6000 to first use the /etc/hosts file and then the DNS if it cannot find it in /etc/hosts. Otherwise, it will check in the DNS only (if name server is started on the RS6000) and never the hosts file. ???]
• lssrc –g nfs (use to check if nfs service is currently running)
• stopsrc –g nfs [use to stop nfs service – (change rcnfs from “wait” to off in /etc/inittab to prevent it from starting during boo)]


About Jimmy Selix

Jimmy Selix is an early adopter that loves to be one of the first on the block to have the latest and greatest in technology and gadgets. Another love of his is being able to share his knowledge to others seeking it. Feel free to drop any comments or questions that you may have.
View more articles by Jimmy Selix

The Conversation

Follow the reactions below and share your own thoughts.