Unix Cmd for the DBA
How to kill all similar processes with single
command (in this case opmn)
ps -ef | grep opmn |grep -v grep | awk ‘{print $2}’ |xargs -i kill -9 {}
Locating Files under a particular directory
find . -print |grep -i
test.sql
Using AWK in UNIX
To remove a specific column of output from a
UNIX command – for example to determine the UNIX process Ids for all Oracle
processes on server (second column)
ps -ef |grep -i oracle
|awk '{ print $2 }'
Changing the standard prompt for Oracle Users
Edit the .profile for the oracle user
PS1="`hostname`*$ORACLE_SID:$PWD>"
Display top 10 CPU consumers using the
ps command
/usr/ucb/ps auxgw | head
-11
Show number of active Oracle dedicated
connection users for a particular ORACLE_SID
ps -ef | grep $ORACLE_SID|grep
-v grep|grep -v ora_|wc -l
Display the number of CPU’s in Solaris
psrinfo -v | grep
"Status of processor"|wc -l
Display the number of CPU’s in AIX
lsdev -C | grep
Process|wc -l
Display RAM Memory size on Solaris
prtconf |grep -i mem
Display RAM memory size on AIX
First determine name of memory device
lsdev -C |grep mem
then assuming the name of the memory device is
‘mem0’
lsattr -El mem0
Swap space allocation and usage
Solaris : swap -s or
swap -l
Aix : lsps -a
Total number of semaphores held by all
instances on server
ipcs -as | awk '{sum +=
$9} END {print sum}'
View allocated RAM memory segments
ipcs -pmb
Manually deallocate shared memeory segments
ipcrm -m '<ID>'
Show mount points for a disk in AIX
lspv -l hdisk13
Display amount of occupied space (in KB)
for a file or collection of files in a directory or sub-directory
du -ks * | sort -n| tail
Display total file space in a directory
du -ks .
Cleanup any unwanted trace files more
than seven days old
find . *.trc -mtime +7
-exec rm {} \;
Locate Oracle files that contain certain
strings
find . -print | xargs
grep rollback
Locate recently created UNIX files
(in the past one day)
find . -mtime -1 -print
Finding large files on the server (more
than 100MB in size)
find . -size +102400
-print
Crontab :
To submit a task every Tuesday (day 2) at 2:45PM
45 14 2 * * /opt/oracle/scripts/tr_listener.sh
> /dev/null 2>&1
To submit a task to run every 15 minutes on
weekdays (days 1-5)
15,30,45 * 1-5 * *
/opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1
To submit a task to run every hour at 15 minutes
past the hour on weekends (days 6 and 0)
15 * 0,6 * * opt/oracle/scripts/tr_listener.sh
> /dev/null 2>&1
Basic File Navigation
File Permissions
OS Users Management
Process Management
uname and hostname
Error Lines in Files
Remove Old Files
File Exists Check
Rotate Log Files
Find Big Files
Perform Action for Every File in a Directory
Perform Action for Every Line in a File
alias
Remove DOS CR/LFs (^M)
Run Commands As Oracle User From Root
Compress Files
General Performance
vmstat
free
iostat
CPU Usage
sar
mpstat
top
Hide Passwords
Automatic Startup Scripts on Linux
CRON
Cluster Wide CRON Jobs On Tru64
NFS Mount (Sun)
NFS Mount (Tru64)
Samba/CIFS Mount (Linux)
PC XStation Configuration
xauth (Magic Cookie)
Useful Profile Settings
Useful Files
Common Unix Commands:UNIX Commands for DBA
This article contains a
brief list of commands that most UNIX DBAs will need on a regular basis. Over
time I've been adding more Linux-related entries.
- Basic File Navigation
- File
Permissions
- OS
User Management
- Process
Management
- uname
and hostname
- Error
Lines in Files
- Remove
Old Files
- File
Exists Check
- Rotate
Log Files
- Find
Big Files
- Perform
Action for Every File in a Directory
- Perform
Action for Every Line in a File
- alias
- Remove
DOS CR/LFs (^M)
- Run
Commands As Oracle User From Root
- Compress
Files
- General
Performance
- vmstat
- free
- iostat
- CPU
Usage
- sar
- mpstat
- top
- Hide
Passwords
- Automatic
Startup Scripts on Linux
- CRON
- Cluster
Wide CRON Jobs On Tru64
- NFS
Mount (Sun)
- NFS
Mount (Tru64)
- Samba/CIFS
Mount (Linux)
- PC
XStation Configuration
- xauth
(Magic Cookie)
- Useful
Profile Settings
- Useful
Files
Basic File Navigation
The "pwd"
command displays the current directory.
root> pwd
/u01/app/oracle/product/9.2.0.1.0
The "ls"
command lists all files and directories in the specified directory. If no
location is defined it acts on the current directory.
root> ls
root> ls /u01
root> ls -al
The "-a" flag
lists hidden "." files. The "-l" flag lists file details.
The "cd" command
is used to change directories.
root> cd /u01/app/oracle
The "touch"
command is used to create a new empty file with the default permissions.
root> touch my.log
The "rm"
command is used to delete files and directories.
root> rm my.log
root> rm -R /archive
The "-R" flag
tells the command to recurse through subdirectories.
The "mv"
command is used to move or rename files and directories.
root> mv [from] [to]
root> mv my.log my1.log
root> mv * /archive
root> mv /archive/* .
The "."
represents the current directory.
The "cp"
command is used to copy files and directories.
root> cp [from] [to]
root> cp my.log my1.log
root> cp * /archive
root> cp /archive/* .
The "mkdir"
command is used to create new directories.
root> mkdir archive
The "rmdir"
command is used to delete directories.
root> rmdir archive
The "find"
command can be used to find the location of specific files.
root> find / -name dbmspool.sql
root> find / -print | grep -i dbmspool.sql
The "/" flag
represents the staring directory for the search. Wildcards such as
"dbms*" can be used for the filename.
The "which"
command can be used to find the location of an executable you are using.
oracle> which sqlplus
The "which"
command searches your PATH setting for occurrences of the specified executable.
File Permissions
See Linux Files, Directories and
Permissions.
The "umask"
command can be used to read or set default file permissions for the current
user.
root> umask 022
The umask value is
subtracted from the default permissions (666) to give the final permission.
666 : Default permission
022 : - umask value
644 : final permission
The "chmod"
command is used to alter file permissions after the file has been created.
root> chmod 777 *.log
Owner Group World Permission
========= ========= ========= ======================
7 (u+rwx) 7 (g+rwx) 7 (o+rwx) read + write + execute
6 (u+rw) 6 (g+rw) 6 (o+rw) read + write
5 (u+rx) 5 (g+rx) 5 (o+rx) read + execute
4 (u+r) 4 (g+r) 4 (o+r) read only
2 (u+w) 2 (g+w) 2 (o+w) write only
1 (u+x) 1 (g+x) 1 (o+x) execute only
Character eqivalents can
be used in the chmod command.
root> chmod o+rwx *.log
root> chmod g+r *.log
root> chmod -Rx *.log
The "chown"
command is used to reset the ownership of files after creation.
root> chown -R oinstall.dba *
The "-R" flag
causes the command ro recurse through any subdirectories.
OS Users Management
See Linux Groups and Users.
The "useradd"
command is used to add OS users.
root> useradd -G oinstall -g dba -d /usr/users/my_user -m -s /bin/ksh my_user
- The
"-G" flag specifies the primary group.
- The
"-g" flag specifies the secondary group.
- The
"-d" flag specifies the default directory.
- The
"-m" flag creates the default directory.
- The
"-s" flag specifies the default shell.
The "usermod"
command is used to modify the user settings after a user has been created.
root> usermod -s /bin/csh my_user
The "userdel"
command is used to delete existing users.
root> userdel -r my_user
The "-r" flag
removes the default directory.
The "passwd"
command is used to set, or reset, the users login password.
root> passwd my_user
The "who"
command can be used to list all users who have OS connections.
root> who
root> who | head -5
root> who | tail -5
root> who | grep -i ora
root> who | wc -l
- The
"head -5" command restricts the output to the first 5 lines of
the who command.
- The
"tail -5" command restricts the output to the last 5 lines of
the who command.
- The
"grep -i ora" command restricts the output to lines containing
"ora".
- The
"wc -l" command returns the number of lines from
"who", and hence the number of connected users.
Process Management
See Linux Process
Management (ps, top, renice, kill).
The "ps"
command lists current process information.
# ps
# ps -ef | grep -i ora
# ps -ef | grep -i ora | grep -v grep
# ps -ef | grep -i [o]ra
Specific processes can
be killed by specifying the process id in the kill command.
# kill 12345
# kill -9 12345
You can kill multiple
processes using a single command by combining "kill" with the
"ps" and "awk" commands.
# kill -9 `ps -ef | grep ora | awk '{print $2}'`
uname and hostname
The "uname"
and "hostname" commands can be used to get information about the
host.
root> uname -a
OSF1 oradb01.lynx.co.uk V5.1 2650 alpha
root> uname -a | awk '{ print $2 }'
oradb01.lynx.co.uk
root> hostname
oradb01.lynx.co.uk
Error Lines in Files
You can return the error
lines in a file using.
root> cat alert_LIN1.log | grep -i ORA-
The "grep -i
ORA-" command limits the output to lines containing "ORA-". The
"-i" flag makes the comparison case insensitive. A count of the error
lines can be returned using the "wc" command. This normally give a word
count, but the "-l" flag alteres it to give a line count.
root> cat alert_LIN1.log | grep -i ORA- | wc -l
Remove Old Files
The
find
command can be used to supply a list of files to the rm
command or the "-delete" command can be used directly.find /backup/logs/ -name daily_backup* -mtime +21 -exec rm -f {} ;
find /backup/logs/daily_backup* -mtime +5 -exec rm -f {} \;
find /backup/logs/daily_backup* -mtime +5 -delete;
File Exists Check
The Bash shell allows
you to check for the presence of a file using the "[ -e filepath ]"
comparison. In the following script a backup log is renamed if it is present
and files older than 30 days are deleted are deleted.
#!/bin/bash
if [ -e /tmp/backup.log ]; then
DATE_SUFFIX=`date +"%Y"-"%m"-"%d"`
mv /tmp/backup.log /tmp/backup-$DATE_SUFFIX.log
fi
# Delete old log files.
find /tmp/backup*.log -mtime +30 -delete;
This is one example of a
log rotation, where the most current log doesn't include the date in it's name.
Rotate Log Files
See the previous section
for another variant on log rotation.
The following script
provides an example of how to manage a log rotation using the Bash shell. The
log file includes the date in the file name. Files older than 30 days are
deleted.
#!/bin/bash
DATE_SUFFIX=`date +"%Y"-"%m"-"%d"`
LOG_FILE=/tmp/backup-$DATE_SUFFIX.log
# Do something that needs logging.
echo "Send this to log" >> $LOG_FILE 2>&1
# Delete old log files.
find /tmp/backup*.log -mtime +30 -delete;
Find Big Files
Find the top 20 biggest
files recursively from this directory.
$ find . -type f -print0 | xargs -0 du -h | sort -hr | head -20
Perform Action for Every File in a Directory
The following scripts
shows two methods for performing an action for each file in a directory.
#!/bin/bash
for FILE in `ls /tmp/`; do
# Do something with the file name.
echo $FILE;
done
# Or this.
for FILE in $( ls /tmp/ ); do
echo $FILE
done
Perform Action for Every Line in a File
The following scripts
shows a method for performing an action for each line in a file.
#!/bin/bash
while read LINE; do
# Do something with the line.
echo $LINE;
done < /tmp/myfile.txt
alias
An alias is a named
shortcut for a longer command using the following format.
alias name='command'
For example, if you
require sudo access for a specific command, you might want to include this as
an alias so you don't have to remember to type it.
alias myscript='sudo -u oracle /path/to/myscript'
Remove DOS CR/LFs (^M)
Remove DOS style CR/LF
characters (^M) from UNIX files using.
sed -e 's/^M$//' filename > tempfile
The newly created
tempfile should have the ^M character removed.
Where available, it is
probably better to use the
dos2unix
and unix2dos
commands.
Run Commands As Oracle User From Root
The following scripts
shows how a number of commands can be run as the "oracle" user the
"root" user.
#!/bin/ksh
su - oracle <<EOF
ORACLE_SID=LIN1; export ORACLE_SID
rman catalog=rman/rman@w2k1 target=/ cmdfile=my_cmdfile log=my_logfile append
EOF
This is often necessary
where CRON jobs are run from the root user rather than the oracle user.
Compress Files
See Linux Archive Tools (tar, star, gzip,
bzip2, zip, cpio).
In order to save space
on the filesystem you may wish to compress files such as archived redo logs.
This can be using either the
gzip
or the compress
commands. The gzip
command results in a
compressed copy of the original file with a ".gz" extension. The gunzip
command reverses this process.gzip myfile
gunzip myfile.gz
The
compress
command results in a compressed copy of the original file with a ".Z" extension. The uncompress
command reverses this process.compress myfile
uncompress myfile
General Performance
vmstat
Reports virtual memory
statistics.
# vmstat 5 3
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 1060608 24372 739080 0 0 1334 63 1018 1571 14 11 66 10 0
0 0 0 995244 24392 799656 0 0 6302 160 1221 1962 10 10 62 18 0
0 0 0 992376 24400 799784 0 0 1 28 992 1886 3 2 95 0 0
#
See the vmstat man page.
free
Reports the current
memory usage. The "-/+ buffers/cache:" line represents the true used
and free memory, ignoring the Linux file system cache.
# free
total used free shared buffers cached
Mem: 8178884 4669760 3509124 0 324056 1717756
-/+ buffers/cache: 2627948 5550936
Swap: 10289148 0 10289148
#
iostat
Reports I/O statistics.
# iostat
Linux 3.2.10-3.fc16.x86_64 (maggie.localdomain) 03/19/2012 _x86_64_(4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
2.02 0.23 0.51 0.78 0.00 96.46
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 9.23 100.55 62.99 1796672 1125538
dm-0 13.60 100.31 62.99 1792386 1125524
dm-1 0.02 0.08 0.00 1432 0
#
CPU Usage
See Linux Process Management (ps, top,
renice, kill).
sar
On Linux systems sar (System
Activity Reporter) is probably one of the simplest and most versatile tools for
reporting system utilization including CPU, memory, disk and network activity.
It automatically collects system activity statistics when installed using the
following command.
# yum install sysstat
The
sar
command syntax takes the following form.# sar [options] [interval [count]]
The "options"
parameters determine what is reported, which will be discussed later. The
"interval" parameter indicates the time interval in seconds between
samples. The "count" parameter indicates the number of samples that
will be taken before the command ends. If "count" is omitted, the
sampling will continue indefinitely. If both "interval" and
"count" are omitted, the command will report the values from the 10
minute samples taken since the machine was last restarted.
As seen in the sar man page, there are lots of
available options, but some starting points you may find interesting include:
- CPU:
- Basic
CPU: sar [-u] [interval [count]]
- Load
Average: sar -q [interval [count]]
- Memory:
- Kernel
Paging: sar -B [interval [count]]
- Unused
Memory: sar -r [interval [count]]
- Swap
Space: sar -S [interval [count]]
- Disk:
- Average
Disk I/O: sar -b [interval [count]]
- Disk
I/O: sar -dp [interval [count]]
- Network:
- Network:
sar -n DEV [interval [count]]
- Network
Errors: sar -n EDEV [interval [count]]
Here is an example of
the output from a CPU report.
# sar -u 1 5
Linux 2.6.32-100.0.19.el5 (ol5-112.localdomain) 06/27/2011
03:10:07 PM CPU %user %nice %system %iowait %steal %idle
03:10:08 PM all 0.00 1.01 23.23 75.76 0.00 0.00
03:10:09 PM all 0.00 1.02 35.71 63.27 0.00 0.00
03:10:10 PM all 0.98 3.92 35.29 59.80 0.00 0.00
03:10:11 PM all 0.00 1.03 29.90 69.07 0.00 0.00
03:10:12 PM all 0.00 2.00 35.00 63.00 0.00 0.00
Average: all 0.20 1.81 31.85 66.13 0.00 0.00
#
mpstat
Reports processor
related statistics.
# mpstat 10 2
Linux 2.6.32-100.0.19.el5 (ol5-112.localdomain) 06/27/2011
01:59:57 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
02:00:07 PM all 1.21 0.00 0.90 0.20 0.00 0.00 0.00 97.69 980.50
02:00:17 PM all 0.70 0.00 0.40 0.00 0.00 0.10 0.00 98.79 973.77
Average: all 0.95 0.00 0.65 0.10 0.00 0.05 0.00 98.24 977.14
#
See the mpstat man page.
top
Displays top tasks.
# top
top - 13:58:17 up 2 min, 1 user, load average: 2.54, 1.11, 0.41
Tasks: 160 total, 6 running, 154 sleeping, 0 stopped, 0 zombie
Cpu(s): 77.1%us, 22.6%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.3%hi, 0.0%si, 0.0%st
Mem: 2058872k total, 879072k used, 1179800k free, 23580k buffers
Swap: 4095992k total, 0k used, 4095992k free, 620116k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2882 oracle 20 0 610m 64m 56m R 24.9 3.2 0:02.20 oracle
2927 root 20 0 90328 3832 2604 R 24.6 0.2 0:00.89 Xorg
2931 oracle 20 0 605m 34m 31m R 11.5 1.7 0:00.35 oracle
2933 oracle 20 0 605m 34m 30m S 9.8 1.7 0:00.30 oracle
2888 oracle 20 0 614m 52m 40m S 6.9 2.6 0:00.78 oracle
2935 oracle 20 0 604m 22m 20m S 6.2 1.1 0:00.19 oracle
2937 oracle 20 0 604m 19m 17m R 4.6 1.0 0:00.14 oracle
2688 oracle -2 0 603m 15m 13m S 4.3 0.8 0:01.08 oracle
2685 oracle 20 0 603m 15m 13m S 0.7 0.8 0:00.22 oracle
2939 oracle 20 0 217m 4084 3504 R 0.7 0.2 0:00.02 oracle
2698 oracle 20 0 604m 18m 16m S 0.3 0.9 0:00.17 oracle
2702 oracle 20 0 609m 22m 14m S 0.3 1.1 0:00.17 oracle
2704 oracle 20 0 618m 21m 19m S 0.3 1.1 0:00.21 oracle
2714 oracle 20 0 603m 20m 18m S 0.3 1.0 0:00.18 oracle
1 root 20 0 10364 704 588 S 0.0 0.0 0:00.36 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
6 root 20 0 0 0 0 S 0.0 0.0 0:00.03 events/0
7 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuset
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 netns
#
The PID column can then be matched with the SPID column on the V$PROCESS view to
provide more information on the process.
SELECT a.username,
a.osuser,
a.program,
spid,
sid,
a.serial#
FROM v$session a,
v$process b
WHERE a.paddr = b.addr
AND spid = '&pid';
See the top man page.
Hide Passwords
You may be required to
use passwords in scripts calling Oracle tools, like SQL*Plus, Export/Import and
RMAN etc. One method to remove the credentials from the script itself is to
create a credentials file to hold them. In this case I'm using "/home/oracle/.scottcred",
which contains the following.
scott/tiger
Change the permissions
to make sure the file is only visible to the owner.
$ chmod 600 /home/oracle/.scottcred
Now replace references
to the credentials with the contents of the file.
$ expdp < /home/oracle/.scottcred schemas=SCOTT directory=DATA_PUMP_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
Alternatively,
consider using one of the following:
- Secure
External Password Store
- OS
Authentication
Automatic Startup Scripts on Linux
CRON
See CRON : Scheduling Tasks on Linux.
There are two methods of
editing the crontab file. First you can use the "crontab -l >
filename" option to list the contents and pipe this to a file. Once you've
editied the file you can then apply it using the "crontab filename".
- Login
as root
- crontab
-l > newcron
- Edit
newcron file.
- crontab
newcron
Alternatively you can
use the "crontab -e" option to edit the crontab file directly.
The entries have the
following elements.
field allowed values
----- --------------
minute 0-59
hour 0-23
day of month 1-31
month 1-12
day of week 0-7 (both 0 and 7 are Sunday)
user Valid OS user
command Valid command or script.
The first 5 fields can
be specified using the following rules.
* - All available values or "first-last".
3-4 - A single range representing each possible from the start to the end of the range inclusive.
1,2,5,6 - A specific list of values.
1-3,5-8 - A specific list of ranges.
0-23/2 - Every other value in the specified range.
The following entry runs
a cleanup script a 01:00 each Sunday. Any output or errors from the script are
piped to /dev/null to prevent a buildup of mails to root.
0 1 * * 0 /u01/app/oracle/dba/weekly_cleanup > /dev/null 2>&1
Cluster Wide CRON Jobs On Tru64
On clustered systems
cron is node-specific. If you need a job to fire once per cluster, rather than
once per node you need an alternative approach to the standard cron job. One
approach is put forward in the HP best practices document (Using cron in a
TruCluster Server Cluster), but in my opinion a more elegant
solution is proposed by Jason Orendorf of HP Tru64 Unix Enterprise Team (TruCluster
Clustercron).
In his solution Jason
creates a file called /bin/cronrun with the following contents.
#!/bin/ksh
set -- $(/usr/sbin/cfsmgr -F raw /)
shift 12
[[ "$1" = "$(/bin/hostname -s)" ]] && exit 0
exit 1
This script returns TRUE
(0) only on the node which is the CFS serving cluster_root.
All cluster wide jobs
should have a crontab entry on each node of the cluster like.
5 * * * /bin/cronrun && /usr/local/bin/myjob
Although the cron jobs
fire on all nodes, the "/bin/cronrun &&" part of the entry
prevents the script from running on all nodes except the current CFS serving
cluster_root.
NFS Mount (Sun)
The following deamons
must be running for the share to be seen by a PC.
- /usr/lib/nfs/nfsd
-a
- /usr/lib/nfs/mountd
- /opt/SUNWpcnfs/sbin/rpc.pcnfsd
To see a list of the nfs
mounted drives already present type.
exportfs
First the mount point
must be shared so it can be seen by remote machines.
share -F nfs -o ro /cdrom
Next the share can be
mounted on a remote machine by root using.
mkdir /cdrom#1
mount -o ro myhost:/cdrom /cdrom#1
NFS Mount (Tru64)
On the server machine,
if NFS is not currently setup do the following.
- Application
Manager -> System Admin -> Configuration -> NFS
- Select
the "Configure system as an NFS server" option.
- Accept
all defaults.
Create mount point
directory.
mkdir /u04/backup
Append the following
entry to the "/etc/exports" file.
/u04/backup
Make sure the correct
permissions are granted on the directory.
chmod -R 777 /u04/backup
On the client machine,
if NFS is not currently setup do the following.
- Application
Manager -> System Admin -> Configuration -> NFS
- Select
the "Configure system as an NFS client" option.
- Accept
all defaults.
Create mount point
directory.
mkdir /backup
Append an following
entry to the "/etc/fstab" file.
nfs-server-name:/u04/backup /backup nfs rw,bg,intr 0 0
Finally, mount the
fileset.
mount /backup
At this point you can
start to use the mount point from your client machine. Thanks to Bryan Mills
for his help with Tru64.
Samba/CIFS Mount (Linux)
See Linux Samba Configuration.
Create a directory to
use for the mount point.
# mkdir /host
Add the following line
to the "/etc/fstab" file.
//192.168.0.4/public /host cifs rw,credentials=/root/.smbcred,uid=500,guid=500 0 0
Create a file called
"/root/.smbcred" with the following contents.
username=myuser
password=mypassword
Change the permissions
on the credentials file.
# chmod 600 /root/.smbcred
Mount the share.
# mount /host
PC XStation Configuration
Download the CygWin
setup.exe from http://www.cygwin.com.
Install, making sure to
select all the X11R6 (or XFree86 in older versions) optional packages.
If you need root access
add the following entry into the /etc/securettys file on each server.
<client-name>:0
From the command promot
on the PC do the following.
set PATH=PATH;c:cygwinbin;c:cygwinusrX11R6bin
XWin.exe :0 -query <server-name>
The X environment should
start in a new window.
Many Linux distributions
do not start XDMCP by default. To allow XDMCP access from Cygwin edit the
"/etc/X11/gdm/gdm.conf" file. Under the "[xdmcp]" section
set "Enable=true".
If you are starting any
X applications during the session you will need to set the DISPLAY environment
variable. Remember, you are acting as an XStation, not the server itself, so
this variable must be set as follows.
DISPLAY=<client-name>:0.0; export DISPLAY
xauth (Magic Cookie)
Access to X servers can
get broken when using
su
and sudo
commands. The xauth
command provides a solution to this. The process involves the
following stages:- Check
your current display number.
- Use
xauth list
to get a list of magic cookies. - Switch
to the new user.
- Use
xauth add
to set the magic cookie for your display number.
An example of this is
shown below.
$ echo $DISPLAY
localhost:12.0
$ xauth list
ol6.localdomain/unix:12 MIT-MAGIC-COOKIE-1 be64852468ca3c334720b10bb3c4d3cb
$ sudo su oracle
$ xauth add ol6.localdomain/unix:12 MIT-MAGIC-COOKIE-1 be64852468ca3c334720b10bb3c4d3cb
You will now be able to
access the X server, just as you could before the user switch.
Useful Profile Settings
See Linux Groups and Users : Important
Files.
The following
".profile" settings rely on the default shell for the user being set
to the Korn shell (/bin/ksh).
The backspace key can be
configured by adding the following entry.
stty erase "^H"
The command line history
can be accessed using the [Esc][k] by adding the following entry.
set -o vi
Auto completion of paths
using a double strike of the [Esc] key can be configured by adding the
following entry.
set filec
Useful Files
Here are some files that
may be of use.
Path
|
Contents
|
/etc/passwd
|
User settings
|
/etc/group
|
Group settings for users.
|
/etc/hosts
|
Hostname lookup information.
|
/etc/system
|
Kernel parameters for Solaris.
|
/etc/sysconfigtab
|
Kernel parameters for Tru64.
|
/etc/sysctl.conf
|
Kernel parameters for Linux.
|
Sysinfo | Display system information i.e cpu, memory, etc |
Memory and Swap | Information regarding the physical memory and swap area |
Disks, Filesystems and Devices | Displaying disk information, filesystems |
Networking | Display and configuring network parameters |
Crash Dump | Configure, display and use the crash dump utiltities |
Performance Monitoring and Diagnostics | List, Monitor and trace processes |
Kernel Modules and Parameters | Displaying, modifying and tuning kernel parameters |
Services | Display, start and stop services |
Patching / Packages | Installing and removing patches and software packages |
Accounts | Setting up and removing user accounts |
NFS | Information on NFS i.e starting, stopping, etc |
NTP | Network Time Protocol |
Log Files | Location to common log files |
Security | Security information |
Misc | Other stuff i.e shutdown, timezone, run level, etc |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP-UX
|
AIX
| ||
Server Release info | cat /etc/release | cat /etc/enterprise-release cat /etc/redhat-release lsb_release -acat /proc/version | cat /etc/lsb-release lsb_release -a | /stand/kernrel | oslevel -r | Server Release info |
Server type | /usr/platform/`uname -i`/sbin/prtdiag -v | dmidecode | dmidecode | model uname -a | prtconf | grep -i 'System Model' | Server type |
Hardware Info | prtdiag -v prtconf -D prtpicl -v [-c <class>] picl = platform information and control library | lspci lsusb lshal Note: hal = hardware abstraction layer | lspci lsusb lshal | ioscan ioscan -fun [disk|tape|lan] /opt/ignite/bin/print_manifest cat /var/opt/ignite/local/manifest/manifest.info | lscfg -v lscfg -l ent0 lscfg -vl fcs0 (find the WWN of HBA adapter) lsdev lsdev -Cc disk lsdev -Cc disk -p scsi0 lsslot -c [pci|phb|port] lsslot -c pci -l ent0 lspath -l hdisk0 diag | Hardware Info |
Operating System | uname -a | uname -a | uname -a | uname -a | oslevel [-r|-s] | Operating System |
Memory | /usr/platform/`uname -i`/sbin/prtdiag -v prtconf | grep -i mem | cat /proc/meminfo (detailed) free -om cat /proc/slabinfo | cat /proc/meminfo (detailed) free -om cat /proc/slabinfo | dmesg | grep -i physical /usr/sam/lbin/getmem /opt/ignite/bin/print_manifest cat /var/opt/ignite/local/manifest/manifest.info | prtconf -m prtconf |grep -i memory lsattr -El sys0 -a realmem bootinfo -r | Memory |
CPU (type, number, etc) | /usr/platform/`uname -i`/sbin/prtdiag -v ## display,offline,online psrinfo psradm -f 0 (offline) psradm -n 0 (online) | cat /proc/cpuinfo (detailed) | cat /proc/cpuinfo (detailed) | /opt/ignite/bin/print_manifest sam -> performance monitors -> system properties cat /var/opt/ignite/local/manifest/manifest.info | prtconf |grep -i processor | CPU (type, number, etc) |
Disk Drives | format prtvtoc <device> format -e (to convert EFI (zfs) to SMI) Note: EFI - Extensible Firmware Interface SMI - Sun Microsystems Inc | fdisk -l sfdisk -l (advanced server) parted <device> print partprobe -s <device> smartctl -a <device> | fdisk -l sfdisk -l (advanced server) parted <device> print partprobe <device> | ioscan -funC disk | lsdev -Cc disk lsdev -Cc disk -p scsi0 (specific controller) lsdev -Cc disk -S [a|d|s] (available, defined, stopped) lscfg -v -l hdisk0 | Disk Drives |
Kernel File and associated directories | /kernel/genunix /platform/`uname -m`/kernel /platform/i86pc/kernel /kernel /usr/kernel | /boot/initrd.?????.img /boot/vmlinuz | /boot/initrd.img-?????-server /boot/vmlinuz-????-server | /stand/vmunix | /unix /usr/lib/boot /usr/lib/drivers Note: /unix - symbolic link to kernel file i.e /usr/lib/boot/unix_64 | Kernel File |
Kernel 32 or 64 | isainfo -kv (solaris 9+) isalist (sparc v9 will be listed first) isainfo -b | uname -a uname -m getconf -a |grep -i 'long_bit' cat /proc/version | uname -a uname -m getconf -a |grep -i 'long_bit' | getconf KERNEL_BITS ( version 11) /opt/ignite/bin/print_manifest |grep -i 'os mode' HPUX < version 11 all 32 bit Note: determine if system supports 64 bit getconf HW_CPU_SUPP_BITS /opt/ignite/bin/print_manifest |grep -i 'hw capability' | prtconf -k bootinfo -K | Kernel 32 or 64 |
Display Firmware | At the OK prompt type banner | boot into the BIOS (normally F2 or F12) | boot into the BIOS (normally F2 or F12) | workstations: reboot enter PDC type: IN (information menu) type: FV (Firmware Version) | prtconf |grep -i firmware lscfg -pv invscout | Display Firmware |
Display IRQ, IO ports and DMA | n/a | /proc/interrupts /proc/ioports /proc/dma | /proc/interrupts /proc/ioports /proc/dma | n/a | prtconf | Display IRQ, IO ports and DMA |
GUI admin tool | admintool | linuxconf | linuxconf | sam | smit smitty | GUI admin tool |
Memory and Swap
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
Memory | /usr/platform/`uname -i`/sbin/prtdiag -v prtconf | grep -i mem | cat /proc/meminfo (detailed) free -om | cat /proc/meminfo (detailed) free -om | dmesg | grep -i physical /usr/sam/lbin/getmem /opt/ignite/bin/print_manifest cat /var/opt/ignite/local/manifest/manifest.info | prtconf -m prtconf |grep -i memory lsattr -El sys0 -a realmem bootinfo -r | Memory |
page size (memory) | /usr/bin/pagesize | /usr/bin/getconf -a| egrep -i 'pagesize|page_size' | /usr/bin/getconf -a| egrep -i 'pagesize|page_size' | dmesg |grep -i physical | pagesize pagesize -a (display all supported pagesizes) | page size (memory) |
display swap | swap -l swap -s | cat /proc/swaps (detailed) swapon -s | cat /proc/swaps (detailed) swapon -s | swapinfo (displayed in KB) swapinfo -m (display in Mb) swapinfo -tm (total / Mb) | lsps -a (detailed) lsps -s | display swap |
adding swap | mkfile 5m /var/swapfile swap -a /var/swapfile update /etc/vfstab | device: create partition with fdisk (type 82) file(create 50MB swap file): dd if=/dev/zero of=/var/swapfile bs=1024 count=50000 mkswap <device>|<file> swapon <device>|<file> update /etc/fstab | device: create partition with fdisk (type 82) file(create 50MB swap file): dd if=/dev/zero of=/var/swapfile bs=1024 count=50000 mkswap <device>|<file> swapon <device>|<file> update /etc/fstab | Create logical volume or filesystem swapon <device> | -f <logical device> swapon -p 3 <device> | -f <logical device> update /etc/fstab Note: -p = priority swap number . The nswapdevtunable system parameter controls the maximum number of swap devices. | mkps -a -s 4 -n <volume group> # change the attributes chps -a n paging00 (don't use after restart) # change the logical volume attributes (name in this case) chlv -n <new name> <old old> (chang page space name) Note: -a reconfigure paging space after restart -s size of the page space (logical partitions) -n activiates the paging space (use swapoff to deactivate) also see /etc/swapspaces file | adding swap |
removing swap | update /etc/vfstab swap -d | swapoff <device>|<file> Remove device or file as normal | swapoff <device>|<file> Remove device or file as normal | remove entry from /etc/fstab reboot | swapoff /dev/paging00 rmps paging00 Note: paging space must be deactiviated before removing | removing swap |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
Disk Drives | format prtvtoc <device> cfgadm -al fcinfo hba-port luxadm probe mpathadm list initiator-port mpathadm show <initiator-port name> iscsiadm list initiator-node iscsiadm list discovery format -e (to convert EFI (zfs) to SMI) Note: EFI - Extensible Firmware Interface SMI - Sun Microsystems Inc | fdisk -l sfdisk -l (advanced server) parted <device> print partprobe <device> udevadm info -q all -n /dev/sda1 blkid dmsetup [ls|info] | fdisk -l sfdisk -l (advanced server) parted <device> print partprobe <device> | ioscan -funC disk | lsdev -Cc disk lsdev -Cc disk -p scsi0 (specific controller) lsdev -Cc disk -S [a|d|s] (available, defined,stopped) lscfg -v -l hdisk0 | Disk Drives |
Disk serial Number, type, etc | format iostat -En luxadm inq <disk> (A5x00 disk arrays) | hdparm -i /dev/hda hdparm -I /dev/hda (detailed) hdparm -Tt /dev/hda (speed test) sdparm -i /dev/sdb cat /proc/ide/ide0/hda/model cat /proc/scsi/scsi | hdparm -i /dev/hda hdparm -I /dev/hda (detailed) haparm -Tt /dev/hda (speed test) sdparm -i /dev/sdb cat /proc/ide/ide0/hda/model cat /proc/scsi/scsi | diskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial number) /opt/ignite/bin/print_manifest (no serial number) ## Insure that the online diagnostic support tools have been installed swlist -l bundle | grep 'Support Tools' ## Command-Line Support Tools Manager (cstm) ## The run cstm cstm cstm> map cstm> sel dev 4 (select the disk of you choice) cstm> info cstm> il (obtain the serial number) cstm> quit | lscfg -vl hdisk0 lscfg -vl hdisk* | Disk serial Number, type, etc |
Disk disk partitions | prtvtoc <device> cat /etc/vfstab | fdisk -l sfdisk -l (advanced server) cat /proc/partitions (very high level) cat /etc/fstab | fdisk -l sfdisk -l (advanced server) cat /proc/partitions (very high level) cat /etc/fstab | lvlnboot -v /dev/vg00 lifls -Clv <device> # Display the LIF contents lifcp /dev/dsk/c0t6d0:AUTO - cat /etc/fstab Note: Boot programs are stored in the boot area in Logical Interchange Format (LIF), which is similar to a file system. For a device to be bootable, the LIF volume on that device must contain at least the ISL (the initial system loader) and HPUX (the HP-UX bootstrap utility) LIF files. ISL is like GRUB. | lsvg -l rootvg lchangelv cat /etc/filesystems | Disk disk partitions |
List Raw Partitions | use format to partition the disk then just use the slice as a raw partition, remember to use the character device | ## Old way /etc/sysconfig/rawdevices service rawdevices start chkconfig rawdevices on ## New way, Edit below file /etc/udev/rules.d/60-raw.rules udevinfo -d or udevadm info ## Display raw partitions raw -qa | mknod /dev/rawctl c 162 0 mknod /dev/raw/raw0 c 162 1 mknod /dev/raw/raw1 c 162 2 ln -s /dev/rawctl /dev/raw/rawctl ## map raw devices to the disk raw /dev/raw/raw1 /dev/sdb1 ## display raw devices raw -qa | Just create a new LVOL without a filesystem - that's it. | Just create a new LVOL without a filesystem # create a raw volume mklv -y rawVolume vg01 10 | List Raw Partitions |
Bad Blocks | format (use analyse ) | badblocks | badblocks | dd if=/dev/rdsk/cXtYd0 of=/dev/null bs=1024K Note: no errors means disk is good | chlv -b [y|n] <lv> Note: enables bad block relocation | |
Filesystem commands | df -k df -h | df -k df -h | df -k df -h | bdf df [-egiklnvfb] | df -k lsfs [<filesystem>] lsfs -q <filesystem> (detailed) | Filesystem commands |
Filesystem (create|remove) | newfs -v <raw device> # Display how the filesystem was created newfs -Nv <filesystem> | mkfs -t ext3 /dev/sdb1 mke2fs -t ext4 /dev/sdb1 # all point to mke2fs mkfs.ext2 mkfs.ext3 mkfs.ext4 cat /etc/mke2fs.conf | mkfs -t ext3 /dev/sdb1 | newfs -F vxfs -o largefiles /dev/vg01/rlvol1 mkfs -F vxfs -o largefiles /dev/vg01/rlvol1 Note: mkfs and newfs are a pointer to /sbin/fs_wrapper | crfs -v jfs2 -d data02lv -m /data02 -A yes -v filesystem type -d device or logical volume -m mountpoint -A mount after restart [yes|no] rmfs -ri /data02 -r remove the mountpoint -i display warning before removing chfs -a size=+1G /var (grow by additional 1GB) chfs -a size=1G /var (grow to 1GB in size) | Filesystem (create|remove|resize) |
Tune Filesystems | tunefs fstyp -v <device> |grep -i minfree | tune2fs tune2fs -l /dev/sda1 # change reserved blocks percentage to 1% tune2fs -m 1 /dev/sda1 | tune2fs tune2fs -l /dev/sda1 # change reserved blocks percentage to 1% tune2fs -m 1 /dev/sda1 | tunefs -v <filesystem> vxtunefs -v <filesystem> fstyp -v <filesystem> # Disk fragmentation fsadm -F vxfs -E / (report) fsadm -F vxfs -e / (defrag) | chfs Note: you can perform the following resize freeze change mountpoint permissions lots more.............................. | Tune Filesystems |
Force fsck | # Check to see filesystem needs checking fstyp -v <filesystem> | grep fsclean | touch /forcefsck shutdown -Fr now fsck.mode=force (kernel parameter) tune2fs -l /dev/sdb<?> |grep -i 'filesystem state' | touch /forcefsck shutdown -r now tune2fs -l /dev/sdb<?> |grep -i 'filesystem state' # edit /etc/default/rcS change below so # you dont have to hang around FSCKFIX=yes | # Look at the second line to see if a filesystem # needs checking tunefs -v <filesystem> | n/a | Force fsck |
backup filesystem | ufsdump|ufsrestore tar dd cpio | dump/restore tar dd cpio | dump/restore tar dd cpio | fbackup/frecover dump/restore ftio tar dd cpio | backup|restore tar dd cpio | backup filesystem |
Display the boot device | eeprom |grep boot-device prtconf -pv |grep bootpath prtpicl -v|grep ':bootpath' | cat /boot/grub/grub.conf cat /etc/lilo.conf grub = grand unified boot loader lilo = linux loader | cat /boot/grub/menu.lst | setboot | bootinfo -b (display last boot device) bootlist -m [normal|service] -o (display bootable devices) | Display the boot device |
Setting the boot device | setenv boot-device [<device>|<alias>] eeprom boot-device [<device>|<alias>] | /boot/grub/grub.conf /etc/lilo.conf | /boot/grub/menu.lst | setboot -p <primary path> setboot -a <alternate path> # autoboot sequnce setboot -b [on|off] | bootlist -m normal hdisk0 hdisk1 | Setting the boot device |
Creating boot device (MBR) | installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk <raw-device> | grub-install <raw-device> lilo -v | grub-install <raw-device> | mkboot -l <device> Note: we are treating the disk as a LVM device | bosboot -a (uses default device) bosboot -ad hdisk1 | Creating boot device (MBR) |
Format floppy drive | fdformat -v -U volcheck -v newfs -v /vol/disk/aliases/floppy0 | floppy --probe (use device obtained below ) floppy --createrc > /etc/fd0 floppy --format /dev/fd0 mkfs /dev/fd0 | n/a | n/a | format -d /dev/rfd0 format -d /dev/fd0.18 (high format) | Format floppy drive |
mount/unmount floppy | volrmmount -l floppy0 eject floppy | mount /dev/fd0 /mnt/floppy umount /mnt/floppy | n/a | n/a | mount /dev/rfd0 /floppy | mount/unmount floppy |
mount/unmount CDROM | mount -F hsfs -o ro <device path> /cdrom/cdrom0 umount /cdrom/cdrom0 /etc/init.d/volmgr start eject cdrom | mount -rt iso9660 /dev/cdrom /mnt/cdrom umount /mnt/cdrom eject cdrom | mount -rt iso9660 /dev/cdrom /mnt/cdrom umount /mnt/cdrom eject cdrom | mount -rF cdfs /dev/dsk/c1t6d0 /cdrom start: /usr/sbin/pps_mountd pps_mount | mount -v cdrfs -r /dev/cd0 /cdrom umount /cdrom | mount/unmount CDROM |
mount/umount ISO image | lofiadm -a <iso image> /dev/lofi/1 mount -F hsfs -o ro /dev/lofi/1 /mnt # to list lofiadm | |||||
remount a filesystem | n/a | mount -o remount,rw / | mount -o remount,rw / | mount_vxfs -o remount,ro <filesystem> | mount -o remount,rw <filesystem> Note:I did find a note that it should be possible to remount a jfs2 filesystem, but it did not work on my system | remount a filesystem |
create boot disk or recovery tape | n/a | mkbootdisk `uname -r` (boot diskette) | n/a | recovery tape (preview) make_tape_recovery -v -l -x inc_entire=vg00 /opt/ignite/bin/make_recovery -ACv | mksysb | create boot disk or recovery tape |
boot cdrom/diskette (single user) | ok> boot cdrom -s | using the grub window append the word singleto the kernel line | using the grub window append the word singleto the kernel line | enter PDC > search >boot p1 (cdrom) interact with IPL? Y ISL> hpux -is | based on a 9114-275 workstation
| boot cdrom/diskette (single user) |
boot into maintenace mode | ok> boot -as | f10 or f12 | f10 or f12 | >boot pri interact with IPL? Y ISL> hpux -lm | based on a 9114-275 workstation
| boot into maintenace mode |
Device paths | floppy:disk: /dev/dsk/c0t0d0s0 tape: /dev/rmt/0ucb cdrom: /dev/dsk/c0t6d0s0 /dev/scd0 (external usb cd) |
floppy:
/dev/fd0 disk: /dev/hda or /dev/sda /dev/hdb or /dev/sdb tape: cdrom: /dev/hda (depends on number of IDE disks) | floppy: /dev/fd0 disk: /dev/hda or /dev/sda /dev/hdb or /dev/sdb tape: cdrom: /dev/hda (depends on number of IDE disks) | floppy: n/a disk: /dev/dsk/c0t6d0 tape: /dev/dsk/rmt/0 cdrom: /dev/dsk/c1t6d0 | floppy: /dev/fd0 /dev/rfd0 disk: /dev/hdisk0 tape: cdrom: /dev/cd0 | Device paths |
update /dev directory | drvconfig devlinks disks|tapes|ports devfsadm ( solaris 8, 9, 10) | /dev/MAKEDEV <device> | /dev/MAKEDEV <device> | insf -C tape (Class) insf -H 0.1.0 -e (recreate deleted link) | cfgmgr cfgmgr -l scsi0 mkdev | update /dev directory |
remove or change a device | rem_drv | # remove all devices from a hardward path rmsf -k -H 52.6.0 | rmdev rmdev -l cd0 chdev chdev -l rmt0 -a ret=no | remove or change a device | ||
list device drivers | prtconf -D sysdef | cat /proc/devices | cat /proc/devices | lsdev | lsdev lsdev -Cc disk lsdev -Cc disk -p scsi0 lsslot -c pci -l ent0 lscfg lscfg -l ent0 lscfg -vl fcs0 (find the WWN of HBA adapter) lspath -l hdisk0 getconf DISK_SIZE hdisk1 (detailed) | list device drivers |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
Basic network information (hostname, ip address) | /etc/hostname.hme0 | /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 | /etc/network/interfaces | /etc/rc.config.d/netconf | stores information in the ODM (Object Database Manager) | Basic network information (hostname, ip address) |
displaying network interfaces | prtdiag -v ifconfig -a kstat hme:0:parameters:<param name> kstat e1000g:0:parameters:<param name> module:instance:name:statistics # Solaris 11 netadm list dladm show-phys dladm show-link dladm show-linkprop dladm show-vnic dladm show-etherstub ipadm show-if ipadm show-ifprop ipadm show-addr ipadm show-addrprop | ifconfig system-config-network (GUI) | ifconfig | ioscan -funC lan (list hardware) lanscan -v (list configured) ifconfig lan0 (individual) | ifconfig -a entstat -d <interface> lsdev -Cc if lsdev -Cc tcpip odmget -q "name=en0" CuAt lsattr -EHl en0 | displaying network interfaces |
Configure network interface | ifconfig # Solaris 11 - Automatic (using profiles) netadm enable -p ncp Automatic netcfg (use by Automatic) # Solaris 11 - Manual netadm enable -p ncp DefaultFixed netcfg dladm create-vnic dladm delete-vnic dladm rename-link dladm create-etherstub ipadm create-ip net1 ipadm create-addr -T static -a 192.168.0.110/24 net1/pfv ipadm delete-ip ipadm delete-addr | ifconfig | ifconfig | ifconfig <interface> | mktcpip (completely setup a network interface) rmtcpip (remove all network interfaces) # configure an interface mktcpip -h aix1 -a 192.168.1.200 -m 255.255.255.0 -i en1 -g 192.168.0.10 -h - hostname assigned to interface -a - ip address -m - netmask -i - interface name -g - gateway ip address # remove an interface ifconfig en1 detach ifconfig (configures IP address) chdev (add aliases to network interface) | Configure network interface |
Starting and stopping a network interface | ifconfig qfe0 up ifconfig qfe0 down | /sbin/ifup eth0 /sbin/ifdown eth0 | /sbin/ifup eth0 /sbin/ifdown eth0 | ifconfig lan0 up ifconfig lan0 down note: there is no "ifconfig -a" in hpux use lanscan then "ifconfig <interface>" | ifconfig en0 up ifconfig en0 down ifconfig en0 detach (remove) | Starting and stopping a network interface |
Setting NIC speed | ndd -set <device> <parm> <value> (dynamically) /etc/system (edit and update then reboot - permanent) | mii-tool -F 100baseTx-FD eth0 ethtool -s eth1 speed 100 duplex full | ethtool -s eth1 speed 100 duplex full | ndd -set <device> <parm> <value> lanadmin -X <option> lan0 | chdev -l ent0 -a media_speed=1000_Full_Duplex -P chdev -l ent0 -a media_speed=Auto_Negotiation -P Note: entX - physical device enX - frame type run on entX | Setting NIC speed |
Change NIC parameters | ndd -get <device> <parm> # List parameters ndd -get /dev/hme \? ndd -get /dev/e1000g0 \? ndd -get /dev/ip \? ndd -get /dev/tcp \? | mii-tool -v ethtool eth1 ethtool -t eth0 online sysctl -a | grep net* | ethtool eth0 sysctl -a |grep net* | lanadmin -> lan -> display ## options supported ndd -get /dev/ip ? ndd -get /dev/tcp ? ndd -get /dev/arp ? ndd -get /dev/udp ? | netstat -v entstat -d <interface> no -a no -o "ipforwarding=1" | NIC speeds or Parameters |
Display NIC statistics | netstat -i [-I interface] netstat -s | netstat -i [-f inet] netstat -s entstat -d <interface> | Display network statistics | |||
display MAC address | ifconfig -a (as user root) | ifconfig system-config-network (GUI) | ifconfig | lanscan | netstat -ia | display MAC address |
Displaying network packets | snoop -d <interface> | tcpdump -i <interface> ethereal (needs to be installed) | tcpdump -i <interface> ethereal (needs to be installed) | nettl -start nettl -status all nettl -tn pduin pduout -e ns_ls_driver -file /var/adm/LAN nettl -stop use netfmt to display the trace file | tcpdump -i <interface> iptrace -i <interface> <output file> ipreport (used with iptrace to view reports) Note: you must stop the iptrace by using "kill -15" | Displaying network packets |
default router | /etc/defaultrouter route add default <gateway> route -p add default <gateway> (persist changes) | edit /etc/sysconfig/network add: GATEWAY=<IP address> | edit /etc/network/interfaces add: gateway <IP address> | /etc/rc.config.d/netconf | route add 0 <gateway IP address> Note: there is no file that holds the default router | default router |
display routing table | netstat -rn | netstat -rn route -n | netstat -rn route -n | netstat -rn | netstat -rn netstat -r -f inet lsattr -EHl inet0 -a route | display routing table |
Test IPMP, Bonding | if_mpadm -d (detach) if_mpadm -r (reattach) tail /var/adm/messages | ifenslave -d bond0 eth1 (detach) ifenslave bond0 eth1 (reattach) cat /proc/net/bonding/bond0 # create bonding /etc/sysconfig/network-scripts/ifcfg-bond0 # modprobe /etc/modprobe.d/bonding.conf # for bonding options - use BONDING_OPTS /etc/sysconfig/network-scripts/ifcfg-bond0 # see bonding mode cat /sys/class/net/bond0/bonding/mode | ifenslave -d bond0 eth1 (detach) ifenslave bond0 eth1 (reattach) cat /proc/net/bonding/bond0 | You buy an optional product called Auto-Port Aggragation. | smitty etherchannel (creates, deletes and tests) entstat -d ent0 | Test IPMP, Bonding |
change the hostname | change the following files: /etc/nodename /etc/hostname.<interface> /etc/inet/hosts /etc/inet/ipnodes /etc/net - few files in here as well # Solaris 11 svccfg -s system/identity:node listprop config/nodename svcfg -s system/identity:node setprop config/nodename = astring: hostname svcadm refresh system/identity:node svcadm restart indentity:node | /etc/sysconfig/network /etc/hosts sysctl -a |grep hostname | /etc/hostname /etc/hosts sysctl -a |grep hostname | set_parms hostname (requires reboot) | hostname <new hostname> chdev -l inet0 -a hostname=<hostname> | change the hostname |
setup DNS | /etc/resolv.conf # Solaris 11 - You need to use the svccfg command svccfg -s dns/client listprop config/nameserver svccfg -s dns/client listprop config/search svccfg -s name-service/switch listprop config/host svccfg -s name-service/switch listprop config/password svcprop <pattern> Note: just use listprop on its own to view all options svccfg -s "dns/client" setprop "config/nameserver = net_address: (192.168.0.1)" svccfg -s "dns/client" setprop 'config/domain = astring: ("datadisk.co.uk")' svccfg -s "name-service/switch" setprop 'config/host = astring: "file dns"' svcadm refresh name-service/switch svcadm refresh dns/client | /etc/resolv.conf | /etc/resolv.conf | /etc/resolv.conf | /etc/resolv.conf | setup DNS |
Name service switch file (DNS client) | /etc/nsswitch.conf /etc/resolv.conf # Solaris 11 - you need to use the svccfg command see above | /etc/nsswitch.conf /etc/host.conf /etc/resolv.conf | /etc/nsswitch.conf /etc/host.conf /etc/resolv.conf | /etc/nsswitch.conf /etc/resolv.conf | /etc/netsvc.conf /etc/resolv.conf /etc/irs.conf (may not be there) chnamsv (change name service) rmnamsv (remove a name service) lsnamsv -C (list name services) | Name service switch file (DNS client) |
Flush DNS cache | svcadm restart system/name-service-cache:default | ## if installed service nscd restart | n/a | netcdctrl -t dns -e hosts -f | Flush DNS cache | |
Domain Name | /etc/defaultdomain | /etc/sysconfig/network (HOSTNAME option) /etc/resolv.conf Note: for NIS use the NISDOMAIN option | /etc/host /etc/resolv.conf | /etc/rc.config.d/netconf | domainname <domainname> | Domain Name |
Obtain IP Address routing | route -n get <hostname> traceroute | ip route get <IP address> traceroute | ip route get <IP address> traceroute | n/a | route -n get <hostname> | Obtain IP Address routing |
Find Services on the network | Boot (jumpstart) servers: rpcinfo -b bootparam 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1 | Boot (jumpstart) servers: rpcinfo -b bootparam 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -u <yp server> ypserv | Boot (jumpstart) servers: rpcinfo -b bootparam 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -u <yp server> ypserv | Boot (jumpstart) servers: rpcinfo -b bootparam 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1 | Boot (jumpstart) servers: rpcinfo -b bootparam 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1 | Find Services on the network |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
Crash Dump | dumpadm -d <device> coreadm crash (used to analyse crash dumps) adb (used to analyse crash dumps) | diskdump netdump kdump (part of kexec rpm) /etc/kdump.conf (select where you want the dump to go) service kdump start chkconfig kdump on ## to crash the system echo "c" > /proc/sysrq-trigger crash (used to analyse crash dumps) | diskdump netdump kdump (part of kexec rpm) /etc/kdump.conf (select where you want the dump to go) service kdump start chkconfig kdump on ## to crash the system echo "c" > /proc/sysrq-trigger crash (used to analyse crash dumps) | edit /stand/system add either: dump 2/0/1.5.0 dump lvol dump none # crash config file /etc/rc.config.d/savecrash | sysdumpdev -l (list dump destination) sysdumpdev -e (estimates dumpsize) sysdumpdev -L (info) sysdumpstart -p (start dump primary) sysdumpstart -s (start dump secondary) # set the dump device permanently sysdumpdev -p <dump device> -P # analyse dump file echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0 |
Crash Dump
|
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
CPU | top (sunfreeware) prstat sar mpstat w (load average) uptime (load average) ps vmstat | top sar mpstat w (load average) uptime (load average) ps vmstat procinfo oprofile cat /proc/cpuinfo | top sar mpstat w (load average) uptime (load average) ps vmstat procinfo cat /proc/cpuinfo | top sar w (load average) uptime (load average) ps vmstat glance sam | topas -P topas -L (logical partitions) mpstat sar -c w (load average) uptime (load average) lparstat ps iostat -tT 1 tprof curt |
CPU
|
Memory | prstat vmstat top sar | free vmstat top procinfo slabtop sar cat /proc/meminfo | free vmstat top procinfo slabtop sar cat /proc/meminfo | top vmstat sar sam glance | topas vmstat sar -b svmon ps ipcs -a lockstat (version 4) rmss |
Memory
|
Network | ndd netstat lsof snoop route | ethtool mii-tool netstat lsof tcpdump ip iptraf nmap | ethtool mii-tool netstat lsof tcpdump ip iptraf | netstat lanadmin sam glance | [ent|tok|fddi|atm]stat netstat netpmon (trcstop to stop trace) |
Network I/O
|
Disk | sar -d iostat vmstat lsof | sar -d iostat vmstat lsof | sar -d iostat vmstat lsof | iostat sar sam glance | topas -D (disk) topas -F (filesystem) iostat sar -D fcstat (fibre) lvmstat filemon (trcstop to stop) fileplace # disk stat history chdev -l sys0 -a iostat=true lsattr -HEl sys0 -a iostat |
Disk I/O
|
Application | truss -p <pid> ppriv -D -e <command> | strace -p <pid> | strace -p <pid> | download and install tusctusc -p <pid> | topas truss sar probevue tprof svmon -P <pid> |
Application
|
NFS | nfsstat | nfsstat | nfsstat | nfsstat | nfsstat |
NFS
|
Process | top prstat ps -ef pargs <pid> pcred <pid> pfiles <pid> pflags <pid> pgrep <pattern> pkill <pattern> pmap <pid> pldd <pid> preap <pid> prun <pid> psig <pid> pstack <pid> pstop <pid> ptime <pid> ptree <pid> pwait <pid> pwdx<pid> |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
display loaded modules | modinfo | cat /proc/modules (more detailed) lsmod modinfo <module> Location: /lib/modules/`uname -r`/kernel/drivers Config: /etc/modprobe.conf /etc/modprobe.d | cat /proc/modules (more detailed) lsmodLocation: /lib/modules/`uname -r`/kernel/drivers Config: /etc/modprobe.d/options /etc/modprobe.d | kmadmin -k | genkex | display loaded modules |
load modules | modload -p drv/<module name> | modprobe <module> insmod | modprobe <module> insmod | kmadmin -L <module name> | n/a | load modules |
unload modules | modunload -i <module number> | modprobe -r <module> rmmod | modprobe -r <module> rmmod | kmadmin -U <module name> kmadmin -u <module id> | n/a | unload modules |
set kernel parameters (tuning) | /etc/system (edit and reboot) | /etc/sysctl.conf (edit and update then reboot) sysctl -p <filename>sysctl -w param=value No reboot (dynamically): echo "250 32000 100 28" > /proc/sys/kernel/sem echo "536870912" > /proc/sys/kernel/shmmax echo "4096" > /proc/sys/kernel/shmmni echo "2097152" > /proc/sys/kernel/shmall etc............................................. | /etc/sysctl.conf (edit and update then reboot) sysctl -p <filename>sysctl -w param=value No reboot (dynamically): echo "250 32000 100 28" > /proc/sys/kernel/sem echo "536870912" > /proc/sys/kernel/shmmax echo "4096" > /proc/sys/kernel/shmmni echo "2097152" > /proc/sys/kernel/shmall etc............................................. | kcweb (11i) kctune (11i only) rebuild kernel (< 11i see below) | chdev -l sys0 -a <parameter>=<value> no -a (network) vmo -a (virtual memory) nfso -a (NFS) ioo -a (Input/Ouput) raso -a (reliability, availability, serviceability) schedo -a (processor scheduler) vi /etc/security/limits cd /etc/tunables tunchange, tundefault, tunsave, tunrestore, tuncheck Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted | set kernel parameters |
display kernel parameters | cat /etc/system sysdef -i | sysctl -a cat /etc/sysctl.conf cat /proc/sys/kernel/sem cat /proc/sys/kernel/shmmax etc................................... | sysctl -a cat /etc/sysctl.conf cat /proc/sys/kernel/sem cat /proc/sys/kernel/shmmax etc................................... | kctune (11i only) sysdef kmtune kmsystem /usr/sam/lbin/getkinfo -f /stand/vmunix -o /tmp/kernel.data | lsattr -EHl sys0 Note: only a few kernel parameters can be changed | display kernel parameters |
build kernel | edit and update file then reboot: /etc/system | cd /usr/src/linux-2.5 edit Makefile (change EXTRAVERSION) make mrproper backup .config make xconfig make dep make bzImage make modules move new kernel make modules_install change lilo/grub config file reboot | cd /stand/build /usr/lbin/sysadm/system_prep -v -s system edit system file /usr/sbin/mk_kernel -s ./system mv /stand/system /stand/system.old mv /stand/vmunix /stand/vmunix.old mv /stand/build/system /stand mv /stand/build/vmunix_test /stand/vmunix reboot | chdev -l sys0 -a <parameter>=<value> Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted | build kernel | |
interprocess communication | ipcs -a | ipcs -a | ipcs -a | ipcs -a | ipcs -a | interprocess communication |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
display services | svcs -a svcs -l <service> svcs -vx inetadm -l | service --status-all | There is no services or chkconfig command use the old fashioned way /etc/init.d/<service> | There is no services or chkconfig command use the old fashioned way /sbin/init.d/<service> | lssrc -a | display services |
start services | svcadm enable nfs | service nfs start | startsrc -s <subsystem> startsrc -g <group> | start services | ||
stop services | svcadm disable nfs | service nfs stop | stopsrc -s <subsystem> stopsrc -g <group> | stop services | ||
reload service | svcadm refresh nfs svcadm clear nfs (changes state) | service nfs reload | refresh -s <subsystem> | reload service | ||
restart service | svcadm restart nfs | service nfs restart | stopsrc -s <subsystem> startsrc -s <subsystem> | restart service | ||
service status | svcs nfs | service nfs staus | lssrc -a | service status | ||
service dependencies | svcs -d network | n/a | n/a | service dependencies | ||
service dependants | svcs -D network | n/a | n/a | service dependants | ||
Service notifications | # change or add svccfg # verify or confirm svcprop | |||||
service logging, etc | /var/svc/log /var/svc/manifest /lib/svc/method /etc/svc/repository.db /system/volatile/svc_nonpersist.db | n/a | /var/adm/ras /etc/syslog.conf /etc/rc.tcpip | service logging, etc | ||
change service startup | n/a | chkconfig --levels 2345 nfs on | n/a | change service startup | ||
Add a new service | n/a | # Create your stop/start # script in /etc/init.d chkconfig --add <script> |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
display installed patches | showrev -p patchadd -p | swlist -l bundle swlist -l product swlist -l patch | instfix -ia | display installed patches | ||
adding patch | patchadd patchadd -M <dir> (multiple patches) | patch -p1 <patch> zcat patch46.gz | patch -p1 Note: -p = # of path stripping | swcopy (install patch into depot) swinstall (install patch from depot) Note: the swagentd daemon must be running | instfix -k | adding patch | |
removing patch | patchrm | patch -R -p1 <patch> | swremove | installp -r | removing patch | |
display installed packages | pkginfo (all packages) pkginfo -l (single package) pkgchk -l -p <file> (file belongs) # NEW IPS pkg list (all packages) pkg info (single package) pkg search (find packages and files) | rpm -qa (all packages) rpm -q (single package) rpm -qf (file belongs) rpm -qi <package> (very detailed) | dpkg -l dpkg -S <search string> (search) dpkg -S <filename> (file belongs) dpkg -s <package> (status) dpkg -p <package> (detailed) | swlist -l bundle <bundle> swlist -l product <product> ## check a package swlist -s <full_path/software> | lslpp -L all (all filesets) lslpp -L <package> (single fileset) lslpp -w <file> (file belongs) lslpp -ha (history of filesets) rpm -qa (all packages) rpm -q (single package) rpm -qf (file belongs) rpm -qi <package> (very detailed) oslevel -g (install packkages above os level) whereis <filename> which_fileset <filename> | display installed packages |
adding package | pkgadd # NEW IPS pkg install pkg update | rpm -Uhv (updates/installs if not already) rpm -ihv (install) | dpkg -i <package> | swinstall swinstall -s <full_path/software> | installp -a installp -c (cleanup after failed install) rpm -i geninstall (generic installer: installp, RPM, etc) | adding package |
removing packages | pkgrm # NEW IPS pkg uninstall <package> | rpm -e <package> | dpkg -r <package> (do not remove config files) dpkg -P <package> (remove config files) | swremove | installp -u (commited packages) installp -r (applied packages) rpm -e <package> geninstall -u <package> | removing packages |
verify package | pkginfo -l pkginfo -p # NEW IPS pkg publisher pkg verify <package> | rpm -V <package> | n/a | swverity <fileset> (see /var/adm/sw/swagent.log) | lppchk -v rpm -V <package> | verify package |
List files in package | pkgchk -l <package> | grep -i pathname # NEW IPS pkg contents <package> | rpm -ql <package> | dpkg -L <package> (list files) | swlist -l file <product> | lslpp -f <fileset> rpm -ql <package> | List files in package |
Other package commands | # NEW IPS pkg history pkg purge-history pkg freeze pkg unfreeze pkg fix pkg refresh pkg publisher | |||||
Package directory | /var/sadm | /var/lib/rpm | /var/lib/dpkg/info | /var/adm/sw | /usr/lpp /var/lib/rpm | Package directory |
List libraries required for binary program | ldd <file> | ldd <file> | ldd <file> | chatr <file> | ldd <file> | List libraries required for binary program |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
display users | cat /etc/passwd logins -x [-p] | cat /etc/passwd system-config-users (GUI) | cat /etc/passwd | cat /etc/passwd logins -x | cat /etc/passwd lsuser -f ALL (detailed) | display users |
create a user | useradd # user defaults /usr/sadm/defadduser | useradd system-config-users (GUI) | useradd | useradd sam | mkuser useradd | create a user |
remove a user | userdel | userdel system-config-users (GUI) | userdel | userdel sam | rmuser userdel | remove a user |
modify a user | usermod | usermod system-config-users (GUI) | usermod | usermod sam | chuser -a usermod passwd -f passwd -s chfn <username> chfn <username><shell> | modify a user |
change user password | passwd | passwd | passwd | passwd | passwd pwdadm pwdck -t ALL | change user password |
create a group | groupadd | groupadd | groupadd | groupadd | mkgroup <group name> | create a group |
remove a group | groupdel | groupdel | groupdel | groupdel | rmgroup <group name> | remove a group |
modify a goup | groupmod | groupmod | groupmod | groupmod | chgroup <attribute><group name> | modify a goup |
password files | /etc/passwd /etc/shadow | /etc/passwd /etc/shadow | /etc/passwd /etc/shadow | /etc/passwd /tcb/files/auth/r/root (trusted system) | /etc/security/passwd | password files |
useful user commands | id -a whoami who w finger logins -p | id -a whoami who w finger | id -a whoami who w finger | id whoami who w uptime (displays # of users logged in) finger | id whoami who w uptime (displays # of users logged in) finger # License information lslicense chlicense # Maximum number of processes for a user lsattr -D -l sys0 -a maxuproc chdev -l sys0 -a maxuproc=<number> | useful user commands |
useful group commands | groups setpgrp newgrp | groups | groups | groups setprivgrp | groups setgroups lsgroup ALL | useful group commands |
Password Policy | /etc/security/policy.conf /etc/default/passwd | /etc/login.defs | ||||
Password Aging | passwd | chage -l <user> chage <options> <user> |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
NFS Daemons | server: mountd, nfsd client: statd, lockd | server: rpc.mountd,nfsd client: rpc.statd, lockd | server: rpc.mountd,nfsd client: rpc.statd, lockd | server: rpc.mountd, nfsd client: rpc.statd, lockd | server: rpc.mountd, nfsd client: rpc.statd, rpc.lockd | NFS Daemons |
NFS files | /etc/dfs/dfstab /etc/dfs/sharetab /etc/rmtab | /etc/exports /var/lib/nfs/etab /var/lib/nfs/xtab | /etc/exports /var/lib/nfs/etab /var/lib/nfs/xtab | /etc/exports /etc/xtab | /etc/exports /etc/xtab | NFS files |
List nfs clients that have a remote mount | /etc/rmtab | /var/lib/nfs/rmtab | /var/lib/nfs/rmtab | /etc/rmtab | /etc/xtab | List nfs clients that have a remote mount |
display nfs shares | dfshares showmount -e localhost | showmount -e localhost | showmount -e localhost | showmount -e localhost | exportfs showmount -e localhost | display nfs shares |
create nfs share | /etc/dfs/dfstab (edit and add share) share <path> ## dfstab example share -F nfs -d "jumpstart" /export/jumpstart | redhat-config-nfs (GUI) /etc/exports (edit and add share) /sbin/service nfs reload ## /etc/exports example /export *(rw,fsid=0,insecure,no_root_squash,sync) | /etc/exports (edit and add share, see below example) exportfs -rav (export the shares) /etc/init.d/portmap restart /etc/init.d/nfs-kernel-server restart ## /etc/exports example /export *(rw,fsid=0,insecure,no_root_squash,sync) | /etc/rc.config.d/nfsconf (edit) /etc/exports (edit and add share) exportfs -a | mknfsexp -d <directory> mknfsmnt shareall | create nfs share |
uncreate nfs share | unshare <path> /etc/dfs/dfstab (edit and remove share) | /etc/exports (edit and remove share) /sbin/service nfs reload | /etc/exports (edit and remove share) exportfs -rav (export the shares) | /etc/rc.config.d/nfsconf (edit) exportfs -au (unshare all) exportfs -u /home/vallep /etc/exports (edit and remove share) | rmnfsexp -d <directory> (unshares and removes from file) exportfs -u <filesystem> unshareall | uncreate nfs share |
start/change nfs daemons | /etc/init.d/nfs.server start /etc/init.d/nfs.client start svcadm enable nfs/server svcadm disable nfs/server | /sbin/service nfs start | /etc/init.d/portmap start /etc/init.d/nfs-kernel-server start | /sbin/init.d/nfs.core start /sbin/init.d/nfs.server start /sbin/init.d/nfs.client start | mknfs chnfs startsrc -s nfsd startsrc -s rpc.mountd | start/change nfs daemons |
stop nfs daemons | /etc/init.d/nfs.server stop /etc/init.d/nfs.client stop | /sbin/service nfs stop | /etc/init.d/portmap stop /etc/init.d/nfs-kernel-server stop | /sbin/init.d/nfs.client stop /sbin/init.d/nfs.server stop /sbin/init.d/nfs.core stop | rmnfs stopsrc -s nfsd stopsrc -s rpc.mountd | stop nfs daemons |
nfs status | ps -ef|grep < nfs daemons> | /sbin/service nfs status | /etc/init.d/nfs-kernel-server status | ps -ef | grep <nfs daemons> | lssrc -a |grep -i nfs | nfs status |
nfs reload | shareall | /sbin/service nfs reload | exportfs -rav (export the shares) | exportfs -a | exportfs -av | nfs reload |
nfs performanace | nfsstat | nfsstat | nfsstat | nfsstat | nfsstat | nfs performanace |
nfs Options | n/a | cat /var/lib/nfs/etab | cat /var/lib/nfs/etab | n/a | nfso -a nfso -o <option>=<value> exportfs (display options) | nfs Options |
solaris/redhat mount problems (nfs v3 to v4) | ## Make sure you use NFS version 3 mount -F nfs -o vers=3 <mount> <mountpoint> | n/a | n/a | n/a | n/a | solaris/redhat mount problems (nfs v3 to v4) |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
Time daemons | xntpd | ntpd | ntpd | xntpd | xntpd | Time daemons |
ntp setup | # Solaris 8 /etc/ntp.conf /etc/ntp.server /etc/ntp.client /etc/rc2.d/xntpd [start|stop] # Solaris 10 /etc/inet/ntp.server /etc/inet/ntp.client svcadm enable ntpd | /etc/ntp.conf (edit with ntp servers) dateconfig (GUI) chkconfig --list ntpd chkconfig --level 2345 ntpd on /sbin/service ntpd start | /etc/default/ntp /etc/ntp.conf /etc/init.d/ntp [start|stop|restart] | /etc/rc.config.d/netdaemons (set XNTPD to 1) /etc/ntp.conf | /etc/ntp.conf startsrc -s xntpd stopsrc -s xntpd lslpp -L all|grep xntpd | ntp setup |
ntp daemon options | /lib/svc/method/xntp | /etc/sysconfig/ntpd | /etc/default/ntp | /etc/rc.config.d/netdaemons | startsrc -s xntpd -a "-x" /etc/rc.tcpip | ntp daemon options |
NTP Trace commands | ntpq -p ntptrace | ntpq -p ntptrace | ntpq -p ntptrace | ntpq -p ntpdate (set the date) | ntpq -p ntptrace ntpdate | NTP Trace commands |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
messages | /var/adm/messages | /var/log/messages | /var/log/messages | /var/adm/syslog/syslog.log | /var/adm/ras |
messages
|
syslog | /var/log/syslog | /var/log/syslog | /var/log/syslog | /var/adm/syslog/syslog.log | /var/adm/ras |
syslog
|
/var/log/mail | /var/log/mail.* | /var/adm/syslog/mail.log | /usr/spool/mqueue/syslog |
mail
| ||
cron | /var/cron/log | /var/log/cron | /var/log/cron.log | /var/adm/cron/log | /var/adm/cron/log |
cron
|
boot | /var/adm/messages dmesg | /var/log/boot dmesg | /var/log/boot dmesg | /var/adm/syslog/syslog.log dmesg | /var/adm/ras alog -o -t boot alog -o -t console alog -L (list all the logs available) |
boot
|
Error logging | logger | logger | logger | logger | /usr/lib/errdemon -l (display attributes) /usr/lib/errdemon (start error logging) /usr/lib/errstop (stop error logging) # use with above errorlog file errpt (summary errorlog report) errpt -a (detailed errorlog report) errpt -j <identifier> (single errorlog report) errclear (clears errorlog) errclear -d <class><days> (clears class errors) errlogger "message upto 230 chars" | Error logging |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
Checking the passwd file | pwck | pwck | pwck | pwck | pwdck -t ALL usrck -t ALL | Checking the passwd file |
checking the group file | grpck | grpck | grpck | grpck | grpck | checking the group file |
console login (allow/deny) | # Solaris 10 (no reboot) /etc/default/login # Solaris 11 (no reboot) /etc/default/login /etc/user_attr (see below) rolemod -K type=normal root | # No reboot required /etc/securetty | # No reboot required /etc/securetty | # No reboot required /etc/securetty Note: you may need to create this file if it does not exist | # No reboot required /etc/security/user chsec -f /etc/security/user -s root | console login (allow/deny) |
Solaris
|
Red Hat
|
Ubuntu/Debian
|
HP
|
AIX
| ||
startup | eeprom setenv boot-device | grub (GUI) lilo (text based) | grub (GUI) | setboot -p <primary path> setboot -a <alternate path> # autoboot sequnce setboot -b [on|off] | bootlist -m normal hdisk0 hdisk1 | startup |
shutdown | shutdown -i5 -g0 -y (power down) shutdown -i6 -g0 -y (reboot) shutdown -i0 -g0 -y (OK prompt) reboot -- -r (reboot/reconfigure) touch /reconfigure | shutdown -h (halt) shutdown -r (reboot) shutdown -f (fast reboot no fsck) shutdown -F (force fsck) | shutdown -h (halt) shutdown -r (reboot) shutdown -P (power off) touch /forcefsck # edit /etc/default/rcS change below so # you dont have to hang around FSCKFIX=yes | shutdown -h now (halt) shutdown -r now(reboot) | shutdown -F (fast shutdown) shutdown -Fr (fast shutdown and reboot) | shutdown |
Change run level | halt init poweroff reboot shutdown telinit uadmin | halt init poweroff reboot shutdown telinit | halt init poweroff reboot shutdown telinit | init reboot shutdown | init shutdown reboot telinit halt | Change run level |
init status 0 1 2 3 4 5 6 | 0 - shutdown 1 - single user 2 - n/a 3 - Multi-user 4 - n/a 5 - power off 6 - reboot # change default vi /etc/inittab | 0 - halt 1 - single user 2 - multiuser (no networking) 3 - multiuser (networking) 4 - unused 5 - GUI 6 - reboot # change default vi /etc/inittab | 0 - halt 1 - single user 2 - multiuser (default) 3 - same as 2 4 - same as 2 5 - same as 2 6 - reboot # change default - change all the telinit vi /etc/event.d/rc-default | 0 - halt 1 - single users 2 - multiuser (networking) 3 - multiuser (networking, NFS, and CDE GUI) (default) 4 - multiuser (netwrking, NFS, and VUE GUI) 5 - n/a 6 - n/a # change default - change the initdefault line vi /etc/inittab | 0 - reserved 1 - reserved 2 - multiuser mode with NFS 3 - user defined 4 - user defined 5 - user defined 6 - user defined 7-9 - user defined # change default - change the initdefault line vi /etc/inittab | init status 0 1 2 3 4 5 6 |
Startup options | boot <option> # Options -s single user -a interactive -x no device drivers (used in clustering) -r reconfigure devices -m milestone | single - use grub to edit kernel line emergency - use grub to edit kernel line linux rescue - use at the boot prompt single: runlevel1, local fs mounted, no network emergency: root fs read-only, no init files run rescue: use cd-rom/network, root mounted as /mnt/sysimage | single - use grub to edit kernel line emergency - use grub to edit kernel line linux rescue - use at the boot prompt single: runlevel1, local fs mounted, no network emergency: root fs read-only, no init files run rescue: use cd-rom/network, root mounted as /mnt/sysimage | interact with IPL? Y # single user ISL> hpux -is # Logical volume maintanence mode ISL> hpux -lm # No quroum check ISL> hpux -lq | Based on 9114-275 workstation 1. switch off the machine 2. power on and enter the SMS menu Note: to enter the SMS menu press numeric 1 after the word keyboard but before the word speaker | Startup options |
startup scripts | /etc/init.d /etc/rc0.d - /etc/rc6.d | /etc/init.d /etc/rc0.d - /etc/rc6.d | /etc/init.d /etc/rc0.d - /etc/rc6.d | /sbin/init.d /etc/rc.config.d (startup config files) /sbin/rc0.d - /sbin/rc6.d | /etc/rc.d /etc/rc.d/init.d /etc/rc.d/rc2.d - rc9.d /etc/rc.* (config files for auto-starting) also uses the System Resource Controller | startup scripts |
boot prompt commands | boot printenv setenv banner devalias show-devs show-pci-devs-all probe-scsi-all probe-fcal-all probe-pci watch-net-all reset-all | F10 or F12 | F10 or F12 | interact with IPL? Y | Based on a 9114-275 workstation 1. switch off the machine 2. power on and enter the SMS menu Note: to enter the SMS menu press numeric 1 after the word keyboard but before the word speaker | boot prompt commands |
Boot process | Phases:
| Boot sequence
| Boot sequence
| Phases:
| Phases:
| Boot process |
Boot Environments (BE) | bootadm list-archive bootadm update-archive bootadm list-menu bootadm set-menu <option> beadm create beadm rename beadm activate beadm list beadm destroy | |||||
determine the run level | who -r | runlevel who -r | runlevel who -r | who -r | who -r | determine the run level |
obtain default run level | cat /etc/inittab | cat /etc/inittab | /etc/event.d/rc-default | /etc/inittab | /etc/inittab | obtain default run level |
list locale | locale -a | locale -a | locale -a | locale -a | locale -a | list locale |
start xwindows | n/a | startx (shorthand of below) initx (lots of parms) | n/a | n/a | start xwindows | |
initialize system | sys-unconfig | set_parms [initial|hostname|ip_address|timezone] Note: set_parms is in /sbin | install_assist | initialize system | ||
Timezone | /etc/TIMEZONE /etc/default/init | /etc/sysconfig/clock /usr/share/zoneinfo/zone.tab | /etc/timezone /usr/share/zoneinfo/zone.tab | /etc/TIMEZONE | /etc/environment /etc/profile | Timezone |
No comments:
Post a Comment