Skip to content

Instantly share code, notes, and snippets.

@Ruttmann
Last active April 29, 2019 12:51
Show Gist options
  • Save Ruttmann/2c2e04ab81079f681cbfa65a82564ef7 to your computer and use it in GitHub Desktop.
Save Ruttmann/2c2e04ab81079f681cbfa65a82564ef7 to your computer and use it in GitHub Desktop.
Useful Linux commands

Localização Security.xml (senha de database e outras configurações de segurança)

/opt/IBM/WebSphere/Profiles/dmgr/config/cells/ipw2-cell

Local onde ficam os arquivos EAR instalados no servidor (quando pedem pra instalar o EAR de DEV em INT, por exemplo)

PROFILE_HOME/config/cells/CELL_NAME/applications

Limpar arquivos temporários no WAS (quando aplicações não aparece na applications list)

/opt/IBM/WebSphere/Profiles/dmgr/config/cells/ipw2-cell/applications

/opt/IBM/WebSphere/Profiles/dmgr/config/cells/ipw2-cell/cus

/opt/IBM/WebSphere/Profiles/dmgr/config/cells/ipw2-cell/blas

Copiar dados entre servidores

scp [arquivo] EWOE_LXUX_a_wekorte@swoealvpp001:/tmp/Wellington/Vendor_008

Verificar memoria servidores

free -g -t (Observar quanto tem livre em buffers/caches)

Pegar informações da memoria

cat /proc/meminfo

Busca por string dentro de arquivos

Este comando busca dentro dos arquivos da pasta corrente a string TESTE e lista estes arquivos.

find ./* -type f -exec grep -l g3ta.commons.importer.parallel {} \;

find . -name '*.log' -type f -exec grep -H 'OQ_EU_QUERO_PROCURAR' {} \;

Encontra os arquivos em um diretório dependendo da data

find . -newermt $(date +%Y-%m-%d)

Zipar arquivo SystemOut do dia

zip /Pfad_zu_definieren/Log_Datei_$(date +%Y-%m-%d_%H-%M-%S).zip $(find . -name "Sys*" -newermt $(date +%Y-%m-%d))

Remover arquivos anteriores a 30 dias

find . -ctime +30 -exec rm -rf {} \;

Find and replace (substitui todas as ocorrências de foo por bar)

:%s/foo/bar/g

Watch 5 segundos

watch -n 5 '<comando aqui dentro>'

Copia da linha X até linha y de um file e sobrescreve no outro

sed 'X,Yp' file1 > file2

Esse faz append no final

sed 'X,Yp' file1 >> file2

Adicionar usuário no Linux

useradd -d /home/username -m -u 999 -G wasgroup username

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment