segunda-feira, 20 de dezembro de 2010

Vírus que oculta e cria atalhos das pastas no pendriver.

Vírus que oculta e cria atalhos das pastas no pendriver, como acessar novamente os arquivos e pastas.

É bem simples vamos deletar os vírus que estejam no pendriver, um bom antivírus resolve, mas caso o antivírus não consiga limpar, basta procurar no penddriver por arquivos com extensão exe, e se não for um programa seu pode deletar.

Vamos aos passos.

Vamos criar um arquivo em lote para desocultar de uma só vez todos os arquivo e pastas.

@ECHO ON

REM "Esta é a letra de sua unidade pendriver conectado. Troque para letrar que sua unidade for detectada pelo Windows"
SET PENDRIV=E:

CD %PENDRIV%

REM "Deletar todos os links que foram criados pelo vírus"
DEL /S /Q /F "*.LNK"

REM "Cria a lista de arquivos e pastas do pendriver"
DIR /B /A %PENDRIV% > %TEMP%\A.A

REM "Ler os arquivo de lista e desculta"
FOR /F %%I IN (%TEMP%\A.A) DO %WINDIR%\SYSTEM32\ATTRIB.EXE -S -H "%PENDRIV"%%I"

Obs: Se a pasta tiver acento ou nomes separados vai ser necessários renomear.

Dica como deletar todos os arquivos temporários das pastas temp de "Documents end settings" de usuários

Vamos criar um arquivo em LOTE.

Crie um arquivo e coloque o nome LimpTemp.bat. Edit este arquivo e adicione as informações abaixo.

@echo on

CD C:

DIR /B C:\DOCUM~1 > C:\A.A

REM "Arquivos criados temporariamente"
FOR /F %%I IN (C:\A.A) DO RD /S /Q "C:\DOCUME~1\%%I CONFIG~1\TEMP\."

REM "Limpeza de cache de Internet"
FOR /F %%I IN (C:\A.A) DO RD /S /Q "C:\DOCUME~1\%%I CONFIG~1\TEMPOR~1\."


Este pequeno programinha ira limpar os temporários de todos os perfies que um dia logaram nesta maquina.
Para um ambiente de rede onde varias pessoas acessa a mesma maquina é ótimo para fazer limpeza.

quinta-feira, 16 de dezembro de 2010

Todos devem assistir esse vídeo ao menos uma vez!!!

E nós reclamamos da vida quando as coisas estão difíceis.


http://www.youtube.com/watch?v=gf3R_6KDf00


Jesus nós AMA!!!

segunda-feira, 13 de dezembro de 2010

AIX Command 4.3 e 5.2


------------------------------------------------------------------------
TITLE : AIX Command 4.3 e 5.2
OS LEVEL : AIX
VERSION : 2.0
------------------------------------------------------------------------







-
------------------------------------------------------------------------
MISCELLENEOUS
------------------------------------------------------------------------

compress -c file.txt > file.Z Create a compressed file.

uuencode (infile) (extract-file-name) > (output file)
Converts a binary file to an ASCII file for transfer by modem or email

uudecode (encoded file)
Extracts a binary file from encoded file and calls it the extract-file-name

examples :-)

uuencode maymap maymap > maymap.enc
uudecode maymap.enc

od -c /tmp Displays contents of the /tmp directory file
ls -i Lists files with their inode numbers
echo * Lists files, can be used if ls is corrupt/missing

chtz (timezone eg GMT0BST) Changes the timezone in /etc/environment file
chlang (language eg En_GB) Changes the language in /etc/environment file

ar -v -t (archive file) List contents of an archive
ar -v -x (archive file) Extracts the archive
ar -v -t /usr/lib/libC-r.a Lists contents of the libC_r.a library

find /source -print | cpio -pdm /target
Copying directories using cpio, creates /target/source directory.

dump -nTv (binary executable) Displays the contents of an executable file

dump -c Displays string information
dump -o Displays object file headers
dump -l Displays line numbers
dump -s Displays the text section

snap -ao /dev/rmt0 Create a snapshot onto tape
snap -ad (directory) Create a snapshot into a named directory other
than the default (/tmp/ibmsupt)

/usr/dt/bin/dtconfig -d Disables desktop logins
/usr/dt/bin/dtconfig -e Enables desktop logins
/var/dt/Xpid PID of the dtlogin process

--------------------------------------------------------------------------------
LICENSES / SOFTWARE INSTALLATION
--------------------------------------------------------------------------------


lslicense Displays number of current user licenses
chlicense -u (number) Changes the number of user licenses
( ftp,rexec and rsh (without -i flag) do not need an AIX user license to be
able to access the system. )

lscfg ----------------------------> Lista de Configuração do AIX e da RS6K
lscfg -vp | grep -p Platform ----> Lista de Platform Firmware
uname -Mu ------------------------> Lista Versão e Type of Machine IBM,7038-6M2 IBM,01102D68F
uname -a ------------------------> Lista Versão IBM

oslevel Returns operating system level

4 . 3 . 3 . 0 <--------- --------------------------------------------------------------------------------="--------------------------------------------------------------------------------" -----="-----" -1="-1" -a="-a" -ad="-ad" -c="-c" -cc="-cc" -d="-d" -ehl="-ehl" -f="-f" -ha="-ha" -i="-i" -ik="-ik" -k="-k" -l="-l" -ld="-ld" -net="-net" -o="-o" -p="-p" -pad="-pad" -q="-q" -rn="-rn" -s="-s" -t="-t" -u="-u" -w="-w" -x="-x" 0="0" 194.35.52.1="194.35.52.1" 194.60.89.0="194.60.89.0" 194.60.90.4="194.60.90.4" 195.60.60.1="195.60.60.1" 1="1" 255.255.255.0="255.255.255.0" 2="2" 3="3" 4.2="4.2" 4.3.3.0="4.3.3.0" 4330-02_aix_ml="4330-02_aix_ml" 4="4" 5="5" 6="6" 7="7" :-=":-" a="a" adapter="adapter" add="add" address="address" adds="adds" after="after" against="against" aix="aix" alias="alias" all="all" alt="alt" alt_disk_install="alt_disk_install" and="and" apply="apply" are="are" as="as" assistant="assistant" at="at" ativa="ativa" attribute="route" available="available" backspace="backspace" be="be" belongs="belongs" bin="bin" blv="blv" blvset="blvset" bosinst="bosinst" bundle="bundle" by="by" cancel="cancel" card="card" cd0="cd0" cdrom="cdrom" change="change" changes="changes" chcons="chcons" chdev="chdev" chdisp="chdisp" check="check" checks="checks" checksums="checksums" cleans="cleans" clones="clones" comando="comando" commit="commit" compiled.="compiled." console="console" correct="correct" create="create" cuat="cuat" current="current" da="da" database="database" de="de" default="default" defined="defined" delete="delete" deletes="deletes" destination="destination" detach="detach" dev="dev" device="device" directory="directory" disables="disables" disk="disk" display="display" displays="displays" do="do" does="does" done="done" down="down" downlevel="downlevel" eg="eg" elease="elease" en0="en0" ent0="ent0" ent1="ent1" ent3="ent3" entry="entry" entstat:="entstat:" entstat="entstat" erase="erase" ersion="ersion" es="es" etc="etc" ethernet="ethernet" example:-="example:-" executable="executable" file="file" files.="files." files="files" fileset="fileset" filesets="filesets" fix="fix" for="for" from="from" full="full" gateway="gateway" getty="getty" grep="grep" hdisk0="hdisk0" hdisk1="hdisk1" history="history" hopcount="hopcount" host="host" hostname="hostname" hosts="hosts" i="i" id="id" identifying="identifying" if="if" ifconfig="ifconfig" in="in" inet0="inet0" inet="inet" inetd.conf="inetd.conf" inetd="inetd" info="info" information="information" inittab="inittab" inst.images="inst.images" install="install" install_assist="install_assist" installation.="installation." installation="installation" installed="installed" installing.="installing." installp="installp" installs="installs" instfix="instfix" inted.conf="inted.conf" interface="interface" interfaces="interfaces" interrupted="interrupted" into="into" ip="ip" is.="is." is="is" ix38794="ix38794" ix66617="ix66617" key="key" kill="kill" level="level" lft="lft" lib="lib" like="like" line="line" links="links" list="list" lists="lists" lo0="lo0" login="enable" loopback="loopback" lost="lost" lpp="lpp" lppchk="lppchk" lsattr="lsattr" lscons="lscons" lsdev="lsdev" lsdisp="lsdisp" lslpp="lslpp" m="m" maintenance="maintenance" migration="migration" mirror="mirror" mirroring="mirroring" missing="missing" mkdev="mkdev" ml="ml" more="more" name="inet0" needed="needed" net="net" netmask="netmask" network="network" networks="networks" next="next" no="no" not="not" number="number" o="o" odification="odification" odm.="odm." odm="odm" odmget="odmget" of="of" off="off" on.="on." on="on" onto="onto" op="op" option="option" or="or" oslevel="oslevel" other="other" packages="packages" pad="pad" path="path" pdisable="pdisable" penable="penable" permanently="permanently" pid="pid" placa="placa" pode="pode" port="port" portmir="portmir" ports="ports" premature="premature" preventive="preventive" preview="preview" program="program" prompt="prompt" pty="pty" reboot.="reboot." reboot="reboot" rede="rede" refresh="refresh" remove="remove" removes="removes" reports="reports" resets="resets" resolves="resolves" returms="returms" returns="returns" rmt0="rmt0" rootvg="rootvg" route="route" routes="routes" rs232="rs232" run="run" running="running" s="s" sa2="sa2" sbin="sbin" seguintes="seguintes" sends="sends" set="set" sets="sets" settings="settings" setup="setup" share="share" sleep="sleep" smit="smit" smitty="smitty" software="software" starts="starts" state="up" statistics="statistics" status="status" string="string" stty="stty" subsystem="subsystem" support="support" survives="survives" swapon="swapon" swvpd="swvpd" symbolic="symbolic" sys.bundles="sys.bundles" sys="sys" table="table" tamb="tamb" term="vt100" termdef="termdef" terminal="terminal" terminals="terminals" terminfo="terminfo" termtype="termtype" testar="testar" that="that" the="the" to="to" tty0="tty0" tty1="tty1" tty="tty" ttys="ttys" turns="turns" type="type" until="until" up="up" update="update" used="used" usr="usr" utilizando="utilizando" version.="version." version="version" vg="vg" vi="vi" voc="voc" vs="vs" vt100="vt100" wakes="wakes" what="what" when="when" whence="whence" whereis="whereis" will="will" with="with" wyse50="wyse50" x11.base="x11.base"> Versão 5.2


Você também pode testar o status da rede utilizando as seguintes opções de comando netstat:
netstat -i Displays interface statistics
# netstat -C
O flag -C mostra as informações da tabela de roteamento. Assegure-se de que a informação de seu gateway esteja correta.
# netstat -D
O flag -D mostra o número de pacotes recebidos, transmitidos e eliminados no subsistema de comunicações. Assegure-se de que o dispositivo de rede esteja enviando e recebendo informações de pacotes.

arp -a Displays ip to mac address table from arp cache

no -a Displays network options use -o to set individual options or
-d to set individual options to default.
no -o option=value (this value is reset at reboot)
no -o "ipforwarding=1"

traceroute (name or ipaddress) Displays all the hops from source to
destination supplied.

ping -R (hostname or ipaddress) Same as traceroute except repeats.
spray (hostname or ipaddress) Send a stream of packets to a host

stopsrc -g tcpip Stops all running TCP/IP daemons
/etc/tcp.clean Stops all running TCP/IP daemons and removes all
lock files
/etc/rc.tcpip Start all TCP/IP daemons.
Do not use startsrc -g tcpip as this will start all
TCP/IP daemons including routed & gated

tcpdump Teste portas do TCP/UDP no AIX exmplos
tcpdump -I dst port 21 ----> Testa porta do FTP
tcpdump -I dst port 23 ----> Testa porta do TELNET
tcpdump -I dst port 80 ----> Testa porta do WWW ----- > Testa independente do demon ativo
tcpdump -i -n en1 ----> Testa todas as portas

--------------------------------------------------------------------------------
N.F.S.
--------------------------------------------------------------------------------

exportfs Lists all exported filesystems

exportfs -a Exports all fs's in /etc/exports file

exportfs -u (filesystem) Un-exports a filesystem

mknfs Configures and starts NFS services

rmnfs Stops and un-configures NFS services

mknfsexp -d /directory Creates an NFS export directory

mknfsmnt Creates an NFS mount directory

mount hostname:/filesystem /mount-point Mount an NFS filesystem

nfso -a Display NFS Options
nfso -o option=value Set an NFS Option
nfso -o nfs_use_reserved_port=1

--------------------------------------------------------------------------------
BACKUPS
--------------------------------------------------------------------------------

MKSYSB
------

mkszfile -f Creates /image.data file (4.x onwards)
mkszfile -X Creates /fs.size file (3.x)

mksysb -i (device of file) Creates a mksysb image

mksysb does not save any raw data and will not backup a filesystem that
is not mounted.

SAVEVG
------

savevg -if (device or file) (vg) Creates a savevg image

restvg -q -f (device or file) Restore from a savevg image
Ensure that the restvg command is run from /

mkvgdata (vg) Creates new vgname.data file

CPIO ARCHIVE
------------

find (filesystem) -print | cpio -ocv > (filename or device)

eg find ./usr/ -print | cpio -ocv > /dev/rmt0

CPIO RESTORE
------------

cpio -ict < (filename or device) | more Lists archive cpio -icdv < (filename or device) cpio -icdv < (filename or device) ("files or directories to restore") eg cpio -icdv < /dev/rmt0 "tcpip/*" Restore directory and contents cpio -icdv < /dev/rmt0 "*resolve.conf" Restore a named file TAR ARCHIVE ----------- lsdev -Cc tape ----------------------------> Lista unidade de Fita
tctl -f /dev/rmt0.5 fsf 1 -----------------> Posiciona a Fita nos Blocos Determinados 1 2 3 depois da
tar -vtf /dev/rmt0.5 > Fita0.5.log -----------------> Grava o Log da Fita do Blocos Determinados 1 2 3
tar -vtf /dev/rmt0 --------------------------------> Lista unidade de Fita
tctl -f /dev/rmt0 rewind --------------------------------> Volta a Fita para o inicio
Observação quando tiver no arquivo tar:
diretorio/>tar xfv /dev/rmt0.5 . ./oracledata --------------> Extrai os arquivos para dentro do diretorio local.
./oracle/data --------------> Pode ser restaurar de qualquer canto
/oracle/data --------------> Deve ser restaurado apartir do Diretorio
#/diretorio/tar cvf /dev/rmt0 . -------------------> Apaga a Fita e faz do Diretorio Raiz.
#/diretorio/tar xvf /dev/rmt0.5 . -------------------> Restora a Fita para o Diretorio Raiz (onde vc esta)
. Sempre da o PWD para saber em que diretorio se encontra.

Exemplo:
/fechamento/tar xfv /dev/rmt0.5 . --->Restora tudo abaixo do fechamento.

tar -cvf (filename or device) ("files or directories to archive")
eg tar -cvf /dev/rmt0 "/usr/*"

TAR RESTORE
-----------

tar -tvf (filename or device) Lists archive
tar -xvf (filename or device) Restore all
tar -xvf (filename or device) ("files or directories to restore")
use -p option for restoring with orginal permissions

eg tar -xvf /dev/rmt0 "tcpip" Restore directory and contents
tar -xvf /dev/rmt0 "tcpip/resolve.conf" Restore a named file

AIX ARCHIVE
-----------

find (filesystem) -print | backup -iqvf (filename or device)
Backup by filename.

eg find /usr/ -print | backup -iqvf /dev/rmt0

backup -(backup level 0 to 9) -f (filename or device) ("filesystem")
Backup by inode.

eg backup -0 -f /dev/rmt0 "/usr" -u option updates /etc/dumpdates file

AIX RESTORE
-----------

restore -qTvf (filename or device) Lists archive

restore -qvxf (filename or device) Restores all
restore -qvxf (filename or device) ("files or directories to restore")
(use -d for restore directories)

restore -qvxf /dev/rmt0.1 "./etc/passwd" Restore /etc/passwd file

restore -s4 -qTvf /dev/rmt0.1 Lists contents of a mksysb tape


BACKUPS ACROSS A NETWORK
------------------------

To run the backup on a local machine (cpio) and backup on the remote
machine's (remhost) tape drive (/dev/rmt0)

find /data -print | cpio -ocv | dd obs=32k | rsh remhost \
"dd ibs=32k obs=64k of=/dev/rmt0"

To restore/read the backup (cpio) on the remote machine

dd ibs=64k if=/dev/rmt0 | cpio -icvt

To restore/read the backup (cpio) on the local machine from the remote
machine's (remhost) tape drive (/dev/rmt0)

rsh remhost "dd ibs=64k obs=32k if=/dev/rmt0" | dd ibs=32k \
| cpio -icvt

To run the backup (cpio) on a remote machine (remhost) and backup to
the local machines tape drive (/dev/rmt0)

rsh remhost "find /data -print | cpio -ocv | dd ibs=32k" \
| dd ibs=32k obs=64k of=/dev/rmt0

tar cBf - . | rsh remhost "dd ibs=512 obs=512 of=/dev/rmt0"
Same as above but using tar instead of cpio.

--------------------------------------------------------------------------------
Copying diskettes and tape
--------------------------------------------------------------------------------

COPYING DISKETTES
-----------------

dd if=/dev/fd0 of=(filename) bs=36b
dd if=(filename) of=/dev/fd0 bs=36b conv=sync or flcopy


COPYING TAPES
-------------

dd if=/dev/rmt0 of=(filename)
dd if=(filename) of=/dev/rmt0 or tcopy

--------------------------------------------------------------------------------
VI Commands
--------------------------------------------------------------------------------

:g/xxx/s//yyy/ global change where xxx is to be changed by yyy

sed 's(ctrl v ctrl m)g//g' old.filename > new.filename
Strips out ^M characters from ascii files that have been transferred as binary.
To enter crontrol characters type ctrl v then ctrl ? where ? is whatever
ctrl character you need.

--------------------------------------------------------------------------------
DEVICES
--------------------------------------------------------------------------------

lscfg lists all installed devices
lscfg -v lists all installed devices in detail
lscfg -vl (device name) lists device details

bootinfo -b reports last device the system booted from
bootinfo -k reports keyswitch position
1=secure, 2=service, 3=normal

bootinfo -r reports amount of memory (/ by 1024)
bootinfo -s (disk device) reports size of disk drive
bootinfo -T reports type of machine
ie rspc,rs6ksmp,rspc or chrp

lsattr -El sys0 -a realmem reports amount of useable memory

mknod (device) c (major no) (minor no) Creates a /dev/ device file.
mknod /dev/null1 c 2 3
lsdev -Cc tape Lista o Tipo de Unidade de Fita
lsdev -C lists all customised devices ie installed
lsdev -P lists all pre-defined devices ie supported
lsdev -(C or P) -c (class) -t (type) -s (subtype)

chdev -l (device) -a (attribute)=(new value) Change a device attribute
chdev -l sys0 -a maxuproc=80

lsattr -EH -l (device) -D Lists the defaults in the pre-defined db
lsattr -EH -l sys0 -a modelname

rmdev -l (device) Change device state from available to defined
rmdev -l (device) -d Delete the device
rmdev -l (device) -SR S stops device, R unconfigures child devices

lsresource -l (device) Displays bus resource attributes of a device.

cfgmgr Configures devices
cfgmgr -i /dev/cd0 Configure devices and install drivers from /dev/cd0
if required
cfgmgr -S Run in serial, used with a larger number of disks
cfgmgr -l scsi0 Configure devices on adapter scsi0 only

diag Run hardware diagnostic menu
smitty diag Run hardware diagnostic menu
( 7020-40P and 7248-43P machines cannot run diagnostics, use diagnostics
in the SMS menus instead )

diag -d (device) Run diagnostics against a device.

lsslot Displays all hot swap slots
lsslot -c pci Lists all pci hot swap slots
lsslot -c pci -a Lists all available pci hot swap slots

drslot Reconfgiures PCI hot-plug slots
drslot -i -c pci -s U0.1-P1-I3 Display a slot, flashes the LED next to
the slot so that it can be identified.

Power Management (PCI machines)
-------------------------------

pmctrl -a Displays the Power Management state

rmdev -l pmc0 Unconfigure Power Management
mkdev -l pmc0 Configure Power Management

--------------------------------------------------------------------------------
TAPE DRIVES
--------------------------------------------------------------------------------

rmt0.x where x = A + B + C

A = density 0 = high 4 = low
B = retension 0 = no 2 = yes
C = rewind 0 = yes 1 = no

tctl -f (tape device) fsf (No) Skips forward (No) tape markers
tctl -f (tape device) bsf (No) Skips back (No) tape markers
tctl -f (tape device) rewind Rewind the tape
tctl -f (tape device) offline Eject the tape
tctl -f (tape device) status Show status of tape drive

chdev -l rmt0 -a block_size=512 changes block size to 512 bytes
(4mm = 1024, 8mm = variable but
1024 recommended)
dd if=/dev/rmt0 bs=128k count=1 | wc -c
Displays the block size of an unknow tape. Set block size to 0 first.

bootinfo -e answer of 1 = machine can boot from a tape drive
answer of 0 = machine CANNOT boot from tape drive

diag -c -d (tape device) Hardware reset a tape drive.
diag -c -d rmt0

tapechk (No of files) Checks Number of files on tape.

< /dev/rmt0 Rewinds the tape !!! -------------------------------------------------------------------------------- PRINTERS / PRINT QUEUES -------------------------------------------------------------------------------- splp (device) Displays/changes printer driver settings splp /dev/lp0 export $LPDEST="pqname" Set default printer queue for login session lsvirprt Lists/changes virtual printer attributes. lsallq Displays all queues rmvirprt -q queuename -d queuedevice Removes a virtual printer qpri -#(job No) -a(new priority) Change a queue job priority. qhld -#(job No) Put a hold on hold qhld -r #(job No) Release a held job qchk -A Status of jobs in queues lpstat lpstat -p(queue) Status of jobs in a named queue qcan -x (job No) Cancel a job from a queue cancel (job No) enq -U -P(queue) Enable a queue enable (queue) enq -D -P(queue) Disable a queue disable (queue) qmov -m(new queue) -#(job No) Move a job to another queue startsrc -s qdaemon Start qdaemon sub-system lssrc -s qdaemon List status of qdaemon sub-system stop -s qdaemon Stop qdaemon sub-system (Impressora presa EMPEC no AIX) albbcsr14-253-ROOT/>lpstat -vps_alnbc33 -----------------> Verificar Fila EMPEC
albbcsr14-253-ROOT/>checa + fila -----------------> Verificar Fila EMPEC
albbcsr14-253-ROOT/>enq -x161 -Pps_alnbc33 -------------> Limpa fila de impressao
albbcsr14-253-ROOT/>enq -xNumerojob -Pfiladeimpressao -------------> Limpa fila de impressao po job
albbcsr14-253-ROOT/>enq -Xtodosjobs -Pfiladeimpressao -------------> Limpa todos os da jobs fila de impressao po job


--------------------------------------------------------------------------------
FILE SYSTEMS
--------------------------------------------------------------------------------

Physical Volumes (PV's)
-----------------------

lspv Lists all physical volumes (hard disks)
lspv (pv) Lists the physical volume details
lspv -l (pv) Lists the logical volumes on the physical volume
lspv -p (pv) Lists the physical partition usage for that PV
lspv -M (pv) Lists the PP allocation table for that PV.

If the PV state is "missing" but the disk is okay, use "varyonvg vg" to change
the state of the PV to "active".

chdev -l (pv) -a pv=yes Makes a new hdisk a pysical volume.

chpv -v r (pv) Removes a disk from the system.
chpv -v a (pv) Adds the removed disk back into the system.
chpv -a y (pv) Changes pv allocatable state to YES
chpv -a n (pv) Changes pv allocatable state to NO

migratepv (old pv) (new pv) Moves all LV's from one PV to another PV, both
PV's must be in the same volume group.

Migratepv cannot migrate striped logical volumes, use cplv and rmlv.

replacepv (old pv) (new pv) (4.3.3 onwards)


Volume Groups (VG's)
--------------------

lsvg Lists all volume groups
lsvg (vg) Lists the volume group details
lsvg -l (vg) Lists all logical volumes in the volume group
lsvg -p (vg) Lists all physical volumes in the volume group
lsvg -o Lists all varied on volume groups

varyonvg (vg) Vary On a volume group
varyonvg -f (vg) Forces the varyon process
varyonvg -s (vg) Vary on a VG in maintenance mode. LV commands can be
used on VG, but LV,s cannot be opened for I/O.
varyoffvg (vg) Vary Off a volume group

synclvodm (vg) Tries to resync VGDA, LV control blocks and ODM.
synclvodm -v (vg) Rebuilds the LVCB.
(the vg needs to be varied on before running synclvodm)


mkvg -y(vg) -s(PP size) (pv) Create a volume group
mkvg -y datavg -s 4 hdisk1

reducevg (vg) (pv) Removes a volume group
reducevg -d (vg) (pv) Removes a volume group and delete all LV's on the PV
reducevg (vg) (PVID) Removes the PVID disk reference from the VGDA when a
disk has vanished without the reducevg (vg) (pv)
command being run first.
reducevg -df (vg) (pv) Deletes all LV's from the VG and removes the VG
from the disk. If the last disk in the VG then
the VG is deleted.

extendvg (vg) (new pv) Adds another PV into a VG.

exportvg (vg) Exports the volume group, removes the VG entries and
removes all FS entries from /etc/filesystems but
leaves the mount points.

Note : Cannot export a VG if it has active paging space, turn off paging,
reboot before exporting VG. Exporting removes entries from filesystems
file but does not remove the mount points.

chvg -a y (vg) Auto Vary On a volume group at system start.
chvg -u (vg) Unlocks a locked volume group.

lqueryvg -Atp (pv) Details volume group info for the hard disk.

importvg -y (vg name) (pv) Import a volume group from a disk.
importvg (pv) Same as above but VG will be called vg00 etc.

4.3 onwards, importvg will automatically varyon the VG.

chvg -Q (y/n) (vg name) Turns on/off Quorum checking on a VG.

reorgvg (vg) (lv) Reorganised a fragmented LV, must state an LV at the
command line else the first LV in the VG is picked.
Does not reorg the PP's of striped LV's.



Logical Volumes (LV's)
----------------------

lslv (lv) Lists the logical volume details
lslv -l (lv) Lists the physical volume which the LV is on
lsattr -EHl (lv) Displays more logical volume details

mklv (vg) (No of PP's) (pv Name optional) Create a logical volume
mklv -y (lv) (PP's) (pv name optional) Creates a named logical volume
( use -t jfs2 when creating an LV for a JFS2 filesystem )


chlv -n (new lv) (old lv) Rename a logical volume
chlv -x (number) (lv) Change max no of PP's
chlv -s n (lv) Turns of strickness on the LV
extendlv (lv) (extra No of PP's) Increase the size of an LV
rmlv (lv) Remove a logical volume

cplv -v (vg to copy to) -y (new lv) (lv) Copy an LV to a new LV

If copying a filesystem LV, umount the filesystem before copying, otherwise you
will have to fsck the the new LV before the filesystem can be mounted.
If copying a striped LV to an LV that is already created, and the stripe
size is different ( or not even striped ), then these new parameters are
maintained when the data is copied to the new LV.

cplv -e (new lv) (old lv) Copy to an existing LV
( new lv must have type as copy use chlv -t copy (new lv) to change )

mklv/extendlv -a = PP alocation policy
-am = middle -ac = center -ae = edge
-aie = inner edge -aim = inner middle

migratepv -l (lv) (old pv) (new pv)
Move a logical volume between physical volumes. Both physical volumes
must be in the same volume group !

mklv -y (lv) -t jfslog (vg) (No of PP's) (pv Name optional)
Creates a JFSlog logical volume.

logform (/dev/lv) Initialises an LV for use as an JFSlog

getlvcb -AT (lv) Displays Logical Volume Control Block information

File Systems (FS's)
-------------------

lsfs Lists all filesystems
lsfs -q (fs) Lists the file system details
lsjfs Displays data about all filesystems in CSV style format

mount Lists all the mounted filesystems
mount (fs or lv) Mounts a named filesystem
mount -a Mounts all filesystems
mount all

mount -r -v cdrfs /dev/cd0 /cdrom mounts cd0 drive over /cdrom

crfs -v jfs -d(lv) -m(mount point) -A yes
Will create a file system on the whole of the logical volume, adds entry into
/etc/filesystems and will create mount point directory if it does not exist.
( use -v jfs2 for JFS2 filesystems )

crfs -v jfs -g(vg) -m(mount point) -a size=(size of fs) -A yes
Will create a logical volume on the volume group and create the file system on
the logical volume. All at the size stated. Will add entry into
/etc/filesystems and will create the mount point directory if it does not exist.

Use attribute "-a log=/dev/log01" to specify a jfslog devices
Use attrubute "-a bf=true" for a large file enabled filesystem

chfs -A yes (fs) Change file system to Auto mount in
/etc/filesystems
chfs -a size=(new fs size)(fs) Change file system size
chfs -m (new-mount-point) (fs) Change the file system mount point.

rmfs (fs) Removes the file system and will also remove the
LV if there are no onther file systems on it.

defrag -q (fs) Reports the fragment status of the file system.
defragfs -r (fs) Runs in report only defrag mode (no action).
defragfs (fs) Defragments a file system.

fsck (fs) Verify a file system, the file system must be unmounted!
fsck (-y or -n) (fs) Pre-answer questions either yes or no !
fsck -p (fs) Will restore primary superblock from backup copy if the
superblock is corrupt.
( or dd count=1 bs=4k skip=31 seek=1 if=/dev/lv00 of=/dev/lv00 )

Mirroring
---------

mklv -y (lv) -c(copies 2 or 3) (vg) (No of PP's) (PV Name optional)
Creates a mirrored named logical volume.

mklvcopy -s n (lv) (copies 2 or 3) (pv)
Creates a copy of a logical volume onto another physical volume. The physical
volume MUST be in the same volume group as the orginal logical volume !

rmlvcopy (lv) (copies 1 or 2) Removes logical volume copies.
rmlvcopy (lv) (copies 1 or 2) (pv) From this pv only!

syncvg -p (pv) Synchronize logical partion copies
syncvg -l (lv)
syncvg -v (vg)

mirrorvg (vg) (pv)
Mirrors the all the logical volumes in a volume group onto a new physical
volume. New physical volume must already be part of the volume group.

chfs -a splitcopy=/backup -a copy=2 /data1
Splits off a copy of a 3 way mirror and mount read only for use as an
offline backup.

--------------------------------------------------------------------------------
BOOT LOGICAL VOLUME (BLV) / PROCESSORS / KERNEL
--------------------------------------------------------------------------------

Mirroring does not work with the BLV as it is not a true logical volume,
bosboot must be run against the other disk after mirroring the rootvg.

bootlist -m (normal or service) -o displays bootlist
bootlist -m (normal or service) (list of devices) change bootlist

bootinfo -b Identifies the bootable disk
bootinfo -t Specifies type of boot

bosboot -a -d (/dev/pv) Creates a complete boot image on a physical volume.

mkboot -c -d (/dev/pv) Zero's out the boot records on the physical volume.

savebase -d (/dev/pv) Saves customised ODM info onto the boot device.

lslv -m hd5 Find out which disk the BLV is on.

bootinfo -y Displays which kernel can be used, 32 or 64 bit

genkex Reports all loaded kernel extensions.

lsdev -Cc processor Lists all processors
lsattr -EHl proc0 Displays attributes of processor 0. AIX 5.1L will
display processor clock frequency.

--------------------------------------------------------------------------------
SYSTEM DUMP
--------------------------------------------------------------------------------

1, AIX 4.2.1 and greater supports system dump to paging space.
2, AIX 4.3.3 and greater supports system dump to mirrored paging space.
3, Primary dump device must be in the rootvg
4, Secondary dump device can be outside rootvg unless it is a paging device.

sysdumpdev -l Lists current dump destination.
sysdumpdev -e Estimates dumpsize of the current system in bytes.
sysdumpdev -L Displays information about the previous dump.

sysdumpstart -p Starts a dump and writes to the primary dump device.
sysdumpstart -s Starts a dump and writes to the secondary dump device.

(MCA machine can also dump if key is in service position and the reset
button is pressed)

sysdumpdev -p (dump device) -P Sets the default dump device, permanently

Analyse dump file :-
echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0

snap -gfkD -o /dev/rmt0 Copy dump to tape to send to IBM support, uses tar.

--------------------------------------------------------------------------------
PAGING SPACE (PS's)
--------------------------------------------------------------------------------

lsps -a Lists out all paging space
lsps -s Displays total paging and total useage
lsps (ps)

swappon /dev/ps Activates a paging device eg /dev/paging00
swappoff /dev/ps Deactivates a paging device ( AIX 5.x only )

mkps -s(No of PP's) -n -a (vg)
mkps -s(No of PP's) -n -a (vg) (pv)
-n = don't activate/swapon now -a = activate/swapon at reboot

mklv -b n -t paging -y hd6 (vg) (No of PP's) (pv)
Creates paging space using the mklv command.

chps -a n (ps) Turns off paging space.
chps -s(No of PP's) (ps) Increases paging space.
chps -d(No of PP's) (ps) Decreases paging space ( AIX 5.x only )

chlv -n (new name) (old name) Change paging space name

rmps (ps) Remove paging space. PS must have been turned off
and then the system rebooted before it can be removed.

Note : Need to change the swapon entry in /sbin/rc.boot script if you are
changing the default paging space from /dev/hd6. You also need to
do a "bosboot -a -d /dev/hdiskx" before the reboot.

/etc/swapspaces File that lists all paging space devices that are
activated/swapon during reboot.

--------------------------------------------------------------------------------
SCHEDULING
--------------------------------------------------------------------------------

crontab -l List out crontab entrys
crontab -e Edit crontab entrys
crontab -l > (filename) Output crontab entrys to a file
crontab (filename) Enter a crontab from a file
crontab -r Removes all crontab entrys
crontab -v Displays crontab submission time.

/var/adm/cron/cron.allow File containing users allowed crontab use.
/var/adm/cron/cron.deny File containing users denied crontab use.
/var/adm/cron/crontab Directory containing users crontab entries.
/var/adm/cron/log Cron log file.

at (now + 2 minutes, 13:05, etc) {return} Schedule a job using at
Command or schell script {return}
{CTRL D}

echo "shutdown -Fr" | at now + 1 minute

at -l
atq Lists out jobs scheduled to run via at command

at -r (at job No)
atrm (at job No) Removes an at job scheduled to run.

/var/adm/cron/at.allow File containing users allowed at use.
/var/adm/cron/at.deny File containing users denied at use.
/var/adm/cron/atjobs Directory containing users at entries.

--------------------------------------------------------------------------------
SECURITY
--------------------------------------------------------------------------------

nulladm /var/adm/wtmp To recreate/clear down the wtmp file.

groups Lists out the groups that the user is a member of
setgroups Shows user and process groups

chmod abcd (filename) Changes files/directory permissions

Where a is (4 SUID) + (2 SGID) + (1 SVTX)
b is (4 read) + (2 write) + (1 execute) permissions for owner
c is (4 read) + (2 write) + (1 execute) permissions for group
d is (4 read) + (2 write) + (1 execute) permissions for others


-rwxrwxrwx -rwxrwxrwx -rwxrwxrwx
||| ||| |||
- - -
| | |
Owner Group Others

-rwSrwxrwx = SUID -rwxrwSrwx = SGID drwxrwxrwt = SVTX


chown (new owner) (filename) Changes file/directory owners
chgrp (new group) (filename) Changes file/directory groups

chown (new owner).(new group) (filename) Do both !!!

umask Displays umask settings
umask abc Changes users umask settings

where ( 7 - a = new file read permissions)
( 7 - b = new file write permissions)
( 7 - c = new file execute permissions)

eg umask 022 = new file permissions of 755 = read write and execute for owner
read ----- and execute for group
read ----- and execute for other

mrgpwd > file.txt Creates a standard password file in file.txt

passwd Change current user password

pwdadm (username) Change a users password

pwdck -t ALL Verifies the correctness of local authentication

lsgroup ALL Lists all groups on the system
mkgroup (new group) Creates a group
chgroup (attribute) (group) Change a group attribute
rmgroup (group) Removes a group

--------------------------------------------------------------------------------
USERS / ENVIRONMENT
--------------------------------------------------------------------------------

Logins Edit /etc/security/login.cfg and append "/usr/local/bin/tcsh" to the "shells=" line near the bottom. Also change "maxlogins = 2" to "maxlogins = 32000" (or whatever you're licensed for).

motd -------------------------->Authorized users only. Actual or attempted unauthorized use of this
computer system may result in criminal and/or civil prosecution or
University disciplinary action. We reserve the right to view, monitor,
and record activity on this system without notice or permission. Any
information obtained by monitoring, reviewing, or recording is subject
to review by release to law enforcement organizations in connection
with the investigation or prosecution of possible criminal
unauthorized activity on the system in accordance with Federal law,
State statute and University policy. If you are not an authorized user
of this system, exit the system at this time.

passwd -f Change current users gecos (user description)
passwd -s Change current users shell

chfn (username) Changes users gecos
chsh (username) (shell) Changes users shell

env Displays values of environment variables
printenv

id Displays current user's uid and gid details
id (user) Displays user uid and gid details

whoami Displays current user details
who am i (or who -m)

who Displays details of all users currently logged in.
w
who -b Displays system reboot time

uptime Displays number of users logged in, time since last
reboot, and the machine load averages.

lsuser ALL Lists all users details
lsuser (username) Lists details for user
lsuser -a(attribute) (username or ALL) Lists user attributes
lsuser -a home ALL

mkuser -a(attributes) (newuser) Add a new user

chuser (attributes) (user) Change a user
chuser login=false (user) Lock a user account

rmuser -p (user) Removes a user and all entries in security files

usrck -t ALL Checks all the user entires are okay.

fuser -u (logical volume) Displays processes using the files in that LV
fuser -k /dev/lv02 Will send a kill signal to all processes using
/dev/lv02

lsattr -D -l sys0 -a maxuproc Displays max number of processes per user
chdev -l sys0 -a maxuproc=(number) Changes max number of processes per user

chlang (language) Changes the language settings for system or user.
En_GB = PC850 code pages
en_GB = ISO8859 code pages (Great Britain)
C = posix

su - (user) Switch to new user and change to the new users environment.
su (user) Switch to new user, current environment is propated to the
new shell.

--------------------------------------------------------------------------------
REMOTE USERS
--------------------------------------------------------------------------------

ruser -a -f (user) Adds entry into /etc/ftpusers file
ruser -a -p (host) Adds entry into /etc/host.lpd file
ruser -a -r (host) Adds entry into /etc/hosts.equiv file

ruser -d -f (user) Deletes entry in /etc/ftpusers file
ruser -d -p (host) Deletes entry in /etc/host.lpd file
ruser -d -r (host) Deletes entry in /etc/hosts.equiv file

ruser -s -F Shows all entries in /etc/ftpusers file
ruser -s -P Shows all entries in /etc/host.lpd file
ruser -s -R Shows all entries in /etc/hosts.equiv file

ruser -X -F Deletes all entries in /etc/ftpusers file
ruser -X -P Deletes all entries in /etc/host.lpd file
ruser -X -R Deletes all entries in /etc/hosts.equiv file

--------------------------------------------------------------------------------
INITTAB
--------------------------------------------------------------------------------

telinit S Switches to single user mode.
telinit 2 Switches to multi user mode.
telinit q Re-examines /etc/inittab

lsitab -a Lists all entries in inittab
lsitab (ident eg tty1) Lists the tty1 entry in inittab

mkitab ("details") Creates a new inittab entry
chitab ("details") Ammends an existing inittab entry

rmitab (ident eg tty1) Removes an inittab entry.

chitab "tty1:2:respawn:/usr/bin/getty /dev/tty1"

--------------------------------------------------------------------------------
ODM
--------------------------------------------------------------------------------

odmget -q "name=lp1" CuDv |more Gets lp1 info from pre-defined database.

odmget -q "name-lp1" CuAt |more Gets lp1 info from customised database.

odmdelete -o CuAt -q "name=lp1" Deletes lp1 info from customised db.

odmget -q "name=lp1" CuAt > lp1.CuAt Export ODM info to text file.
odmadd lp1.CuAt Import ODM info from text file.

odmshow CuAt Displays fields and record structures of CuAt

odmchange
odmdrop

--------------------------------------------------------------------------------
ERROR LOGGING / LOGS
--------------------------------------------------------------------------------

/usr/lib/errdemon -l Displays errorlog attributes.
/usr/lib/errdemon Starts error logging.
/usr/lib/errstop Stops error logging.

errpt Displays summary errorlog report.
errpt -a Displays detailed errorlog report.
errpt -j (identifier) Displays singe errorlog report.

Note : errorlog classes are H=Hardware S=Software O=Information V=Undetermined

errclear (days) Deletes all error classes in the errorlog.
errclear -d (class) (days) Deletes all error class entries in errlog.

Note : The errclear command will delete all entries older than the numbers of
days specified in the days paramenter. To delete ALL entries used 0.

errlogger "message up to 230 chrs"
Enters an operator notifaction message into the errorlog.

alog -L Lists all logs define in the alog db

alog -o -t (type) Display contents of log (type)
alog -o -t boot

cat /tmp/boot.log | alot -q -t (type) Copies contects of a file to a log

riscj50252-ROOT/var/tmp>>snmpd.log ---------------- Zera arquivos de Logs no Var
riscj50252-ROOT/var/ras>>diag.log ---------------- Zera arquivos de Logs no Var
^---- sinal de Mior + arquivos de log para zerar

--------------------------------------------------------------------------------
PERFORMANCE MONITORING / TUNING
--------------------------------------------------------------------------------

vmstat (drive) (interval) (count) Reports virtual memory statistics.
vmstat hdisk0 5 20

vmstat -s Diplays number of paging events since system start.
vmstat -f Diplays number of forks since system start.
vmstat -i Diplays number of interupts by device since system start.

iostat (drive) (interval) (count) Reports i/o and cpu statistics.
iostat hdisk0 5 20
iostat 1 20
iostat -d (drive) (interval) (count) Limits report to drive statistics.
iostat -t (interval) (count) Limits report to tty statistics.

sar -u -P ALL 10 10 Displays %usr %sys %wio %idle for all processors
sar -d 1 10
sar -u 1 10


/usr/samples/kernel/vmtune Displays "Virtual Memory Manager" settings

--------------------------------------------------------------------------------
DOS DISKETTES
--------------------------------------------------------------------------------

dosdir Reads directory listing of a diskette
dosdir (directory) Reads directory listing of a named directory

dosread -D/dev/fd0 C41.TXT c41.txt Gets C41.TXT from diskette drive fd0

dosread -D/dev/fd0 DIRECTORY/C41.TXT c41.txt
(-D option can be dropped if using fd0)

doswrite -D/dev/fd0 (unixfile) (dosfile) Writes a file to diskette

dosdel (dosfile) Deletes a dos file on diskette

dosformat Formats the diskette

--------------------------------------------------------------------------------
SENDMAIL
--------------------------------------------------------------------------------

sendmail -bi Creates new aliase db from /etc/aliase file.
newaliases

sendmail -bp Displays the contents of the mail queue
mailq

sendmail -q Processe the sendmail queue NOW

sendmail -bt -d0.4 < /dev/null Prints out sendmail version, compile defines and system information refresh -s sendmail Restart sendmail, will re-read /etc/sendmail.cf kill -l (sendmail PID) stopsrc -s sendmail Stops the sendmail daemon startsrc -s sendmail "-bd -q30" Starts the sendmail daemon -------------------------------------------------------------------------------- ESPAÇO EM DISCO NA RISC -------------------------------------------------------------------------------- Risc Albras (Pegou chuva) 1 - Espaço Livre nos Discos: hdisk0 13120 megabytes É A SOMÁTORIA FREE PPs: (13120 megabytes) hdisk1 13184 megabytes hdisk2 0 megabytes hdisk3 32 megabytes ------------------------------------------ Total 26.336 Giga Bytes 2 - Espaço Total nos Discos: hdisk0 34688 megabytes É A SOMÁTORIA TOTAL PPs:(34688 megabytes) hdisk1 34688 megabytes hdisk2 20448 megabytes hdisk3 20448 megabytes --------------------------------------------- Total 110.272 Giga Bytes Comandos: # lspv ------> Volumes Fisicos

hdisk0 0002d68fbd134e86 rootvg active
hdisk1 0002d68fc132a242 rootvg active
hdisk2 0002d68f7741fc4b mkvg active
hdisk3 0002d68f7741fe98 mkvg active
hdisk4 0002d68f774200f8 mkvg active

# lspv hdisk0 -------> Descrição dos Discos
PHYSICAL VOLUME: hdisk0 VOLUME GROUP: rootvg
PV IDENTIFIER: 0002d68fbd134e86 VG IDENTIFIER 0002d68f00004c00000000fcbd45b97a
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 64 megabyte(s) LOGICAL VOLUMES: 14
TOTAL PPs: 542 (34688 megabytes) VG DESCRIPTORS: 2
FREE PPs: 205 (13120 megabytes) HOT SPARE: no
USED PPs: 337 (21568 megabytes)
FREE DISTRIBUTION: 28..62..00..06..109
USED DISTRIBUTION: 81..46..108..102..00


# lspv hdisk1
PHYSICAL VOLUME: hdisk1 VOLUME GROUP: rootvg
PV IDENTIFIER: 0002d68fc132a242 VG IDENTIFIER 0002d68f00004c00000000fcbd45b97a
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 64 megabyte(s) LOGICAL VOLUMES: 13
TOTAL PPs: 542 (34688 megabytes) VG DESCRIPTORS: 1
FREE PPs: 206 (13184 megabytes) HOT SPARE: no
USED PPs: 336 (21504 megabytes)
FREE DISTRIBUTION: 97..00..00..00..109
USED DISTRIBUTION: 12..108..108..108..00


# lspv hdisk2
PHYSICAL VOLUME: hdisk2 VOLUME GROUP: mkvg
PV IDENTIFIER: 0002d68f7741fc4b VG IDENTIFIER 0002d68f00004c00000000fe77421a93
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 32 megabyte(s) LOGICAL VOLUMES: 2
TOTAL PPs: 639 (20448 megabytes) VG DESCRIPTORS: 1
FREE PPs: 0 (0 megabytes) HOT SPARE: no
USED PPs: 639 (20448 megabytes)
FREE DISTRIBUTION: 00..00..00..00..00
USED DISTRIBUTION: 128..128..127..128..128


# lspv hdisk3
PHYSICAL VOLUME: hdisk3 VOLUME GROUP: mkvg
PV IDENTIFIER: 0002d68f7741fe98 VG IDENTIFIER 0002d68f00004c00000000fe77421a93
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 32 megabyte(s) LOGICAL VOLUMES: 1
TOTAL PPs: 639 (20448 megabytes) VG DESCRIPTORS: 1
FREE PPs: 1 (32 megabytes) HOT SPARE: no
USED PPs: 638 (20416 megabytes)
FREE DISTRIBUTION: 00..00..00..00..01
USED DISTRIBUTION: 128..128..127..128..127

----------------------------------------------------------------------------------
Limpeza do MK
Tarzar para uma outra area e limpar.
Probelma de Impressão no MK é espaço em disco
/var/adm/logs...
/Var/spool/qdaemon/files.print Fazer verificação c/ Aurino
----------------------------------------------------------------------------------


Exporte da 172.28.1.253

Arquivo Export:
albbcsr14-253-ROOT/>cat /etc/exports
/oracle/empaca -root=albbcsr17,access=albbcsr17

SMIT NFS

Change Attributes of an Exported Directory

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

[Entry Fields]
* PATHNAME of Directory to Export /oracle/empaca
* MODE to export directory read-write +
HOSTS & NETGROUPS allowed client access [albbcsr17]
Anonymous UID [-2]
HOSTS allowed root access [albbcsr17]
HOSTNAME list. If exported read-mostly []
Use SECURE OPTION? no +
Public filesystem? no +
* CHANGE export now, system restart or both both +
PATHNAME of alternate Exports file []


Exporte da 172.28.1.251

albbcsr17-251-ROOT/>cat /etc/exports
/fechamento

SMIT
Change Attributes of an Exported Directory

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

[Entry Fields]
* PATHNAME of Directory to Export /fechamento
* MODE to export directory read-write +
HOSTS & NETGROUPS allowed client access []
Anonymous UID [-2]
HOSTS allowed root access []
HOSTNAME list. If exported read-mostly []
Use SECURE OPTION? no +
Public filesystem? no +
* CHANGE export now, system restart or both both +
PATHNAME of alternate Exports file []


----------------------------------------------------------------------------------

Backup do Fechamento --- Todo Mes
Fazer backup do direório da 172.28.1.251 para uma fita e Reter para qualquer
problema
OBS: Usuar

/fechamento/tar cvf /dev/rmt0 .

Reter Fita

Depois Limpar os direotrios: (Para poder sobrar espaço no filesystem)
/fechamento/arch
/fechamento/dbf

Canivete Suíço do Shell (bash)

1. Operadores

Operadores Aritméticos
Operadores Relacionais
+ Adição
== Igual
- Subtração
!= Diferente
* Multiplicação
> Maior
/ Divisão
>= Maior ou Igual
% Módulo
< Menor
** Exponenciação
<= Menor ou Igual
Operadores de Atribuição
Operadores de BIT
= Atribui valor a uma variável
<< Deslocamento à esquerda
+= Incrementa a variável por uma constante
>> Deslocamento à direita
-= Decrementa a variável por uma constante
& E de bit (AND)
*= Multiplica a variável por uma constante
| OU de bit (OR)
/= Divide a variável por uma constante
^ OU exclusivo de bit (XOR)
%= Resto da divisão por uma constante
~ Negação de bit
++ Incrementa em 1 o valor da variável
! NÃO de bit (NOT)
-- Decrementa em 1 o valor da variável

Operadores Lógicos
Operadores de BIT (atribuição)
&& E lógico (AND)
<<= Deslocamento à esquerda
|| OU lógico (OR)
>>= Deslocamento à direita



&= E de bit



|= OU de bit



^= OU exclusivo de bit

2. Redirecionamento

Operador Ação
< Redireciona a entrada padrão (STDIN)
> Redireciona a saída padrão (STDOUT)
2> Redireciona a saída de erro (STDERR)
>> Redireciona a saída padrão, anexando
2>> Redireciona a saída de erro, anexando
| Conecta a saída padrão com a entrada padrão de outro comando
2>&1 Conecta a saída de erro na saída padrão
>&2 Conecta a saída padrão na saída de erro
>&- Fecha a saída padrão
2>&- Fecha a saída de erro
3<>arq Conecta o descritor de arquivos 3 ao arquivo 'arq'
< Alimenta a entrada padrão (Here Document)
<<-FIM Alimenta a entrada padrão, cortando TABs
<(cmd) A saída do comando 'cmd' é um arquivo: diff <(cmd1) <(cmd2)
>(cmd) A entrada do comando 'cmd' é um arquivo: tar cf >(bzip2 -c >file.tbz) $dir

3. Variáveis especiais

Variável Parâmetros Posicionais
$0 Parâmetro número 0 (nome do comando ou função)
$1 Parâmetro número 1 (da linha de comando ou função)
... Parâmetro número N ...
$9 Parâmetro número 9 (da linha de comando ou função)
${10} Parâmetro número 10 (da linha de comando ou função)
... Parâmetro número NN ...
$# Número total de parâmetros da linha de comando ou função
$* Todos os parâmetros, como uma string única
$@ Todos os parâmetros, como várias strings protegidas
Variável Miscelânia
$$ Número PID do processo atual (do próprio script)
$! Número PID do último job em segundo plano
$_ Último argumento do último comando executado
$? Código de retorno do último comando executado

4. Expansão de variáveis

Sintaxe Expansão Condicional
${var:-texto} Se var não está definida, retorna 'texto'
${var:=texto} Se var não está definida, defina-a com 'texto'
${var:?texto} Se var não está definida, retorna o erro 'texto'
${var:+texto} Se var está definida, retorna 'texto', senão retorna o vazio
Sintaxe Expansão de Strings
${var} É o mesmo que $var, porém não ambíguo
${#var} Retorna o tamanho da string
${!var} Executa o conteúdo de $var (igual 'eval \$$var')
${!texto*} Retorna os nomes de variáveis começadas por 'texto'
${var:N} Retorna o texto à partir da posição 'N'
${var:N:tam} Retorna 'tam' caracteres à partir da posição 'N'
${var#texto} Corta 'texto' do início da string
${var##texto} Corta 'texto' do início da string (* guloso)
${var%texto} Corta 'texto' do final da string
${var%%texto} Corta 'texto' do final da string (* guloso)
${var/texto/novo} Substitui 'texto' por 'novo', uma vez
${var//texto/novo} Substitui 'texto' por 'novo', sempre
${var/#texto/novo} Se a string começar com 'texto', substitui 'texto' por 'novo'
${var/%texto/novo} Se a string terminar com 'texto', substitui 'texto' por 'novo'

5. Blocos e agrupamentos

Sintaxe Descrição Exemplo
"..." Protege uma string, mas reconhece $, \ e ` como especiais "abc"
'...' Protege uma string completamente (nenhum caractere é especial) 'abc'
$'...' Protege uma string completamente, mas interpreta \n, \t, \a, etc $'abc\n'
`...` Executa comandos numa subshell, retornando o resultado `ls`
{...} Agrupa comandos em um bloco { ls ; }
(...) Executa comandos numa subshell ( ls )
$(...) Executa comandos numa subshell, retornando o resultado $( ls )
((...)) Testa uma operação aritmética, retornando 0 ou 1 ((5 > 3))
$((...)) Retorna o resultado de uma operação aritmética $((5+3))
[...] Testa uma expressão, retornando 0 ou 1 (alias do comando 'test') [ 5 -gt 3 ]
[[...]] Testa uma expressão, retornando 0 ou 1 (podendo usar && e ||) [[ 5 > 3 ]]

6. if, for, select, while, until, case

if for / select while / until case
if COMANDO for VAR in LISTA while COMANDO case $VAR in
then do do txt1) ... ;;
... ... ... txt2) ... ;;
elif COMANDO done done txtN) ... ;;
then

*) ... ;;
...

esac
else ou:
... for ((exp1;exp2;exp3))
fi


7. Opções do comando test ou [

Testes em arquivos
Testes em variáveis
-b É um dispositivo de bloco


-c É um dispositivo de caractere
Comparação Numérica
-d É um diretório
-lt É menor que (LessThan)
-e O arquivo existe
-gt É maior que (GreaterThan)
-f É um arquivo normal
-le É menor igual (LessEqual)
-g O bit SGID está ativado
-ge É maior igual (GreaterEqual)
-G O grupo do arquivo é o do usuário atual
-eq É igual (EQual)
-k O sticky-bit está ativado
-ne É diferente (NotEqual)
-L O arquivo é um link simbólico


-O O dono do arquivo é o usuário atual
Comparação de Strings
-p O arquivo é um named pipe
= É igual
-r O arquivo tem permissão de leitura
!= É diferente
-s O tamanho do arquivo é maior que zero
-n É não nula
-S O arquivo é um socket
-z É nula
-t O descritor de arquivos N é um terminal


-u O bit SUID está ativado
Operadores Lógicos
-w O arquivo tem permissão de escrita
! NÃO lógico (NOT)
-x O arquivo tem permissão de execução
-a E lógico (AND)
-nt O arquivo é mais recente (NewerThan)
-o OU lógico (OR)
-ot O arquivo é mais antigo (OlderThan)
-ef O arquivo é o mesmo (EqualFile)

8. Escapes especiais para usar no prompt (PS1)

Escape Lembrete Expande para...
\a Alerta Alerta (bipe)
\d Data Data no formato "Dia-da-semana Mês Dia" (Sat Jan 15)
\e Escape Caractere Esc
\h Hostname Nome da máquina sem o domínio (dhcp11)
\H Hostname Nome completo da máquina (dhcp11.empresa)
\j Jobs Número de jobs ativos
\l Tty Nome do terminal corrente (ttyp1)
\n Newline Linha nova
\r Return Retorno de carro
\s Shell Nome do shell (basename $0)
\t Time Horário no formato 24 horas HH:MM:SS
\T Time Horário no formato 12 horas HH:MM:SS
\@ At Horário no formato 12 horas HH:MM am/pm
\A At Horário no formato 24 horas HH:MM
\u Usuário Login do usuário corrente
\v Versão Versão do Bash (2.00)
\V Versão Versão+subversão do Bash (2.00.0)
\w Working Dir Diretório corrente, caminho completo ($PWD)
\W Working Dir Diretório corrente, somente o último (basename $PWD)
\! Histórico Número do comando corrente no histórico
\# Número Número do comando corrente
\$ ID Mostra "#" se for root, "$" se for usuário normal
\nnn Octal Caractere cujo octal é nnn
\\ Backslash Barra invertida \ literal
\[ Escapes Inicia uma seqüência de escapes (tipo códigos de cores)
\] Escapes Termina uma seqüência de escapes

9. Escapes reconhecidos pelo comando echo

Escape Lembrete Descrição
\a Alerta Alerta (bipe)
\b Backspace Caractere Backspace
\c EOS Termina a string
\e Escape Caractere Esc
\f Form feed Alimentação
\n Newline Linha nova
\r Return Retorno de carro
\t Tab Tabulação horizontal
\v Vtab Tabulação vertical
\\ Backslash Barra invertida \ literal
\nnn Octal Caractere cujo octal é nnn
\xnn Hexa Caractere cujo hexadecimal é nn

10. Formatadores do comando date

Formato Descrição
%a Nome do dia da semana abreviado (Dom..Sáb)
%A Nome do dia da semana (Domingo..Sábado)
%b Nome do mês abreviado (Jan..Dez)
%B Nome do mês (Janeiro..Dezembro)
%c Data completa (Sat Nov 04 12:02:33 EST 1989)
%y Ano (dois dígitos)
%Y Ano (quatro dígitos)
%m Mês (01..12)
%d Dia (01..31)
%j Dia do ano (001..366)
%H Horas (00..23)
%M Minutos (00..59)
%S Segundos (00..60)
%s Segundos desde 1º de Janeiro de 1970
%% Um % literal
%t Um TAB
%n Uma quebra de linha

11. Formatadores do comando printf

Formato Descrição
%d Número decimal
%o Número octal
%x Número hexadecimal (a-f)
%X Número hexadecimal (A-F)
%f Número com ponto flutuante
%e Número em notação científica (e+1)
%E Número em notação científica (E+1)
%s String

12. Letras identificadoras de arquivos no comando ls -l

Letra Lembrete Tipos de Arquivo (primeiro caractere)
- - Arquivo normal
d Directory Diretório
l Link Link simbólico
b Block Dispositivo de blocos (HD)
c Char Dispositivo de caracteres (modem serial)
s Socket Socket mapeado em arquivo (comunicação de processos)
p Pipe FIFO ou Named Pipe (comunicação de processos)
Letra Lembrete Permissões do Arquivo (próximos nove caracteres)
- - Permissão desativada
r Read Acesso de leitura
w Write Acesso de escrita
x eXecute Acesso de execução (ou acesso ao diretório)
X eXecute Acesso ao diretório somente
s Set ID Usuário/grupo para execução (SUID, SGID) - permissão 'x' ativada
S Set ID Usuário/grupo para execução (SUID, SGID) - permissão 'x' desativada
t sTicky Usuários só apagam seus próprios arquivos - permissão 'x' ativada
T sTicky Usuários só apagam seus próprios arquivos - permissão 'x' desativada

13. Curingas para nomes de arquivo (glob)

Curinga Casa com... Exemplo
* Qualquer coisa *.txt
? Um caractere qualquer arquivo-??.zip
[...] Qualquer um dos caracteres listados [Aa]rquivo.txt
[^...] Qualquer um caractere, exceto os listados [^A-Z]*.txt
{...} Qualquer um dos textos separados por vírgula arquivo.{txt,html}

14. Curingas para os itens do comando case

Curinga Casa com... Exemplo
* Qualquer coisa *.txt) echo ;;
? Um caractere qualquer arquivo-??.zip) echo ;;
[...] Qualquer um dos caracteres listados [0-9]) echo ;;
[^...] Qualquer um caractere, exceto os listados [^0-9]) echo ;;
...|... Qualquer um dos textos separados por | txt|html) echo ;;

15. Sinais para usar com trap/kill/killall

# Linux Cygwin SystemV AIX HP-UX Solaris BSD/Mac
1 HUP HUP HUP HUP HUP HUP HUP
2 INT INT INT INT INT INT INT
3 QUIT QUIT QUIT QUIT QUIT QUIT QUIT
4 ILL ILL ILL ILL ILL ILL ILL
5 TRAP TRAP TRAP TRAP TRAP TRAP TRAP
6 ABRT ABRT IOT LOST ABRT ABRT ABRT
7 BUS EMT EMT EMT EMT EMT EMT
8 FPE FPE FPE FPE FPE FPE FPE
9 KILL KILL KILL KILL KILL KILL KILL
10 USR1 BUS BUS BUS BUS BUS BUS
11 SEGV SEGV SEGV SEGV SEGV SEGV SEGV
12 USR2 SYS SYS SYS SYS SYS SYS
# Linux Cygwin SystemV AIX HP-UX Solaris BSD/Mac
13 PIPE PIPE PIPE PIPE PIPE PIPE PIPE
14 ALRM ALRM ALRM ALRM ALRM ALRM ALRM
15 TERM TERM TERM TERM TERM TERM TERM
16 - URG USR1 URG USR1 USR1 URG
17 CHLD STOP USR2 STOP USR2 USR2 STOP
18 CONT TSTP CHLD TSTP CHLD CHLD TSTP
19 STOP CONT PWR CONT PWR PWR CONT
20 TSTP CHLD WINCH CHLD VTALRM WINCH CHLD
21 TTIN TTIN URG TTIN PROF URG TTIN
22 TTOU TTOU IO TTOU IO IO TTOU
23 URG IO STOP IO WINCH STOP IO
24 XCPU XCPU TSTP XCPU STOP TSTP XCPU
# Linux Cygwin SystemV AIX HP-UX Solaris BSD/Mac
25 XFSZ XFSZ CONT XFSZ TSTP CONT XFSZ
26 VTALRM VTALRM TTIN - CONT TTIN VTALRM
27 PROF PROF TTOU MSG TTIN TTOU PROF
28 WINCH WINCH VTALRM WINCH TTOU VTALRM WINCH
29 IO LOST PROF PWR URG PROF INFO
30 PWR USR1 XCPU USR1 LOST XCPU USR1
31 SYS USR2 XFSZ USR2 - XFSZ USR2
32 - - - PROF - WAITING -
33 - - - DANGER - LWP -
34 - - - VTALRM - FREEZE -
35 - - - MIGRATE - THAW -
36 - - - PRE - CANCEL -
37 - - - - - LOST -
Como obter a listagem: trap -l, kill -l ou killall -l
Veja também: man 7 signal

16. Códigos de retorno de comandos

Código Significado Exemplo
0 Nenhum erro, execução terminou OK echo
1 A maioria dos erros comuns na execução echo $((1/0))
2 Erro de uso em algum 'builtin' do Shell -
126 Comando não executável (sem permissão) touch a ; ./a
127 Comando não encontrado ("command not found") echooo
128 O parâmetro para o 'exit' não é um decimal exit 1.0
128+n 128 + código do sinal que o matou kill -9 $PPID #exit 137
130 O programa interrompido com o Ctrl+C (128 + 2) -
255 Parâmetro para o 'exit' não está entre 0 e 255 exit -1

17. Códigos de cores (ANSI)

Cor Letra Fundo ## Atributo Valor ## Exemplos: ESC [ ; m
Preto 30 40
Reset 0
ESC[m texto normal (desliga cores)
Vermelho 31 41
Negrito 1
ESC[1m negrito
Verde 32 42
Sublinhado 4
ESC[33;1m amarelo
Amarelo 33 43
Piscando 5
ESC[44;37m fundo azul, letra cinza
Azul 34 44
Reverso 7
ESC[31;5m vermelho piscando
Rosa 35 45



Na linha de comando:
Ciano 36 46



echo -e '\e[33;1m amarelo \e[m'
Branco 37 47



echo -e '\033[33;1m amarelo \033[m'

18. Os metacaracteres das expressões regulares

Meta Nome Descrição
. Ponto Curinga de um caractere
[] Lista Casa qualquer um dos caracteres listados
[^] Lista negada Casa qualquer caractere, exceto os listados
? Opcional A entidade anterior pode aparecer ou não (opcional)
* Asterisco A entidade anterior pode aparecer em qualquer quantidade
+ Mais A entidade anterior deve aparecer no mínimo uma vez
{,} Chaves A entidade anterior deve aparecer na quantidade indicada
^ Circunflexo Casa o começo da linha
$ Cifrão Casa o fim da linha
\b Borda Limita uma palavra (letras, números e sublinhado)
\ Escape Escapa um meta, tirando seu poder
| Ou Indica alternativas (usar com o grupo)
() Grupo Agrupa partes da expressão, é quantificável e multinível
\1 Retrovisor Recupera o conteúdo do grupo 1
\2 Retrovisor Recupera o conteúdo do grupo 2 (segue até o \9)
.* Curinga Casa qualquer coisa, é o tudo e o nada
?? Opcional NG Idem ao opcional comum, mas casa o mínimo possível
*? Asterisco NG Idem ao asterisco comum, mas casa o mínimo possível
+? Mais NG Idem ao mais comum, mas casa o mínimo possível
{}? Chaves NG Idem às chaves comuns, mas casa o mínimo possível

19. Metacaracteres que são diferentes nos aplicativos

Programa Opc Mais Chaves Borda Ou Grupo
awk ? + - - | ()
ed \? \+ \{,\} \b \| \(\)
egrep ? + {,} \b | ()
emacs ? + - \b \| \(\)
expect ? + - - | ()
find ? + - \b \| \(\)
gawk ? + {,} \<\> | ()
grep \? \+ \{,\} \b \| \(\)
mawk ? + - - | ()
perl ? + {,} \b | ()
php ? + {,} \b | ()
python ? + {,} \b | ()
sed \? \+ \{,\} \<\> \| \(\)
vim \= \+ \{,} \<\> \| \(\)

20. Caracteres ASCII imprimíveis (ISO-8859-1) - texto

      $ zzascii

32 64 @ 96 ` 162 ¢ 194 Â 226 â
33 ! 65 A 97 a 163 £ 195 Ã 227 ã
34 " 66 B 98 b 164 ¤ 196 Ä 228 ä
35 # 67 C 99 c 165 ¥ 197 Å 229 å
36 $ 68 D 100 d 166 ¦ 198 Æ 230 æ
37 % 69 E 101 e 167 § 199 Ç 231 ç
38 & 70 F 102 f 168 ¨ 200 È 232 è
39 ' 71 G 103 g 169 © 201 É 233 é
40 ( 72 H 104 h 170 ª 202 Ê 234 ê
41 ) 73 I 105 i 171 « 203 Ë 235 ë
42 * 74 J 106 j 172 ¬ 204 Ì 236 ì
43 + 75 K 107 k 173 205 Í 237 í
44 , 76 L 108 l 174 ® 206 Î 238 î
45 - 77 M 109 m 175 ¯ 207 Ï 239 ï
46 . 78 N 110 n 176 ° 208 Ð 240 ð
47 / 79 O 111 o 177 ± 209 Ñ 241 ñ
48 0 80 P 112 p 178 ² 210 Ò 242 ò
49 1 81 Q 113 q 179 ³ 211 Ó 243 ó
50 2 82 R 114 r 180 ´ 212 Ô 244 ô
51 3 83 S 115 s 181 µ 213 Õ 245 õ
52 4 84 T 116 t 182 ¶ 214 Ö 246 ö
53 5 85 U 117 u 183 · 215 × 247 ÷
54 6 86 V 118 v 184 ¸ 216 Ø 248 ø
55 7 87 W 119 w 185 ¹ 217 Ù 249 ù
56 8 88 X 120 x 186 º 218 Ú 250 ú
57 9 89 Y 121 y 187 » 219 Û 251 û
58 : 90 Z 122 z 188 ¼ 220 Ü 252 ü
59 ; 91 [ 123 { 189 ½ 221 Ý 253 ý
60 < 61 =" 93"> 94 ^ 126 ~ 192 À 224 à
63 ? 95 _ 161 ¡ 193 Á 225 á

21. Códigos prontos para copiar e colar

Condicionais com o IF
if [ -f "$arquivo" ]; then echo 'Arquivo encontrado'; fi
if [ ! -d "$dir" ]; then echo 'Diretório não encontrado'; fi
if [ $i -gt 5 ]; then echo 'Maior que 5'; else echo 'Menor que 5'; fi
if [ $i -ge 5 -a $i -le 10 ]; then echo 'Entre 5 e 10, incluindo'; fi
if [ $i -eq 5 ]; then echo '=5'; elif [ $i -gt 5 ]; then echo '>5'; else echo '<5';>
if [ "$USER" = 'root' ]; then echo 'Oi root'; fi
if grep -qs 'root' /etc/passwd; then echo 'Usuário encontrado'; fi
Condicionais com o E (&&) e OU (||)
[ -f "$arquivo" ] && echo 'Arquivo encontrado'
[ -d "$dir" ] || echo 'Diretório não encontrado'
grep -qs 'root' /etc/passwd && echo 'Usuário encontrado'
cd "$dir" && rm "$arquivo" && touch "$arquivo" && echo 'feito!'
[ "$1" ] && param=$1 || param='valor padrão'
[ "$1" ] && param=${1:-valor padrão}
[ "$1" ] || { echo "Uso: $0 parâmetro" ; exit 1 ; }
Adicionar 1 à variável $i
i=$(expr $i + 1)
i=$((i+1))
let i=i+1
let i+=1
let i++
Loop de 1 à 10
for i in 1 2 3 4 5 6 7 8 9 10; do echo $i; done
for i in $(seq 10); do echo $i; done
for ((i=1;i<=10;i++)); do echo $i; done
i=1 ; while [ $i -le 10 ]; do echo $i ; i=$((i+1)) ; done
i=1 ; until [ $i -gt 10 ]; do echo $i ; i=$((i+1)) ; done
Loop nas linhas de um arquivo ou saída de comando
cat /etc/passwd | while read LINHA; do echo "$LINHA"; done
grep 'root' /etc/passwd | while read LINHA; do echo "$LINHA"; done
while read LINHA; do echo "$LINHA"; done < /etc/passwd
while read LINHA; do echo "$LINHA"; done < <(grep 'root' /etc/passwd)
Curingas nos itens do comando case
case "$dir" in /home/*) echo 'dir dentro do /home';; esac
case "$user" in root|joao|maria) echo "Oi $user";; *) echo "Não te conheço";; esac
case "$var" in ?) echo '1 letra';; ??) echo '2 letras';; ??*) echo 'mais de 2';; esac
case "$i" in [0-9]) echo '1 dígito';; [0-9][0-9]) echo '2 dígitos';; esac
Caixas do Dialog
dialog --calendar 'abc' 0 0 31 12 1999
dialog --checklist 'abc' 0 0 0 item1 'desc1' on item2 'desc2' off
dialog --fselect /tmp 0 0
(echo 50; sleep 2; echo 100) | dialog --gauge 'abc' 8 40 0
dialog --infobox 'abc' 0 0
dialog --inputbox 'abc' 0 0
dialog --passwordbox 'abc' 0 0
dialog --menu 'abc' 0 0 0 item1 'desc1' item2 'desc2'
dialog --msgbox 'abc' 8 40
dialog --radiolist 'abc' 0 0 0 item1 'desc1' on item2 'desc2' off
dialog --tailbox /tmp/arquivo.txt 0 0
dialog --textbox /tmp/arquivo.txt 0 0
dialog --timebox 'abc' 0 0 23 59 00
dialog --yesno 'abc' 0 0
Dica1: dialog ... && echo 'Apertou OK/Yes' || echo 'Apertou Cancel/No'
Dica2: resposta=$(dialog --stdout --TIPODACAIXA 'abc' ...)

22. Atalhos da linha de comando (set -o emacs)

Atalho Descrição Tecla Similar
Ctrl+A Move o cursor para o início da linha Home
Ctrl+B Move o cursor uma posição à esquerda <-
Ctrl+C Envia sinal EOF() para o sistema
Ctrl+D Apaga um caractere à direita Delete
Ctrl+E Move o cursor para o fim da linha End
Ctrl+F Move o cursor uma posição à direita ->
Ctrl+H Apaga um caractere à esquerda Backspace
Ctrl+I Completa arquivos e comandos TAB
Ctrl+J Quebra a linha Enter
Ctrl+K Recorta do cursor até o fim da linha
Ctrl+L Limpa a tela (igual ao comando clear)
Ctrl+N Próximo comando
Ctrl+P Comando anterior
Ctrl+Q Destrava a shell (veja Ctrl+S)
Ctrl+R Procura no histórico de comandos
Ctrl+S Trava a shell (veja Ctrl+Q)
Ctrl+T Troca dois caracteres de lugar
Ctrl+U Recorta a linha inteira
Ctrl+V Insere caractere literal
Ctrl+W Recorta a palavra à esquerda
Ctrl+X Move o cursor para o início/fim da linha (2x) Home/End
Ctrl+Y Cola o trecho recortado

23. A caixa de ferramentas do shelleiro

Comando Função Opções úteis
cat Mostra arquivo -n, -s
cut Extrai campo -d -f, -c
date Mostra data -d, +'...'
diff Compara arquivos -u, -Nr, -i, -w
echo Mostra texto -e, -n
find Encontra arquivos -name, -iname, -type f, -exec, -or
fmt Formata parágrafo -w, -u
grep Encontra texto -i, -v, -r, -qs, -n, -l, -w -x, -A -B -C
head Mostra Início -n, -c
od Mostra Caracteres -a, -c, -o, -x
paste Paraleliza arquivos -d, -s
printf Mostra texto nenhuma
rev Inverte texto nenhuma
sed Edita texto -n, -f, s/isso/aquilo/, p, d, q, N
seq Conta Números -s, -f
sort Ordena texto -n, -f, -r, -k -t, -o
tac Inverte arquivo nenhuma
tail Mostra Final -n, -c, -f
tee Arquiva fluxo -a
tr Transforma texto -d, -s, A-Z a-z
uniq Remove duplicatas -i, -d, -u
wc Conta Letras -c, -w, -l, -L
xargs Gerencia argumentos -n, -i