|
|
|
|
ac – Displays connect time totals for users
Example: ac root
Outputs: total 52.80 seconds
at – Schedules jobs to run at a later date
Examples | What it does |
at 17:002) banner CALL HOME > /dev/tty0^D | At 5:00 p.m., message CALL HOME is written to terminal tty0 |
at 18:002) make -f /u/roger/makefile3) ^D | Compiles files specified in /u/roger/makefile. Results of this compilation are sent to user’s mailbox who initiated the ‘at’ request. |
at -l | List jobs in at queue.root.686858340.a Mon Oct 07 12:59:00 1991 |
at -r root.686858340.a | Removes a job from at queue.at file: root.686858340.a deleted |
basename – Returns the base file name of a string
Example: echo `basename \`pwd\“
Returns the name of the current directory your in. Does not show the full pathname of that directory.
batch – Run 1 or more jobs in the background.
All output will be sent to the mail system. Jobs submitted are started immediately.
Example:
batch
job1
job2
^D
Note: Once a batch job starts, it’s job number can’t be seen via the at -l because that job is no longer in the batch queue – it’s a running process.
Further, once a batch job is running, it can’t be canceled by the at -r <job #> command since this only cancels jobs that are still pending in the batch/at queue.
captoinfo – Converts a termcap source file to a terminfo source file
Example: captoinfo Wyse150.tc > wyse150.ti
Once the termcap file (*.tc) has been translated to a terminfo (*.ti) file, compile the .ti file with the tic compiler (tic wyse150.ti).
cmp – Compares two files for differences
Example: cmp test1 test2
If the files are identical, no message is displayed, else the first difference is displayed.
cut – Cuts out selected text from a file or environment variable
Examples | What it does |
echo `date|cut -d’ ‘ -f2` | Oct (returns the month from the date command ) |
cat /etc/passwd|cut -d: -f1,3 | Will output the 1st and 3rd field delimited by ‘:‘ from the /etc/passwd file:root:0 daemon:1 bin:2 lpd:104 |
date – Displays or sets the date/time.
Date format is: mmddHHMM.SSyy
Example: date 02030830.0054 (This sets the date/time to Feb 03 08:30:00 CST 1954)
iag – Performs hardware problem determination
- FORMAT & CERTIFY: Writes all of the ID fields and writes a bit pattern in all of the data fields. Also reassigns data blocks that are BAD during formatting. If too many BAD BLOCKS, a message is sent to alert operator. If data resides on the PV being formatted, it will be removed – lost forever.
- CERTIFY DISK Reads all ID and data fields. Checks for BAD DATA in the ID and data fields. If too many BAD BLOCKS, a message is sent to the alert operator that it’s time to get another disk drive before this one fails.
NOTE: The software defect map is written at block of the PV device. This map is 22 blocks in size (AIX 3.1 version) and has enough space to hold about 1400 defects. Hardware relocations are performed only on WRITE operations where a READ request will return an I/O error back to the requesting application.
diff – Compares text files for differences
Example: diff -wi filea fileb
-w ignores all spaces and tab characters
-i case insensitive
top of page
errclear – Deletes entries in the error log
Example: errclear 0 (Truncates the errlog to 0 bytes)
errpt – Generates an error report from entries in the error log
Examples | What it does |
errpt -a|pg | Produces a detailed report for each entry in the error log |
errpt -aN hdisk1 | Displays an error log for ALL errors occurred on this drive. If more than a few errors occur within a 24 hour period, execute the CERTIFY process under DIAGNOSTICS to determine if a PV is becoming marginal. |
/etc/lpp/disagnostics/bin/run_ela | Use this script to DETERMINE or JUSTIFY hard file REPLACEMENT. A message will be displayed on the CONSOLE device if a THRESHOLD value has been reached in regards to the number of hard file errors logged by the errpt utility. The following message may be seen: HDISKx : ERROR LOG ANALYSIS INDICATES A HARDWARE FAILURE. (x represents the hdisk number) |
fastboot – Restarts the system without checking the file systems with the fsck command
fasthalt – Halts the system
find – Finds files with matching expressions
Note: If the following error message is generated find: 0652-081 cannot change directory to </transfer/printers>: file access permissions do not allow the specified action. This means that the user you are currently logged in as (even root) doesn’t have the authority to READ that directory.
Examples | What it does |
find / -name jan92.rpt -print | Search all file systems for any file named jan92.rpt |
find / -size +1000k -exec ls -l {} \; -print | Searches all file systems to report back those files larger than 1MB in size |
find / -size 0 -print | Find all files of ZERO length |
find / -type f -exec grep bananas {} \; -print | Searches all plain files to determine if the string ‘bananas’ is contained within it |
find /usr/lpp/FINANCIALS -print | xargs chown roger.staff | Changes the ownership of all files under usr/lpp/FINANACIALS to be owned by user roger and have a group ownership of staff. |
find / -user roger -print | Find all files owned by user roger |
find / -nouser -print | Displays all unowned files in the system |
find / -group staff -print | Find all files owned by group staff |
find / -nogroup staff -print | List all files that belong to a non-existent group not found in /etc/group |
find . -perm 600 -print | xargs chmod 666 | Find all the files that have READ/WRITE permissions set for the owner of a file and change those permissions to READ/WRITE for everybody. |
find / -mtime +100 -print | Search all file systems for files that have not be modified in over 100 days. |
find . -mtime 0 -print | List all files in the current directory that have changed during the current 24 hour period. |
find / -name /transfer -prune -o -print | List the name of all files from the / (root) directory except for the NFS file system named /transfer |
find . -name PERSONAL -prune -o -print | List the name of all files in or below the current directory, except the directory named PERSONAL or files in that directory. |
find / -fstype nfs -print | List the name of all the files that reside in an NFS file system |
find . -newer disk.log -print | Display all files that have been modified more recently than the file named disk.log |
grep – Searches a file for a pattern.
Grep stands for Global Regular Expression Printer
Examples | What it does |
grep -i WhereIs * | Search all files in current directory to determine if the string ‘WhereIs’ is contained within it. The -i option ignores the case of letters (WhereIs is same as whereis) |
lsdev -C|grep lp | List all configured printers |
grep [0-9][A-Z] *.doc | List any file that has a .doc suffix that contains a number (0-9) followed by a capital letter (A-Z). |
grep [^0-5][A-Z] *.doc | List any file that has a .doc suffix that contains any number except 0 to 5 and is followed by a capital letter (A-Z) |
grep “^IBM” *.doc | Displays lines that BEGIN with the word IBM |
grep “IBM$” *.doc | Displays lines that END with the word IBM |
grep “^IBM is GREAT$” *.doc | Displays only those lines that consist of the phrase ‘IBM IS GREAT’ |
grep -v “^ *$” testfile > goodfile | Removes all the blank lines from the source file ‘testfile’ and redirects the output to a new file named ‘goodfile’. |
head – Displays the first 10 lines (default) of a file.
Example: head -25 /tmp/phase2.out (Displays the first 25 lines of the file /tmp/phase2.out.)
id – Displays the system identity of the user
Examples | What it does |
id | uid=0(root) gid=0(system) |
id -ru | Displays the UID of the current login process 0 |
last – Display information about previous logins stored in the /usr/adm/wtmp accounting file
Examples | What it does |
last reboot|head -5 | List last 5 times systems has been rebooted |
last roger | Display times user roger has logged in/out of the system |
last tty0 | Display times users have logged in/out of port tty0 |
login – Initiates a new user session.
Example: login -h rs6000 root
Login to the root account on a machine whose hostname is rs6000
logout
Terminates all processes on the port your logged in on, including your login shell. Note: exit will perform the same action as logout.
Example: logout (Logs you off the system. Login prompt will reappear.)
lsitab – List contents of the /etc/inittab file
Example: lsitab -a
lslicense – List maximum number of users that can be concurrently logged in
Example: lslicense
Outputs: Maximum number of concurrent users: >32
kill – Sends a signal to stop or suspend a process from running
Example: kill -l (Lists valid signals to use with the kill command.)
nl
Produces an output file by inserting the line number of each line of an input file at the beginning of each line
Example: nl /etc/passwd > /tmp/user.list
nice – Execute a command at a lower priority.
Super-user may run commands with a higher priority by using a negative number. Higher numbers mean lower priorities (base priority is 10)
Examples | What it does |
nice -n 15 make | Run the ‘make’ command at the low priority of 15 |
nice -10 /usr/bin/mview | Run the ‘mview’ application at a high priority of 10 |
nvdmetoa – Convert EBCDIC files to ASCII
Examples | What it does |
nvdmetoa <AS400.dat >AIXver3.dat | Converts an EBCDIC file taken off an AS400 and converts to an ASCII file for the RS/6000 |
nvdmetoa 132 <AS400.txt >AIXver3.txt | Converts an EBCDIC file with a record length of 132 characters to an ASCII file with 132 bytes per line PLUS 1 byte for the linefeed character. |
od
Dumps the contents of a file in the requested format (ASCII,octal, hex, or extended character set)
Examples | What it does |
od -c /tmp/rc.net.out | -c displays bytes as ascii characters |
1) od -cd2) \<FUNCTION KEY>3) \<SHIFT><FUNCTION KEY>
4) \<ALT><FUNCTION KEY> |
By typing in this command, one may check the control codes being generated by function keys. From the command line, you press the ‘\’ (backslash) character, then press a function key which results in the escape sequence for that key to be displayed. |
rmitab – Removes an entry from the /etc/inittab file
Example: rmitab ice (Removes the ice stanza from the /etc/inittab file)
sed – Stream edit command to change text.
Examples | What it does |
cat /tmp/mytest | sed -e “s/reports/report/” > /tmp/mytest | All instances of the string “reports” is replaced with the string “report” for the file named /tmp/mytest |
sed -e ‘s/ *$//’ < SOURCE_FILE > DESTINATION_FILE | Removes trailing blanks, not internal blanks, from each line in a file |
sed ‘/total/d’ /tmp/report > /tmp/report1 | Delete all lines that contains the word total |
sed ‘/^$/d’ /tmp/report > /tmp/report1 | Delete all blank lines from file |
sed ‘s/[ ]//g’ /ibm/report > /tmp/report | Delete all tabs from file |
shutdown – Shutdown system operations
Examples | What it does |
shutdown +0 | Shuts down a system immediately. |
shutdown -Fr | Shuts down the system cleanly, followed by rebooting the system. |
shutdown -Fm | Shuts down the system into maintenance mode. When using the ‘m’ option, make sure you are at the console, because thats where control will be returned to. |
split – Makes smaller files from a large one.
Each of the new files can be up to a specified number of lines long. The smaller files are each named with the input filename or a specified name, followed by an ‘x’ and an increasing two letter sequence (xaa, xab, etc).
stopsrc
Example: stopsrc -a
Gracefully shuts down all subsystems controlled by the SRC – System Resource Controller.
strip
Removes symbol table and other Extended Common Object File Format (XCOFF) data from an executable image.
Example: strip /usr/bin/uniplex
Reduces the storage overhead required by an executable file. This translates to less real memory usage required to have program run.
su
Runs a sub-shell with the effective user ID of the username passed in as a parameter to this command (root if no parameter is passed). Type in ‘exit’, or ‘logout’ to return to previous user’s session.
Examples | What it does |
su roger | Sets up environment as if you had logged in as user roger WITHOUT executing /etc/environment, $HOME/.profile or changing directories to $HOME for user roger. |
su – root | Initializes the user environment from attributes set in the etc/security/user database and /etc/environment file, followed by executing the $HOME/.profile and changing directories to $HOME. Basically sets up the environment as if you had logged in as root. |
sum – Displays a checksum for a file.
Often used to validate if a file has been corrupted by comparing the suspect file’s checksum to that of a known good file. Used to verify if a file has been corrupted or a file transfer was sent/received properly.
Example: sum /unix
Outputs: 13042 1253 /unix
tail – Displays the last 10 lines (default) of a file.
Example: tail /tmp/phase2.out
tee
Used to preserve intermediate outputfrom within a pipeline to a file for later processing or review
Example: find . -cpio /dev/fd0 -print | tee /tmp/BACKUP.LOG
A list of the files backed up by the cpio command will be saved by the tee utility in a file named /tmp/BACKUP.LOG
telinit
Examples | What it does |
telinit q | Forces the init process to re-read the /etc/inittab |
telinit 1 | Brings the operating system into maintenance (single-user) mode. Same as typing in init 1 |
timex
Displays the elapsed time it took for a command to execute. Real time is amount of time user waited for the process to execute. CPU time is amount of time that the process actually used the cpu.
Example: timex find /tmp -print|backup -ivqf/dev/null
tr – Translates characters in a file.
Handy for translating files from uppercase (DOS files) to lowercase (UNIX files).
Examples | What it does |
tr ‘~’ ‘\012’ </tmp/DOSFILE > /tmp/UNIXFILE | Replace the tilde as a DELIMITER character in file DOSFILE with a NEWLINE character in file UNIXFILE. |
tr -d ‘\15’ < file1 > file2 | Remove CR from file1 and creates a new file named file2 |
trace
Kernel debugging to trace the events associated with the device your are monitoring.
Examples | What it does |
traceon | turns trace on |
traceoff | turns trace off |
type – Shows path location of the specified command
Example: type basename
Outputs: basename is /usr/bin/basename
uname – Displays attributes relating to hardware/software.
Examples | What it does |
uname -a | Displays system name, operating system version, LAN network number, type of hardware running and so on. |
uname -m | XXYYYYYYMMSS (machine ID) where…
|
uname -rv | -r=release, -v=version. Results: 2 3 (Version 3 Release 2) |
uname -S `hostname` | Since the system name can be set in two places (hostname and uname -S), just set them to the same string. |
w – Lists summary of current user activity
what
Displays header information about the source files required to build the executable file your reviewing, timestamps as to when the source files where compiled, their build level, and so on.
Example:
what /unix
whatis – Displays a short description of the function a command performs
Example: whatis vmstat
Outputs: vmstat(1) – Reports virtual memory statistics.
whereis – Shows path location of the specified command
Example: whereis motd
Outputs: motd: /etc/motd
who – Displays information about all users currently on local system.
When you log in, the login program writes a record in the /etc/utmp file. This record includes your user name, date, time of login, and the login tty/pts device. The who command checks this file to find out which users are currently logged in, along with the hostname and display terminal they are logged under.
Examples | What it does |
who -b | Displays date system was last booted system boot Nov 17 13:58 |
who -r | Displays run-level of machine |
who -u | Displays information about users currently logged in. The line activity field will EITHER have…
|
who -a /usr/adm/wtmp | Displays the name, terminal, and date users logged into the system |
who -u /etc/security/failedlogin | Displays the account, terminal and date that a failed login was attempted. |
/usr/lib/acct/fwtmp < /usr/adm/wtmp > /tmp/ACCT.INFO | Creates an ASCII version of the /usr/adm/wtmp file that can be read by the system administrator |
xargs – Constructs an argument list and executes a command
Examples | What it does |
find /u/netinst -print | xargs chmod 500 | Files under /u/netinst will have permissions changed to 500 |
find /u/netinst -print | xargs chown netinst | Files under /u/netinst will have ownership changed to netinst |
find /u/netinst -print | xargs chgrp staff | Files under /u/netinst will have group changed to staff |