Translate

Friday 31 January 2014

GENERAL INFORMATION COMMANDS


smon
- monitor's system usage - F5 shows processes which are hogging the machine. Not available on AIX 4.1 and above sadly.
uptime
- shows how long the system has been up and how hard it is being hammered. The load average fields show how many jobs on average are waiting. <1 or less is very good, around 5 is pretty bad (though not unusual), >10 the machine is being seriously hammered.
who
- list users who are currently logged on (useful with option 'am i' - i.e. 'who am i' or 'whoami')
w
- list users and what they are doing, including idle time. The first line is the output from uptime
id
- similar to whoami except that it does a direct check to see who you are - who only checks /etc/utmp so any su commands will be ignored.
ps
- list processes currently running, by default on the current shell. Useful with options:
  • -t <tty> - show all processes running on a terminal
  • -ef - show all processes
  • -u <loginname> - show all processes owned by a user
  • -flp <processid> - show as much information as you can about a process number
  • -aux - show processes in order of usage of the processors. Useful to see what processes are hogging system resources.
fuser -u <filename>
- show who is using a file.(system hogging command). Useful when trying to work out who has locked a row or table in an informix database for example.
lpstat -p <printer>
- show the current status of a printer and any jobs in the queue. lpstat without arguments prints all of them.
enable <printer>
- enable a printer queue. You must be root or a member of the printq group to run this command.
disable <printer>
- disable a printer queue. You must be root or a member of the printq group to run this command.
enq <various parameters>
- examine spool queue for printers.
uname -a
- will show you what machine you're currently on.
ipcs
- list semaphores and shared memory.
ipcrm -s <semaphorenumber>
- remove semaphore or shared memory.
crontab
- use -l to list all regular scheduled jobs. To alter them, use option -e
at <now + ?? seconds/minutes/hours/days/years>
- perform a job at a specified time. (Useful for running something at a later date). at retains the current environment. e.g.
$ at now + 5 minutes
echo "Phone Julie McNally" > /dev/tty616
^D
job compjmd.389748732 will be run at ???
Will echo to tty616 the message "Phone Julie McNally" in 5 minutes. e.g.2
$ at 0331235930
echo "April fools day!" > /dev/console
^D
will echo "April fools day!" to the console at 11:59 and 30 seconds, on the 31st of march. Format for this is: [YYYY]MMDDhhmmss. at jobs are sometimes used in the place of crontab's because if the machine is off when the crontab is meant to take place, the job never happens. at jobs automatically start when the machine is switched on if the machine was down at the time. typing at -l will show you all the at jobs you have queued, at -r <atjob> will remove an at job (only the owner or root is allowed to do this).
date
- show current date and time. This command may also be used to set the system clock (ONLY WHEN EVERYONE IS LOGGED OFF) with a root user id. A date change is never simple, even when adjusting things by an hour. The safest way to do it is to change the date then reboot the machine because otherwise the crontab daemon may start doing jobs at odd times. I believe there might be a 'go slow/fast' option to set the clock, and the clock will then run 'slower/quicker' until it catches up with the required time.
last <username>
- shows a list of recent logins. It looks at /var/adm/wtmp so it only shows initial logins, and not whether those users have been su'd to.
fileplace -pv <filename>
- show the physical (as in disk location) location of a file. Useful for tracing informix files, and perhaps for working out whether defragmentation copying is required.

No comments:

Post a Comment