Shell's & Basics
/usr/bin/csh california o C Shell
/usr/old/bin/sh Bourne Shell
/usr/bin/sh Standard POSIX Shell
/usr/bin/ksh Korn Shell
/usr/bin/keysh Key sentive Shell
/usr/bin/rksh Restricted Kron Shell
/usr/bin/rsh Restricted Bourne Shell
These restricted shell are not allowed to: Changing directories,
changing PATH and SHELL variables, using a command that has
/ anywhere in its name, using I/O redirection, executing programs with
exec.
If the .profile script is interrupt the user is logg off automatically.
Programas que vienen normalmente con Unix
Mail Mail, Mailx.
Edición de ficheros ed, ex, vi.
Procesamiento de textos sort, grep, wc, awk, sed.
Formateo de texto nroff.
Desarrollo de programas cc, make, lint, lex.
Comunicaciones uucp.
Administración de usuarios ps, du, acctcom.
Principio
Naming conventions for
device files
-
In general: c# instance number of the device, t# target address,
d#
device
number SCSI devices.
-
Disk naming /dev/dsk/c#t#d#[s#] c is the controller, t is the target
number, d is the hardware device number, s is the section in the disk.
-
Logical Volume Naming /dev/vgg/lvoln g is the number of the volume
group, n is the number of the logical volume.
-
DDS, DAT naming /dev/rmt/c#t#d#[options]. Options include Compression
([BEST, NOMOD, DDS1, DDS2 D# numeric value for the compression], n no rewind
the tape on close, b Berkeley tape behavior, w writes waits for physical
completion of the operation before returning status.
-
Terminal, modem, and printer /dev/ttyCpP /dev/ttydCpP /dev/culCpP /dev/cauCpP
/dev/cCtTdD_lp where C is the controller and p# is the port.
-
Optical disk library /dev/[r]ac/c#t#d#_#[a|b] c# is the card
instance for this device, t# is the address of the device interface,
d#
is the device unit number. #[a|b] disk platter number a surface.
-
Pseudo terminal (Device with emulation capabilities such telnet,
hpterm
and xterm)
-
Slave /dev/tty xx Links to /dev/pty/tty xx
-
Master /dev/ptty xx. Links to /dev/ptym/pty xx.
-
Streams based in speudoslave /dev/pts/n dtterm terminal emulator.
-
Streams based master /dev/ptymx dtterm terminal emulator
Principio
Sam
Program sam: (HP-UX)
sam visual configuration. export [setenv C shell] DISPLAY
= hostname : 0.0.
Remote use sam -display w:0.0 or export DISPLAY = ws : 0.0.
Log file samlog.
sam -r to give rigths to others users. /etc/sam/custom/user.cf
Configuration file for user. For groups finish in .gp.
Principio
Application variables
/etc/MANPATH Location of man pages.
/etc/PATH Location of commands
/etc/SHLIB_PATH Location of shared libraries.
Principio
Shell programing notes
The arguments are refering as $0 the file name, and $1, $2
the first, the second and so on.
$# -> The number of the arguments.
$*-> The complete argumente list.
shift [n] Shifts all strings in * n positions.
read variable [variable] Read one variable from the input.
Echo characters:
\a Alert character.
\b Backspace.
\c Suppresses the terminating newline.
\f Fromfeed.
\n Newline.
\r Carriage return.
\t Tab character.
\\ Backslash.
\nnn ASCII char code nnn.
Shells functions:
Function funct_name {code} or
funct_name ( ) {code}
The comments are preceded by #.
To specify a designated shell to run one script must be written in
the first line: #!/usr/bin/shell_name
Test expression Test one expression and return 0 for
TRUE and non-zero for FALSE.
Numeric test
-lt less than
-le less or equal
-gt greater than
-ge greater or equal
-eq equal (= for strings)
-ne not equal (!= for strings)
String test
String1 = String2 Equal.
String1 =! String2 Not equal.
-z String String not zero.
-n String String not zero
String String not zero.
File test
Text [-fds] filename Is a file f, is a directory
d,
if exists and have a greater size than zero s, if is readable
r,
if is writeable w, if is executable x
Operators
-o Or
-a And
! not
\( \) Grouping
Exiting
exit [arg] Finish the program and return arg.
return [arg] Finish the block, funtion or program and
return arg.
Branches
if
List A
then
List B
[else
List C]
fi
case word in
Pattern1) list A
;;
Pattern1) list B
;;
PatternN) list N
;;
*) //otherwise
;;
esac
. *Match any character, ? mach single character and [?] any character
between brackets.
Loops
while ? do .. done
util ? do .. done
for ? do ? done
let expression to designate numerical variables.
Break [n] Terminates de iteration and skip the commands until
the nth iteration is done.
Continue [n] Continues with the nth next iteration.
Trap 'cmds' Captures the signal sending to the program.
Principio
-
Transition Links
The following commands are in the directory /opt/upgrade/bin
Tlinstall install the links in the system
Tlremove remove the links.
Tllist list the links.
-
In Unix exits relative path and absolute path.
-
Files type- Nomal.
-
d directorio
-
l link
-
n fichero de red.
-
c fichero de caracter (terminales, impresoras)
-
b fichero de bloque (discos)
-
p ficheros de pipe o tuberia (temporales)
-
Quoting & Redirection
-
\ Removes the special meaning of the following character.
-
' Removes the special meaning of any character between two of them.
-
" Removes the special meaning of any character, but it's possible
do a command substitution, using $.
-
< Input redirection.
-
>Output redirection.
-
>> Output redirection for appending.
-
2> & 2>> Error redirection.
-
<< Introduction commands to one program. P.e autocad <<
END Act draw ins line END.
-
Environment variables
-
Using export to make the variable global.
-
To set Shell variables do name=variable.
-
To show the content of one variable uses $name.
-
To get the results of one command execution in one variable do name=$(command).
or name='command'
-
Tilde substitution ~+ = PWD; ~ = HOME;
~- =
OLDPWD;
~string
= User login path.
-
DISPLAY Special X Window variable.
-
EDITOR = editor Default editor.
-
ENV = script Execute
script as startup script.
-
FCEDIT = editor Uses the editor given to open a sesion with
the previous commands.
-
HISTFILE Special POSIX variables.
-
HOME = root directory.
-
LOGNAME = User name used to log in the system.
-
OLDPWD = Previous directory.
-
PATH = Searching application and commands path. In Unix the
separator is the :.
-
PS1 = Designates the primary prompt.
-
PWD = Actual directory.
-
SHELL = Designates the present interpreter command.
-
TERM, COLUMNS, LINES = Terminal type definitions.
-
TMOUT = number Time out period in seconds.
-
TZ = Time zone.
-
Tricks
-
cat file| mailx -s "subject" address to send
files via e-mail.
-
Eval 'tset -s -Q -h' To find out the terminal type.
-
To wait until the printer system is not printing
-
$while true
-
>do
-
>A=$(lpstat -i -o|wc -l)
-
>if $A=0
-
>then
-
>lpshut && banner "SCHEDULED STOPPED"
-
>else
-
>clear && lpstat -i -o
-
>sleep 10
-
>fi
-
>done
-
LAN services Services \ Solutions
ARPA
BERKLEY
-
VTE (Terminal emulation)
telnet
rlogin
-
NFT (Transferencia de ficheros) ftp(put
& get) rcp
-
RPM (Remote protocol manag.) ------
remsh
-
Others commands ->
rwho & ruptime
-
File systems:
-
Journaled File System (JFS)
-
High preformance file system (HFS)
-
Network file system (NFS)
-
CD-ROM File Systems (CDFS)
-
Portable File System (PFS)
-
Loopback file Systems (LOFS)
-
Install a new disk (COOKBOOK).
-
mediainit -v /dev/rdsk/c0t5d0 /*format the disk */
-
pvcreate /dev/rdsk/c0t5d0
-
mkdir /dev/vg01
-
mknod
-
vpcreate /dev/vg01/dev/dsk/c0t5d0
OR
-
Stop the system -> connect the disk (unique target!!) -> restart the system
-
ls -l /dev/dsk/c0t1d0
-
mediainit -v /dev/rdsk/c0t1d0
-
pvcreate /dev/rdsk/c0t1d0
-
mkdir /dev/vg01 and mkdir /<new_directory>
-
mknod /dev/vg01/group -c 64 0 x010000 /dev/rdsk/c0t1d0
-
vgcreate /dev/vg01 7dev/rdsk/c0t1d0
-
lvcreate -L 200 /dev/vg01
-
newfs /dev/vg00/tvol9 or newfs 7dev/vg00/rlvol9
-
mount /dev/vg00/vol and mkdir /<new_directory>
-
Patches
-
Name format PHxx_yyyy where XX = CO general commands, KL kernels
patches, NE network, SS others; yyyy is a unique number.
-
Troubleshooting
-
If the printer scheduler won't start up. Do rm -f /var/spool/lp/SCHEDLOCK.
If persists do kill -15 lpsched_pid and restart the scheduler.
-
Proceso ixwd colgado, ejecutar ./WORM start en el directorio
/sbin/init.d.
see /usr/osit/etc/proc_tab
for
processes which have to run.
restart ixwd with:
/usr/osit/bin/appl/ixos_start_stop.ksh start
Achtung!!!:
Applikation nur starten wenn keine Prozesse des
Users daemon laufen. Sonst kann u. U. ein reboot
des Servers notwendig sein.
checken mit: ps -ef | grep daemon
Log for error messages in:
/usr/adm/iXOS-ARCHIVE/ixwd.log
Check with:
ixarch02:(/usr/osit/bin/appl)>ps -ef | grep ixwd
root 21268 21267 0 15:58:43 ?
0:00 ixwd MountDir=/iXWORM
root 21274 1 1 15:58:43
? 0:07 ixwd MountDir=/iXWORM
root 21267 1 0 15:58:43
? 0:00 ixwd MountDir=/iXWORM
-
cat fich| mailx -s "subject" address to send mail
files trought internet in every Unix machine.
-
Process cdmpgr is asociated to connect direct.
-
Process saposcol, sap os collector. Via SAP-GUI do ST06 -> Button
"OS Collector" -> Start
-
Via telnet <SID>adm do saposcol -l. Para
pararlo saposcol -k.
-
Any problems??? logon as sidadm,
saposcol
(or saposcol -l)
if
this doesn´t work (e.g error no connection etc)
try
to stop saposcol: saposcol -k
check
status: saposcol -s
if
there is some memory remaining the easiest way is:
(saposcol -k
saposcol -d (interactive mode)
collector> leave (removes shared memory segment, is like with ipcrm -m,
but you don´t have to take care not to delete the wrong segment,
the segment of saposcol is the one with owner root:sapsys)
collector> quit
(with
"help" you get some more nice options!)
start
collector afterwards: saposcol -l
to
get some more info look at tracefiles in the working directory
and on /usr/sap/tmp/dev_coll
-
Find files bigger than 1 mega find . -xdev -size +1000000c -exec ll
-d {} \;|more
-
Find a string within files find . -exec grep -l 420 {} \
Principio