Skip to content

Instantly share code, notes, and snippets.

@wilnaweb
Last active August 5, 2026 19:13
Show Gist options
  • Select an option

  • Save wilnaweb/76f2da7d892d38e7ce1285aa8af4e182 to your computer and use it in GitHub Desktop.

Select an option

Save wilnaweb/76f2da7d892d38e7ce1285aa8af4e182 to your computer and use it in GitHub Desktop.
A collection of Bash aliases and utilities for Adobe Experience Manager (AEM) development on Linux, Debian and WSL. Includes AEM startup, Maven shortcuts, Git, Git Submodules, logs, navigation and developer utilities.
###############################################################
#
# AEM Development Toolkit
# Author: Wilson Cavalcante
#
###############################################################
############################
# CONFIGURAÇÃO
############################
export AEM_JAR="aem-author-p4502.jar"
export AEM_PORT=4502
export AEM_DEBUG_PORT=5005
############################
# AEM
############################
aemstart() {
local MEM="${1:-2048}"
local DEBUG="${2:-false}"
local JAVA_OPTS="-Xms${MEM}m -Xmx${MEM}m"
if [ "$DEBUG" = "true" ]; then
JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:${AEM_DEBUG_PORT}"
fi
echo ""
echo "========================================"
echo "Starting AEM"
echo "Heap : ${MEM}MB"
echo "Debug: ${DEBUG}"
echo "========================================"
echo ""
java $JAVA_OPTS -jar $AEM_JAR
}
alias aem='aemstart'
alias aem512='aemstart 512'
alias aem1g='aemstart 1024'
alias aem2g='aemstart 2048'
alias aem4g='aemstart 4096'
alias aemd='aemstart 2048 true'
alias aem512d='aemstart 512 true'
alias aem1gd='aemstart 1024 true'
alias aem2gd='aemstart 2048 true'
alias aem4gd='aemstart 4096 true'
############################
# LOGS
############################
alias log='tail -f crx-quickstart/logs/error.log'
alias logs='tail -300 crx-quickstart/logs/error.log'
alias errors='grep ERROR crx-quickstart/logs/error.log'
alias warn='grep WARN crx-quickstart/logs/error.log'
alias exceptions='grep Exception crx-quickstart/logs/error.log'
############################
# JVM
############################
aeminfo() {
PID=$(jps | grep aem | awk '{print $1}')
if [ -z "$PID" ]; then
echo "AEM não está executando."
return
fi
jcmd $PID VM.info
}
############################
# PROCESSOS
############################
alias psaem='jps -lv'
alias killaem='pkill -f aem'
alias port4502='lsof -i :4502'
alias port5005='lsof -i :5005'
############################
# MAVEN
############################
mvnrun() {
case "$1" in
####################################################
# Desenvolvimento (SEM CLEAN)
####################################################
build)
mvn package
;;
install)
mvn install
;;
deploy)
mvn install -PautoInstallPackage
;;
bundle)
mvn install -PautoInstallBundle
;;
both)
mvn install \
-PautoInstallPackage \
-PautoInstallBundle
;;
publish)
mvn install \
-PautoInstallPackagePublish
;;
skip)
mvn install \
-DskipTests
;;
skipdeploy)
mvn install \
-DskipTests \
-PautoInstallPackage
;;
skipbundle)
mvn install \
-DskipTests \
-PautoInstallBundle
;;
skipboth)
mvn install \
-DskipTests \
-PautoInstallPackage \
-PautoInstallBundle
;;
####################################################
# CLEAN
####################################################
clean)
mvn clean install
;;
cleanbuild)
mvn clean package
;;
cleandeploy)
mvn clean install \
-PautoInstallPackage
;;
cleanbundle)
mvn clean install \
-PautoInstallBundle
;;
cleanboth)
mvn clean install \
-PautoInstallPackage \
-PautoInstallBundle
;;
cleanpublish)
mvn clean install \
-PautoInstallPackagePublish
;;
####################################################
*)
echo ""
echo "============== Maven =============="
echo ""
echo "Desenvolvimento:"
echo " mvnrun build"
echo " mvnrun install"
echo " mvnrun deploy"
echo " mvnrun bundle"
echo " mvnrun both"
echo " mvnrun publish"
echo ""
echo "Skip Tests:"
echo " mvnrun skip"
echo " mvnrun skipdeploy"
echo " mvnrun skipbundle"
echo " mvnrun skipboth"
echo ""
echo "Build Limpo:"
echo " mvnrun clean"
echo " mvnrun cleanbuild"
echo " mvnrun cleandeploy"
echo " mvnrun cleanbundle"
echo " mvnrun cleanboth"
echo " mvnrun cleanpublish"
echo ""
;;
esac
}
############################
# GIT
############################
alias gs='git status'
alias gl='git log --oneline --graph --decorate --all'
alias gp='git pull'
alias gpu='git push'
alias gb='git branch'
alias gco='git checkout'
alias gcb='git checkout -b'
############################
# GIT SUBMODULES
############################
gsubstatus() {
if [ ! -f .gitmodules ]; then
echo "Este repositório não possui submódulos."
return 1
fi
git submodule foreach '
branch=$(git config -f "$toplevel/.gitmodules" submodule.$name.branch)
branch=${branch:-master}
echo
echo "========================================"
echo "Submodule : $name"
echo "Branch : $branch"
echo "Current : $(git rev-parse --abbrev-ref HEAD)"
echo "Commit : $(git rev-parse --short HEAD)"
echo "Remote : $(git remote get-url origin)"
'
}
gsubsync() {
if [ ! -f .gitmodules ]; then
echo "Este repositório não possui submódulos."
return 1
fi
git submodule foreach '
branch=$(git config -f "$toplevel/.gitmodules" submodule.$name.branch)
branch=${branch:-master}
echo
echo "========================================"
echo "Submodule : $name"
echo "Branch : $branch"
old=$(git rev-parse --short HEAD)
echo "Antes : $old"
git fetch --prune origin
current=$(git rev-parse --abbrev-ref HEAD)
if [ "$current" != "$branch" ]; then
git checkout "$branch"
fi
git pull --ff-only origin "$branch"
new=$(git rev-parse --short HEAD)
echo "Depois : $new"
if [ "$old" != "$new" ]; then
echo "Status : Atualizado"
else
echo "Status : Sem alterações"
fi
'
}
gsubinit() {
if [ ! -f .gitmodules ]; then
echo "Este repositório não possui submódulos."
return 1
fi
echo ""
echo "========================================"
echo "Atualizando submódulos..."
echo "========================================"
git submodule sync --recursive
git submodule update --init --recursive --progress
echo ""
echo "Concluído."
}
gsubdiff() {
if [ ! -f .gitmodules ]; then
echo "Este repositório não possui submódulos."
return 1
fi
git submodule foreach '
echo
echo "========================================"
echo "Submodule : $name"
git status --short
current=$(git branch --show-current)
if git show-ref --verify --quiet refs/remotes/origin/$current; then
echo
git log --oneline --decorate HEAD..origin/$current
fi
true
'
}
gsuball() {
if [ ! -f .gitmodules ]; then
echo "Este repositório não possui submódulos."
return 1
fi
git submodule foreach '
branch=$(git config -f "$toplevel/.gitmodules" submodule.$name.branch)
branch=${branch:-master}
git fetch --quiet origin
current=$(git branch --show-current)
commit=$(git rev-parse --short HEAD)
ahead=$(git rev-list --count HEAD..origin/$current 2>/dev/null)
behind=$(git rev-list --count origin/$current..HEAD 2>/dev/null)
if git diff --quiet && git diff --cached --quiet; then
status="Clean"
else
status="Modified"
fi
echo
echo "========================================"
echo "Submodule : $name"
echo "Config : $branch"
echo "Current : $current"
echo "Commit : $commit"
echo "Ahead : ${behind:-0}"
echo "Behind : ${ahead:-0}"
echo "Status : $status"
'
}
############################
# AEM URLs
############################
alias author='openurl http://localhost:4502'
alias crxde='openurl http://localhost:4502/crx/de'
alias felix='openurl http://localhost:4502/system/console'
alias packages='openurl http://localhost:4502/crx/packmgr'
alias users='openurl http://localhost:4502/security/users.html'
alias groups='openurl http://localhost:4502/security/groups.html'
############################
# NAVEGAÇÃO
############################
alias core='cd core'
alias apps='cd ui.apps'
alias content='cd ui.content'
alias config='cd ui.config'
alias frontend='cd ui.frontend'
alias dispatcher='cd dispatcher'
############################
# LIMPEZA
############################
alias cleantarget='find . -name target -exec rm -rf {} +'
alias cleannode='find . -name node_modules -exec rm -rf {} +'
############################
# UTILIDADES
############################
alias ll='ls -lah'
alias cls='clear'
alias mem='free -h'
alias disk='df -h'
alias ports='ss -tulpn'
alias ip='hostname -I'
alias biggest='du -sh * | sort -h'
openurl() {
if command -v explorer.exe >/dev/null 2>&1; then
explorer.exe "$1"
elif command -v xdg-open >/dev/null 2>&1; then
xdg-open "$1"
elif command -v open >/dev/null 2>&1; then
open "$1"
else
echo "Nenhum comando para abrir URLs foi encontrado."
return 1
fi
}
############################
# HELP
############################
aemhelp() {
cat <<EOF
==============================================================
AEM DEVELOPMENT TOOLKIT
==============================================================
AEM
--------------------------------------------------------------
aem Inicia o AEM com 2GB de Heap.
aem512 Inicia o AEM com 512MB de Heap.
aem1g Inicia o AEM com 1GB de Heap.
aem2g Inicia o AEM com 2GB de Heap.
aem4g Inicia o AEM com 4GB de Heap.
aemd Inicia o AEM em modo Debug (2GB).
aem512d Inicia o AEM em modo Debug (512MB).
aem1gd Inicia o AEM em modo Debug (1GB).
aem2gd Inicia o AEM em modo Debug (2GB).
aem4gd Inicia o AEM em modo Debug (4GB).
aeminfo Exibe informações da JVM do AEM.
LOGS
--------------------------------------------------------------
log Acompanha o log em tempo real.
logs Exibe as últimas 300 linhas do log.
errors Filtra mensagens de erro.
warn Filtra mensagens de aviso.
exceptions Filtra exceções.
PROCESSOS
--------------------------------------------------------------
psaem Lista processos Java relacionados ao AEM.
killaem Finaliza o processo do AEM.
port4502 Mostra quem está utilizando a porta 4502.
port5005 Mostra quem está utilizando a porta 5005.
MAVEN
--------------------------------------------------------------
mvnrun build Executa mvn package.
mvnrun install Executa mvn install.
mvnrun deploy Instala o pacote no Author.
mvnrun bundle Instala apenas o Bundle OSGi.
mvnrun both Instala Bundle + Package.
mvnrun publish Instala o Package no Publish.
mvnrun skip Build ignorando testes.
mvnrun skipdeploy Deploy ignorando testes.
mvnrun skipbundle Bundle ignorando testes.
mvnrun skipboth Bundle + Package ignorando testes.
mvnrun clean Clean + Install.
mvnrun cleanbuild Clean + Package.
mvnrun cleandeploy Clean + Deploy no Author.
mvnrun cleanbundle Clean + Bundle.
mvnrun cleanboth Clean + Bundle + Package.
mvnrun cleanpublish Clean + Deploy no Publish.
GIT
--------------------------------------------------------------
gs git status.
gl Histórico resumido do repositório.
gp git pull.
gpu git push.
gb Lista branches.
gco Checkout de branch.
gcb Cria uma nova branch.
SUBMODULES
--------------------------------------------------------------
gsubstatus Exibe a branch, commit atual e repositório remoto de cada submódulo.
gsubsync Faz checkout da branch configurada e atualiza para o último commit do remoto.
gsubinit Inicializa e sincroniza os submódulos com os commits registrados no projeto principal.
gsubdiff Exibe alterações locais e diferenças em relação ao repositório remoto.
gsuball Exibe um diagnóstico completo dos submódulos (branch, commit, status e sincronização).
AEM URLs
--------------------------------------------------------------
author Abre o Author.
crxde Abre o CRX/DE Lite.
felix Abre o Felix Console.
packages Abre o Package Manager.
users Abre o Console de Usuários.
groups Abre o Console de Grupos.
NAVEGAÇÃO
--------------------------------------------------------------
core Entra na pasta core.
apps Entra na pasta ui.apps.
content Entra na pasta ui.content.
config Entra na pasta ui.config.
frontend Entra na pasta ui.frontend.
dispatcher Entra na pasta dispatcher.
UTILIDADES
--------------------------------------------------------------
ll Lista arquivos detalhadamente.
cls Limpa a tela.
mem Exibe uso de memória.
disk Exibe uso de disco.
ports Lista portas abertas.
ip Exibe o IP da máquina.
biggest Lista os maiores diretórios.
LIMPEZA
--------------------------------------------------------------
cleantarget Remove todas as pastas target.
cleannode Remove todos os node_modules.
==============================================================
EOF
}

AEM Development Toolkit

Um conjunto de aliases e funções para facilitar o desenvolvimento com Adobe Experience Manager (AEM) no Linux, Debian e WSL.

O objetivo é reduzir a quantidade de comandos repetitivos do dia a dia, centralizando operações comuns de:

  • Inicialização do AEM
  • Maven
  • Git
  • Git Submodules
  • Logs
  • Navegação entre módulos
  • Utilidades do sistema

Recursos

AEM

  • Inicialização do Author com diferentes tamanhos de Heap
  • Inicialização em modo Debug
  • Informações da JVM
  • Finalização do processo
  • Acesso rápido às URLs do AEM

Maven

Atalhos para:

  • package
  • install
  • deploy
  • bundle
  • publish
  • clean
  • skip tests

Git

Atalhos para os comandos mais utilizados.

Git Submodules

Ferramentas para trabalhar com projetos compostos por múltiplos submódulos.

  • visualizar status
  • sincronizar branches
  • inicializar submódulos
  • visualizar diferenças
  • diagnóstico completo

Logs

Comandos para acompanhar os logs do AEM em tempo real.

Utilidades

Pequenos atalhos úteis durante o desenvolvimento.


Instalação (Debian / Ubuntu / WSL)

1) Baixe o arquivo

Salve o arquivo como:

~/alias_aem

ou clone este Gist.


2) Edite o arquivo

Configure o nome do seu jar do AEM:

export AEM_JAR="aem-author-p4502.jar"

Caso utilize outra porta de debug:

export AEM_DEBUG_PORT=5005

3) Carregue automaticamente no Bash

Abra:

nano ~/.bashrc

No final do arquivo adicione:

source ~/alias_aem

Salve.


4) Recarregue o Bash

source ~/.bashrc

ou simplesmente abra um novo terminal.


Utilização

Para visualizar todos os comandos disponíveis:

aemhelp

Exemplos

Iniciar o AEM

aem

2 GB de Heap.


aem4g

4 GB de Heap.


aemd

Inicia em modo Debug.


Maven

Build

mvnrun build

Deploy

mvnrun deploy

Bundle

mvnrun bundle

Clean

mvnrun clean

Git

gs
gp
gpu
gl

Git Submodules

Visualizar status

gsubstatus

Atualizar para a branch configurada

gsubsync

Inicializar conforme os gitlinks do projeto

gsubinit

Visualizar diferenças

gsubdiff

Diagnóstico completo

gsuball

Logs

Acompanhar o log

log

Últimas linhas

logs

Erros

errors

URLs

Abrir Author

author

CRXDE

crxde

Felix Console

felix

Compatibilidade

Testado em:

  • Debian 13
  • Ubuntu
  • Windows WSL
  • Bash

A função openurl() detecta automaticamente o ambiente e utiliza:

  • explorer.exe (WSL)
  • xdg-open (Linux)
  • open (macOS)

Objetivo

Este toolkit nasceu para simplificar o ambiente de desenvolvimento AEM, concentrando em um único arquivo os comandos utilizados diariamente.

Sinta-se à vontade para adaptar os aliases às necessidades do seu projeto.

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