Nesse artigo será exibido detalhadamente os processos feito via terminal para a instalação dos programas

Ubuntu 20.04

GNOME settings

gsettings set org.gnome.desktop.interface clock-show-seconds true

gsettings set org.gnome.desktop.interface clock-show-weekday true


# https://docs.docker.com/install/linux/docker-ce/ubuntu/

sudo apt-get update

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \

sudo apt-get update

sudo apt install docker-compose docker-ce docker-ce-cli containerd.io

docker version
docker-compose version
docker info

# Fix: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/search?limit=25&term=ubuntu: dial unix /var/run/docker.sock: connect: permission denied

# By default the docker daemon always runs as the root user, therefore you need to prepend sudo to your Docker command(s).


# 1. Create the docker group.

sudo groupadd docker

# 2. Add your user to the docker group.

sudo usermod -aG docker $USER

# 3. Log out and log back in so that your group membership is re-evaluated.

# 4. Verify that you can run docker commands without sudo.

docker run hello-world

# more ...

docker info
docker search ubuntu
docker container ls

after install

sudo apt install \
linux-tools-generic \
software-properties-common \
ubuntu-restricted-extras \
vlc \
meld \
libcanberra-gtk-module \
xserver-xephyr \
openssh-server \
preload \

sudo service ssh start

    ip addr show

    ssh [email protected]

sudo tlp-stat

ps ax | grep preload


wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

sudo dpkg -i google-chrome-stable_current_amd64.deb

## Fix: dpkg: problemas com dependências

sudo apt-get -f install

google-chrome --version





snap list
snap version

sudo snap install chromium

sudo snap install code --classic

Fix: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc

FIX: [nodemon] Internal watch failed: ENOSPC: System limit for number of file watchers reached, watch

cat /proc/sys/fs/inotify/max_user_watches

cat /etc/sysctl.conf

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

cat /etc/sysctl.conf

cat /proc/sys/fs/inotify/max_user_watches


code --list-extensions --show-versions

# OR

# 1 - Launch VS Code
# 2 - Quick Open (Ctrl+P), paste the following command, and press enter.

ext install <extension-id>

echo '# Configure the REACT_EDITOR environment variable' >> ~/.bashrc
echo 'export REACT_EDITOR="code"' >> ~/.bashrc
source ~/.bashrc
nano ~/.bashrc

sudo snap install heroku –classic

heroku -v

git config

# Test SSH authentication

ssh -T [email protected]

ssh -T [email protected]

ssh -T [email protected]

# FIX: [email protected]: Permission denied (publickey)
# Como obter a SSH Key
# cat ~/.ssh/id_rsa.pub
# Como criar a SSH Key
# ssh-keygen -t rsa
# e adicionar em
# https://github.com/settings/keys
# https://bitbucket.org/account/settings/ssh-keys/


git config --global credential.helper cache
git config --global user.name "mozgbrasil"
git config --global user.email "[email protected]"

# FIX: Error: fatal: The remote end hung up unexpectedly, https://confluence.atlassian.com/stashkb/git-push-fails-fatal-the-remote-end-hung-up-unexpectedly-282988530.html

git config --global http.postBuffer 524288000

git config --global --list


git config --local user.name "marcio.amorim"
git config --local user.email "[email protected]"

git config --local --list

# Fix: The git repository at '*' has too many active changes, only a subset of Git features will be enabled.
# https://docs.github.com/en/github/using-git/configuring-git-to-handle-line-endings

git config --global core.autocrlf input


sudo snap install gimp

sudo snap install blender --classic

sudo snap install inkscape

sudo snap install chromium

sudo snap install google-cloud-sdk --classic

sudo snap install riseup-vpn --classic

sudo snap install konversation

sudo snap install keepassxc

sudo snap install ksnip

sudo snap install shotcut --classic

sudo snap install shutter

sudo snap install glade

sudo snap install dbeaver-ce

sudo snap install squirrelsql

sudo snap install android-studio --classic


echo '# Configure the ANDROID_HOME environment variable' >> ~/.bashrc
echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> ~/.bashrc
echo 'export PATH="$PATH:$ANDROID_HOME/emulator"' >> ~/.bashrc
echo 'export PATH="$PATH:$ANDROID_HOME/tools"' >> ~/.bashrc
echo 'export PATH="$PATH:$ANDROID_HOME/tools/bin"' >> ~/.bashrc
echo 'export PATH="$PATH:\$ANDROID_HOME/platform-tools"' >> ~/.bashrc

# echo 'export ANDROID_SDK_ROOT="\$ANDROID_HOME"' >> ~/.bashrc

# echo 'export ANDROID_AVD_HOME="/home/marcio/.android/avd/Pixel_2_API_30.avd"' >> ~/.bashrc

source ~/.bashrc # load the config into your current shell

nano ~/.bashrc # check


echo \$PATH

sudo snap install intellij-idea-community --classic

sudo snap install netbeans --classic

sudo snap install eclipse --classic

sudo snap install rubymine --classic

sudo snap install scrcpy

sudo snap install flutter --classic

sudo snap install flutter-gallery

sudo snap install flokk-contacts

PPA (Personal Package Archives)

apt-cache search --names-only 'webp' | grep open

sudo apt install pavucontrol # Fix: hdmi sounds - accer notebook

sudo apt install \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
curl \
cockpit \
direnv \
ffmpeg \
gconf2 \
git-cola \
git-lfs \
gnome-tweaks \
gnupg-agent \
gnupg2 \
graphviz \
gufw  \
imagemagick \
indicator-cpufreq \
jq \
lame \
libavcodec-extra \
libcanberra-gtk-module \
links \
lynx \
meld \
net-tools \
nmap \
optipng \
p7zip-full \
webp \

which openssh-server || (sudo apt-get install openssh-server -y )

Display live hosts on the network

nmap -sP "$(ip -4 -o route get 1 | cut -d ' ' -f 7)"/24 | grep report | cut -d ' ' -f 5-

DB Visualizer

cd ~/Downloads

wget https://www.dbvis.com/product_download/dbvis-11.0.3/media/dbvis_linux_11_0_3.deb

sudo dpkg -i dbvis_linux_11_0_3.deb


cd ~/Downloads

wget https://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-workbench-community_8.0.20-1ubuntu20.04_amd64.deb

sudo dpkg -i mysql-workbench-community_8.0.20-1ubuntu20.04_amd64.deb

# Fix: dpkg: problemas com dependências

sudo apt-get -f install


Oracle Java 11 e 14


sudo add-apt-repository ppa:linuxuprising/java

sudo apt-get update

Java 8 a 14

sudo apt install openjdk-8-jdk

React use java 8

java -version javac -version which java echo $JAVA_HOME update-alternatives –list java update-alternatives –display java

sudo update-alternatives –config java # Escolha a devida opção

java -version

ls /usr/lib/jvm ls /usr/lib/jvm/java-8-openjdk-amd64/bin

cat /etc/environment

echo $(jrunscript -e ‘java.lang.System.out.println(java.lang.System.getProperty(“java.home”));’)

echo ‘System.out.println(java.lang.System.getProperty(“java.home”));’ jshell -


export JAVA_HOME=”/usr/lib/jvm/java-8-openjdk-amd64/”

export JAVA_HOME=”$(jrunscript -e ‘java.lang.System.out.println(java.lang.System.getProperty(“java.home”));’)”

sudo nano /etc/environment

source /etc/environment

Homebrew - Package Manager for macOS (or Linux)


/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”

echo ‘# Configure the Homebrew environment variable’ » ~/.profile echo ‘eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)’ » ~/.profile

nano ~/.profile

Add Homebrew to your PATH

eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)

- We recommend that you install GCC by running:

brew install gcc

Ainda não executei

For compilers to find [email protected] you may need to set:

export LDFLAGS=”-L/home/linuxbrew/.linuxbrew/opt/[email protected]/lib” export CPPFLAGS=”-I/home/linuxbrew/.linuxbrew/opt/[email protected]/include”

For pkg-config to find [email protected] you may need to set:

export PKG_CONFIG_PATH=”/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/pkgconfig”


brew update brew install watchman

See: https://docs.brew.sh/Homebrew-and-Python

[email protected] is keg-only, which means it was not symlinked into /home/linuxbrew/.linuxbrew, because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH run:

echo ‘export PATH=”/home/linuxbrew/.linuxbrew/opt/[email protected]/bin:$PATH”’ » ~/.profile

For compilers to find [email protected] you may need to set:

export LDFLAGS=”-L/home/linuxbrew/.linuxbrew/opt/[email protected]/lib” export CPPFLAGS=”-I/home/linuxbrew/.linuxbrew/opt/[email protected]/include”

For pkg-config to find [email protected] you may need to set:

export PKG_CONFIG_PATH=”/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/pkgconfig”

watchman –version

brew list




sudo apt update && sudo apt upgrade

flatpak update

sudo snap refresh

npm update –global

gem update –system



which pip pip3 –help pip3 –version

pip3 check pip3 list pip3 help install

python3 -m pip –version python3 -m pip check python3 -m pip list


Após criar uma pasta e compartilhar pelo Nautilus só deve funcionar a autenticação após ser criado o devido usuário no Samba

sudo smbpasswd -a $USER




mkdir -p /home/marcio/dados/containers_docker

cd ~/dados/containers_docker

git clone https://github.com/cytopia/devilbox.git

cd devilbox ls

wget https://gist.githubusercontent.com/mozgbrasil/bce7f1318cc3bc762db4319cc474ee59/raw/e2e0a21588b1d1528f577c8dd1b526edde45aeb1/.env

wget docker-compose.yml https://gist.githubusercontent.com/mozgbrasil/bce7f1318cc3bc762db4319cc474ee59/raw/e2e0a21588b1d1528f577c8dd1b526edde45aeb1/docker-compose.yml

docker-compose up

Virtual Hosts

mkdir -p ~/dados/mount/www/localhost/htdocs/

sudo nano /etc/hosts localhost.loc

cd ~/dados/mount/www/localhost/htdocs/

ln -s /home/marcio/dados/projects

echo “<?php phpinfo(); ?>” > phpinfo.php

cat > .htaccess «- EOF

enable directory browsing

Options +Indexes EOF


cd ~/dados/containers_docker

mkdir tmp mv devilbox tmp/$(date ‘+%Y-%m-%d’)-devilbox

git clone https://github.com/cytopia/devilbox.git

diff –brief –recursive tmp/$(date ‘+%Y-%m-%d’)-devilbox devilbox

meld tmp/$(date ‘+%Y-%m-%d’)-devilbox devilbox


cd ~/dados/containers_docker/devilbox docker-compose down –remove-orphans docker-compose up

docker –version && docker images && docker images -a && docker images ps && docker ps && docker ps -a && docker network ls

docker stats –all

docker stop $(docker ps -a -q) #stop ALL containers

docker rm -f $(docker ps -a -q) # remove ALL containers

sudo netstat -tulpn # To list open ports use the netstat command

service –status-all sudo service mysql stop sudo service apache2 stop sudo service php7.2-fpm stop

git rev-parse HEAD id ls -lah ls -la data/www docker-compose up

./shell.sh # Enter the container cd /shared/httpd/localhost/htdocs/projects/magento2

rm composer.lock mv composer.json composer-bkp.json ls composer create-project –repository=https://repo.magento.com/ magento/project-community-edition magento2 -vvv

Fix: tail: recursos esgotados do inotify, tail: inotify não pôde ser usado; revertendo para sondagem (polling)

cat /proc/sys/fs/inotify/max_user_instances # 128 cat /proc/sys/fs/inotify/max_user_watches # 8192 sudo sysctl -w fs.inotify.max_user_instances=12345 sudo sysctl -w fs.inotify.max_user_watches=640123

Sobre o Ubuntu

Para começar a atualização do Ubuntu do sistema, primeiro precisamos atualizar a lista de índice de pacotes. Abra o terminal e digite:

sudo apt update

Podemos instalar a atualização para todos os pacotes de uma só vez: A forma a seguir vai atualizar todas as versões dos pacotes instalados, sem remover pacotes.

sudo apt upgrade

Tudo feito. Seu sistema Ubuntu agora está totalmente atualizado.

Durante a atualização inicial do sistema, alguns dos pacotes podem se tornar obsoletos e, portanto, não são mais necessários. Para remover todos os pacotes desnecessários, execute:

sudo apt autoremove

Para analise do Kernel


Para analise da Bios

sudo dmidecode -t bios

UFW ( Uncomplicated Firewall ) é um firewall padrão no Ubuntu 18.04 Bionic Beaver Linux.

Por padrão, o UFW está desativado. Você pode verificar o status do seu firewall executando o seguinte comando:

sudo ufw status

Para habilitar a execução do firewall:

sudo ufw enable

Sincronia para espelhar discos

–archive archive mode; equals -rlptgoD (no -H,-A,-X) –update skip files that are newer on the receiver –compress compress file data during the transfer –delete delete extraneous files from destination dirs –verbose increase verbosity –progress show progress during transfer

rsync –archive –update –compress –delete –verbose –progress /home/marcio/Downloads/ /media/marcio/HDD/Downloads/

rsync –archive –update –compress –delete –verbose –progress /home/marcio/dados/ /media/marcio/HDD/dados/

Sincronia entre maquinas locais

rsync –archive –compress –verbose –progress /home/marcio/dados/projects/ [email protected]:/home/marcio/dados/projects/

rsync –archive –compress –verbose –progress /media/marcio/HDJMicron/videos/ [email protected]:/media/marcio/HDD/videos/

rsync -Pav -e “ssh -i $HOME/.ssh/aws-eb” [email protected]:/var/app/current/ /home/marcio/Downloads/070024

Sincronia entre maquinas e dispositivo USB

Será copiado a devida pasta para o diretório

rsync –archive –compress –verbose –progress ~/dados/projects /media/marcio/usb-ext4/dados/

rsync –archive –compress –verbose –progress ~/dados/projects /media/marcio/Expansion\ Drive/MeusBackups/dados/projects-2019-10-07/

rsync -av –progress ~/Imagens /media/marcio/Expansion\ Drive/MeusBackups/backup_inspiron_7520_01052019/ rsync -av –progress ~/Downloads /media/marcio/Expansion\ Drive/MeusBackups/backup_inspiron_7520_01052019/ rsync -av –progress ~/dados /media/marcio/Expansion\ Drive/MeusBackups/backup_inspiron_7520_01052019/

rsync -av –progress /media/marcio/HDJMicron/2020-04-23/marcio-Inspiron-5548/dados/projects /home/marcio/dados/

Download via SCP “Secure Copy”

scp -r [email protected]:/home/marcio/Imagens/ /home/marcio/Imagens/

Upload via SCP “Secure Copy”

scp -r /home/marcio/Downloads/ [email protected]:/home/marcio/Downloads/

Como criar a SSH Key

ssh-keygen -t rsa

Como obter a SSH Key

cat ~/.ssh/id_rsa.pub

Efetuar login no SSH com chave ppk


sudo apt-get install putty-tools

puttygen yourkey.ppk -O private-openssh -o yourkey.pem

chmod 400 yourkey.pem

ssh -i yourkey.pem [email protected]

Conectar via SFTP pelo nautilus

sftp://[email protected]

###Conectar via Samba pelo nautilus


Conectar via ssh pelo terminal

ssh [email protected]

Obter a versão do PHP via terminal

php -r \@phpinfo()\; grep ‘PHP Version’ -m 1
php -i grep ‘PHP Version’ -m 1

Execução comando condicional em linha

sh -c ‘if [ “$TRAVIS_PHP_VERSION” = “5.4” ]   [ “$TRAVIS_PHP_VERSION” = “5.5” ]; then echo ‘0’; else echo ‘1’; fi;’

How to check if php-fpm is running

php-fpm –test php-fpm

ps aux grep php-fpm

netstat -lntp

to see which group the current user belongs to:

groups groups marcio

to list the group members along with their GIDs.

id $USER

Visualizar erros do servidor

No terminal pode ser o comando para a visualização do log de erro do servidor

tail -f /var/log/apache2/error.log


telnet 3306 # mysql

telnet 5432 # pgsql

telnet localhost 27017 # mongodb

curl –connect-timeout 10 –silent –show-error

curl –connect-timeout 10 –silent –show-error

Monitorando MySQL

Na necessidade de acessar o MySQL Client e ver os processos

mysql -h ‘’ -u root -p

show processlist;

ou melhor ainda

mysqladmin -u root -p -i 1 processlist

mysql config

mysql -h ‘’ -P ‘3306’ -u ‘root’ -p’12345’ -e “SHOW GLOBAL VARIABLES LIKE ‘innodb_buffer_pool_size’;”

mysql –help

sudo echo “innodb_buffer_pool_size = 8M” » /etc/mysql/mysql.conf.d/mysqld.cnf

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

cat /etc/mysql/mysql.conf.d/mysqld.cnf

sudo systemctl status mysql sudo systemctl restart mysql

mysql -h ‘’ -P ‘3306’ -u ‘root’ -p’12345’ -e “SHOW GLOBAL VARIABLES LIKE ‘innodb_buffer_pool_size’;”

Recursively fix bad file permissions

A common suggestion is to use which means:

755 for directories: full control for the user, and everyone else can traverse directories.

644 for files: read-write permissions for the user, and read-only for everyone else.

find /home/marcio/dados/projects/ -not ( -wholename “.git” -prune ) -type f -exec echo [email protected] {} \;

find /home/marcio/dados/projects/ -not ( -wholename “.git” -prune ) -type d -exec echo [email protected] {} \;

find /home/marcio/dados/projects/ -not ( -wholename “.git” -prune ) -type f -exec chmod 644 {} \;

find /home/marcio/dados/projects/ -not ( -wholename “.git” -prune ) -type d -exec chmod 755 {} \;

### NVM

# https://github.com/rvm/ubuntu_rvm

sudo apt install software-properties-common libpq-dev git

git --version

After install

rvm info
rvm gemset list

which ruby
ruby --version

ruby -e 'puts Gem.default_dir'

gem --version
gem env
gem list


sudo add-apt-repository ppa:nrbrtx/python2-stuff
sudo apt-get update
sudo apt-get install diffuse


NVM - Node Version Manager

# https://www.npmjs.com/
# https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
# Global Modules without sudo

# https://github.com/nvm-sh/nvm#installing-and-updating

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

command -v nvm
nvm ls

nvm install v12.18.3 # (Latest LTS: Erbium)

nvm run node --version
node -v
npm -v

npm config list
npm list -g --depth 0

ncu --global
npm update --global # --unsafe-perm

npm list --depth 0

npm install -g nodemon
npm install -g gulp
npm install -g create-react-app
npm install -g lerna
npm install -g npm-check-updates
npm install -g eslint
npm install -g prettier
npm install -g @prettier/plugin-php
npm install -g typescript

npm install -g concurrently
npm install -g expo-cli
npm install -g express-generator
npm install -g npm-audit-resolver
npm install -g npm-check
npm install -g pm2
npm install -g react-devtools
npm install -g react-native-cli
npm install -g syncpack
npm install -g ts-node
npm install -g web-ext

npx "<LIBRARY>"


# https://classic.yarnpkg.com/en/docs/install#debian-stable

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update && sudo apt-get install yarn

node -v

yarn -v

yarn config list

yarn config set workspaces-experimental true


# Run Jekyll

cd ~/dados/projects/mozgbrasil.github.io

bundle -v

bundle install

jekyll -v

JEKYLL_ENV=production bundle exec jekyll serve --watch --verbose



sudo apt install \
flatpak \

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

To complete setup, restart your system



flatpak install flathub com.github.huluti.ImCompressor

flatpak install flathub com.github.micahflee.torbrowser-launcher

flatpak install flathub com.obsproject.Studio

flatpak install flathub org.audacityteam.Audacity

flatpak install flathub org.avidemux.Avidemux

flatpak install flathub org.wireshark.Wireshark

sudo usermod -a -G wireshark $USER