AIX Foundation-Basic Commands+
AIX Foundation-Basic Commands+
AIX Foundation-Basic Commands+
To List:
Cat:
●cp
●cp -p [p-preserve] (to copy with the same time of the file and ownership)
●rm <file>
●pg file1
●pg /etc/security/user
HEAD,TAIL:
●*By default 10 lines will be listed if not mentioned in specific like “-5”+
3
Other Commands:
●bootinfo -b (to check the last boot device through which the server was booted)
●g _ dependent filesets
●p _ preview
●ex: lslpp -h bos.net.nfs.server (to check updated level (or) history of the fileset)
●lslpp -f bos.net.nfs.server
●lslpp -w /sbin/automount
▪o/p > bos.net.nfs.server (to find out the fileset in which the file is available)
●stty erase (backspace) enter-to set backspace key to delete commands for this session.
●istat <filename> (or) <directory name> (to list file (or) directory full details)
USER ADMINISTRATION:
●File Permission: r-read[4], w-write[2], x-execute[1]
●Maximum Permission for File → 666 (777), Maximum Permission for Directory → 777
●chmod -R 755 <directory> (to change permission for all files and sub directories)
●chgrp <group name> <file>/<directory> (to change the group of the file or directory)
●suid-set for commands, to allow all users to run command with root (owner) privileges at
the time of execution.
●sgid-if set for directory, group privileges will be granted for the time of running cmd
●sgid-if set for directory, any file created by any user will have group membership of that
directory
●STVX-sticky bit:***
●Restrict the users to remove/rename of other users files/sub directory under the directory,
but we can work on other user files.
●mkuser ,attributes- <username> (to add attributes to user while creating username)
6
●rmuser <username> (to remove user account & not the home directory)
●rm -r /home/<username> (to remove the home directory of the specific user)
●/etc/security/lastlog (keeps the last successful & last unsuccessful login default)
●/etc/environment (contains global environment variables applicable to all process & users)
●/var/adm/wtmp (contains connect time details of all users since server build)
DEVICES MANAGEMENT:
●Device Database - /etc/objrepos/*
●rmdev -dl hdisk# (to remove a device permanently from ODM database)
●cfgmgr -i /usr/sys/inst.images/drivers/
●lsdev -C -l cd0 -F parent (to find the parent of particular child device)
●migratepv -l <lv> <source> <destination> (to move one LV from one PV to another PV)
●migratepv hdisk# hdisk# (to move all LV from one PV to another PV)
●Create VG’s:
●Big VG:
●Scalable VG:
●Convert VG’s
●varyoffvg <vgname>
●varyonvg <vgname>
●Mirror RootVG:
●mirrorvg -S rootvg hdisk1 (to copy rootvg from hdisk0 to hdisk1 in background)
●Unmirror RootVG:
●exportvg datavg (to remove VG related info from ODM & /etc/filesystem entries related
datavg)
●importvg -y datavg/newvg hdisk1 (it will update ODM from VGDA info of hdisk1 & update
entries in /etc/filesystem)
●Logical Volume:
●mklv -y <lvname> -t jfs2 -c 2 <vgname> 5 hdisk1 hdisk2 (to create LV with copy(mirror)
while creating LV)
FILESYSTEM MANAGEMENT:
●Filesystem types: jfs/jfs2
●Super Block: When creating a filesystem in LV, one of the block is reserved for super block.
●Increase FS size:
●Reduce FS size:
●unmount /orafs
●mount /newfs
12
●unmount /newfs
●rmfs /newfs
●mksysb -i -e -f /dev/rmt0
●smitty lsmksysb
●Datavg backup:
●ex: tar -cvf f5.tar /home/f1 /tmp/f3 /usr/f3 (absolute path) (files will be restored in the
same path)
●ex: tar -xvf f5.tar /etc/group (to extract (or) restore all files from a tar file)
●ex: tar -rvf f5.tar f4 (to add (or) append additional files in a tar file)*
●ex: pax -avf f5.pax f6 (to add (or) append a additional file)
●tctl -f /dev/rmt0 fef 3 (to move the pointer to the 4th location)
●lspv
●bootinfo -b
●lspv
●alt_disk_install -B -C hdisk1 (B-not to update boot order once cloning completed, C-clone)
●alt_disk_copy -d hdisk1
●smitty alt_clone
●lspv
●lspv
●bootlist -m normal hdisk0 (change the bootdown to (hdisk0) actual/original rootvg &
reboot
●shutdown -Fr
●lspv
▪o/p hdisk1 none (then reattach the hdisk1 into rootvg and then remirror)
15
MULTI BOS:
●multibos -sX (to create standby bos and if required filename), X-extend the space
●bootlist -m normal hdisk0 blv=hd5 hdisk0 blv=bos,hd5 (to change boot order)
PAGING SPACE:
●Paging Space is support time for Main Memory. a-activate automatically swap space, s-size
●ex: chps -s 2 paging00 (to increase the size of paging space dynamically [online] 10+2=12)*
●ex: chps -d 5 paging00 (to reduce the size of paging space dynamically [online] 12-5=7)*
●ps -ef (to check all (b/g & f/g) process running in the server)
●kill -15 <pid> (to save and kill the process properly)
16
●ps -ef |grep -i defunc (to list the defunction process only)
●startsrc -g nfs (to start all daemons under the service nfs)
●stopsrc -g nfs (to stop all daemons under the service nfs)
●stopsrc -t ftp
●lssrc -a | more
●lssrc -s nfsd
●lssrc -t ftp
●lssrc -s inetd
●lssrc -ls inedt (to list running supported daemons under this daemon)
17
MANAGING LAN:
●ent-Physical (MAC) Address, en-Logical Interface(Assign IP Address)
●CLASS A → 10.0.0.0-10.255.255.255
●CLASS B → 172.16.0.0-172.31.255.255
●CLASS C → 192.168.0.0-192.168.255.255
●lsdev -c adapter
●lsdev -c if
18
●Filesets to install:
●lslpp -l bos.net.nfs.server
●lssrc -g nfs
●mknfs -N
●Define Export:
●Export Share:
●Remove Share:
●rmnfsexp (or)
●smitty rmnfsexp
●Check Exports:
●showmount -e (or)
●exportfs (&)
BOOT PROCESS:
●POST-Power On Self Test, IPL-Initial Program Loader
●1.ROS phase (Read Only Storage)-BIOS Initialization Phase, Kernel Initialization Phase
20
●3.init phase-1.Initilization phase (/etc/inittab phase)[will make system ready for use. All
application, services started in this phase]
●1.ROS phase
●▪RAM FS created
●▪copycore (to move any dump info in case of OS crash into /var/adm/ras/vmcore.x)
●▪swapon /dev/hd6
●▪/,/usr,/var unmounted & mounted on their own mount points (disk based)
●▪mount /tmp
●▪syncvg rootvg (to synchronize any state of PP’s if rootvg mirrored in background)
●▪cfgcon (to configure console device), 0C31-not configured, 0C32-is a lft, 0C33-is a tty,
0C343-is redirected to a file
●telinit
●Actions:
●wait-starts the process & wait for completion & scans next line
●/etc/rc (file)
●/etc/rc.tcpip (file)
●▪configures all tcpip related daemons like inetd, rwhod, named, routed, sendmail, lpd etc...
●/etc/rc.net (file)
●▪configures router/gateway on OS
●rmitab <lineid>
●lsitab test
●bootinfo -y
●prtconf -c
●getconf HARDWARE_BITMODE
●bootinfo -k
23
●prtconf -k
●getconf KERNEL_BITMODE
LINKS:
●HARD LINK & SOFT LINK
●Hard Link:
●▪The inode value will be same for source & link file
●▪Even source file deleted, still link file will point to the data
●ex: ln f1 f2
●ex: ln f1 f3
●ex: ln -al f1 f2 f3
●▪It will have a different inode no, data of this file is pointing to the address of the source
ALOG:
●alog-To read some of the log files under /var/adm/ras (ras-reliable available serviceable)
●boot → /var/adm/ras/bootlog
●bosinst → /var/adm/ras/bosinstlog
●console → /var/adm/ras/console
●nim → /var/adm/ras/nimlog
ERRPT:
●errpt-Used to read the information from /var/adm/ras/errlog
●Daemon → /usr/lib/errdaemon
●logfile → /var/adm/ras/errlog
●errpt -aj <error id> |more (to view specific error id details)
●> /var/adm/ras/errlog (to nullify the errlog file) *Don’t nullify the errlog file]
●rm /var/ad,/ras/errlog
DUMP DEVICES:
●▪It is a LV type (sysdump), system usable created on rootvg disks.
●▪Dump Information: Used to hold the dump information in case of OS, Application, H/W
crash.
●▪Used for troubleshooting the crash reason (or) RCA (Root Cause Analysis)
●Types: Primary dump device & Secondary dump device: p-primary, s-secondary
●sysdumpdev -L (or) sysdumpdev -z (to view any dump occurred (or) not)
SCHEDULING TASKS:
●command-crontab
VI EDITOR:
●3 modes of operation:
●Copy:
●Cut:
●Delete:
●INSERT/EDIT/APPEND MODE:
●Esc + w! <filename> (save to another file and remains editing) (or) Esc + x
29
●Enter into maintenance mode by pressing F5 or 5 (without entering into SMS menu)
●Action: Select Option ¤1.Access rootvg with mounted filesystems and start a shell
●df / & df /tmp (check for free space in root and tmp, if no enough space)
●ipl_varyon -i
30
●Error Code → 0551, 0552, 0557, 0518: (Corrupted jfs/jfs2 FS and corrupted jfs/jfs2 log)
●Action: Select Option ¤2.Access rootvg without filesystems and start a shell
●lslv -m hd5
●ipl_varyon -i
●Action: Select Option ¤1.Access rootvg with mounted filesystems and start a shell
●df /, /tmp, /var (check for free space in root, tmp, var if no enough space)
●Check for /etc/environment & /etc/inittab files for any wrong/missing entries and rectify
them if any.
●Error Code → 0552, 0554, 0556: (SuperBlock [damaged FS] corrupted (or) ODM corrupted
●Action: Select Option ¤2.Access rootvg without filesystems and start a shell
●fsck -y /dev/hd1, /dev/hd2, /dev/hd3, /dev/hd4, /dev/hd9var (If error like block number
0-8 damaged, superblock is corrupted)
●/usr/sbin/logform /dev/hd8
●mkdir /mnt/etc/objrepos/backup
●savebase -d /dev/hdisk#
●sync; sync; reboot -q (if error occurs even after reboot, restore bos)
●sysdumpdev -l
●rmlv <dumplv#>
●chpv -c hdisk#
32
●diag→task seleciton→hot plug task→hot plug (identify the PV location to be removed) PC1
RAID MANAGER
●Remove the failed PV from identified slot and insert new PV:
●cfgmgr
●Replace a PV:
●lspv
●lsvg -l rootvg
PERFOMANCE MONITORING:
●Types of process: 1.Foreground process, 2.Background process, 3.Zombie process
●kill -9 <pid>
●iostat (to check i/o data transfer in i/o devices [hard disk, cd drive])
●ex: iostat 2 5
●topas command:
●diag command:
●svmon -U <username> -O unit=GB/MB (to check CPU usage of process per user)
●svmon -P -t 5 -O unit=GB/MB (to list top most 5 process which are using more memory)
●netstat command:
●netstat -an | grep -i listen (to list the opened port in port numbers)
●netstat -v ent0 & netstat -d ent0 (to check network and statistics)
SNAP:
●snap -r (to remove old snap files)
●snap -gc (to create new snap files, to collect general information’s and compress)
FIXES MANAGEMENT:
●APAR: (Authorized Program Analysis Report) IX<no>,IY<no>,IX<no>
●ML/TL Installation: (Major OS related update) similar method for Service Pack installation)
●Pre-Check’s to be done:
●2.Check for free space in filesystems and increase if necessary. (/, /usr, /var, /tmp)
35
●lppcheck -v
●lspv, lsvg, lsvg -o, lslpp -l, ifconfig -a, bootlist -m normal, df -m, oslevel -s,
●Install ML/TL:
●Download latest TL from IBM fix centre (or) through our NFS server
●Installation:
●smitty update_all
●▪o/p commit: no
●oslevel -s, lppchk -v, oslevel -rl (should vary and updated)
●Post-Check’s to be done:
●oslevel -s, lppchk -v, bootinfo -b, df -m, ifconfig -a, lsvg, lsvg -o | lsvg -il
36
ETHERCHANNEL CONFIGURATION:
●It is a redundancy for network cards & switch
●Requirements: Minimum 2 network adapters and should not be configured with any IP
address (en0 &en1)
●cfgmgr
●One of the network adapter acts as primary and other adapter acts as backup.
●▪o/p ent:primary