Distros
Nesse artigo será exibido detalhadamente os processos feito via terminal para a instalação dos programas no sistema operacional
Before Install Distros
- https://help.ubuntu.com/stable/ubuntu-help/bluetooth-device-specific-pairing.html.pt-BR
After Install Distros
GNOME settings
gsettings set org.gnome.desktop.interface clock-show-seconds true
gsettings set org.gnome.desktop.interface clock-show-weekday true
Default Apps
sudo apt-get install \
apt-transport-https \
build-essential \
ca-certificates \
curl \
default-jre \
ffmpeg \
git-flow \
gnome-tweaks \
gnome-shell-extensions \
gnupg \
gnupg2 \
gufw \
jq \
libasound2 \
libbz2-dev \
libcanberra-gtk-module \
libegl1-mesa \
libffi-dev \
libgl1-mesa-glx \
liblzma-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libtk \
libxcomposite1 \
libxcursor1 \
libxi6 \
libxrandr2 \
libxss1 \
libxtst6 \
linux-headers-generic \
linux-tools-generic \
lsb-release \
lzma \
make \
meld \
moreutils \
neofetch \
nmap \
openssh-server \
preload \
shutter \
software-properties-common \
tk \
tk-dev \
tlp \
tmate \
ubuntu-restricted-extras \
virtualbox \
vlc \
wget \
xserver-xephyr \
zlib1g-dev
pyenv
curl https://pyenv.run | bash
pyenv update
pyenv install -list
pyenv install 3.9.19 # 3.9.19, 3.10.14
pyenv versions
pyenv global 3.9.19
pyenv versions
python --version
# uninstall
pyenv uninstall 3.9.19
ls $(pyenv root)/versions/
pyenv versions
pyenv install 3.10.14
# https://pypi.org/
which python
which pip
pyenv versions
python --version
pip3 --version
pip3 check
pip3 list
python3 -m pip --version
python3 -m pip check
python3 -m pip list
# python -m test
# install
pip install python-dotenv
pip install scipy
pip install youtube-dl
pip install pygame
pip3 install notebook # https://github.com/jupyter/notebook
# uninstall
pip uninstall transformers
pip3 list
pip3 check
#pip install git+https://github.com/huggingface/transformers.git
pip install transformers==4.39.1
pip3 list
pip3 check
# https://docs.anaconda.com/free/anaconda/install/index.html
cd ~/Downloads
rm -rf ~/anaconda3
#curl -O https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
sha256sum Anaconda3-2024.02-1-Linux-x86_64.sh
bash ~/Downloads/Anaconda3-2024.02-1-Linux-x86_64.sh
nano ~/.bashrc
source ~/.bashrc
conda --version
conda info
conda list
anaconda-navigator
conda activate my_env
conda uninstall python
conda install python=3.9
conda remove -n barkwebui --all
conda env list
conda env remove --name barkwebui
#
python -c 'import django; print(django.get_version())'
# https://github.com/topics/python
flatpak
# https://flatpak.org/setup/Ubuntu/
sudo apt install \
flatpak \
gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# To complete setup, restart your system
flatpak list
flatpak update
flathub
# https://flathub.org/
flatpak install flathub io.gitlab.jstest_gtk.jstest_gtk
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
Update OS
sudo apt update && sudo apt upgrade # atualiza todas libs ppa
snap refresh --list # lista as libs sem instalá-las
sudo killall snap-store
sudo snap refresh # atualiza todas libs snaps
flatpak list
flatpak update
- https://help.ubuntu.com/stable/ubuntu-help/bluetooth-device-specific-pairing.html.pt-BR
# retroarch
Configurações -> Entrada -> Controle da porta 1 -> Definir todos os controles
Links
- https://rafandroid.com/ventoy-como-criar-um-pen-drive-multibootavel-no-ubuntu-linux/
- https://www.tecmint.com/install-xrdp-on-ubuntu/
- https://deskreen.com/
anydesk
# https://anydesk.com/pt/downloads/thank-you?dv=deb_64
sudo dpkg -i anydesk_6.2.0-1_amd64.deb
sudo apt-get -f install ## Fix: dpkg: problemas com dependências
anydesk
chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
google-chrome --version
apt-cache search --names-only 'google-chrome'
https://chrome.google.com/webstore/detail/cors-unblock/lfhmikememgdcahcdlaciloancbhjino/
https://add0n.com/access-control.html
## Fix Google Chrome Black Screen on Linux OS (Wayland)
# https://askubuntu.com/questions/1407494/screen-share-not-working-in-ubuntu-22-04-in-all-platforms-zoom-teams-google-m
- logging off
- clicking gear icon at bottom right
- selecting "Ubuntu on Xorg"
- logging back in
OR
# https://www.freecodecamp.org/news/how-to-fix-black-screen-on-google-chrome-on-linux-os/
chrome://flags/#enable-webrtc-pipewire-capturer
## enable and restart
docker
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
>> ...
docker 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).
groups
# Add your user to the docker group.
sudo usermod -aG docker $USER
# Log out and log back in so that your group membership is re-evaluated.
# Verify that you can run docker commands without sudo.
docker run hello-world
# more ...
docker info
docker search ubuntu
docker container ls
docker version
docker-compose version
# Install latest docker-compose
sudo apt remove docker-compose
DOCKER_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
echo $DOCKER_COMPOSE_VERSION
sudo curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
# not work rabbit
sudo rm /usr/local/bin/docker-compose
docker-compose --version
# Restart OS
etcher
# https://github.com/balena-io/etcher/releases
uname -m
cd ~/Downloads
wget https://github.com/balena-io/etcher/releases/download/v1.14.3/balena-etcher_1.14.3_amd64.deb
ls
sudo dpkg -i balena-etcher_1.14.3_amd64.deb
sudo apt-get -f install ## Fix: dpkg: problemas com dependências
balena-etcher
batocera
# https://batocera.org/
# https://www.batoceranation.com/downloads/
# https://cdromance.com/scummvm/
wget https://updates.batocera.org/x86_64/stable/last/batocera-x86_64-35-20220917.img.gz
balena-etcher
...
ls -lah /media/marcio/SHARE/
sudo chmod -R 777 /media/marcio/SHARE/
After Install
sudo service ssh start
ip addr show
ssh [email protected]
sudo tlp-stat
ps ax | grep preload
snapcraft
# https://snapcraft.io/docs/installing-snap-on-kali
# https://stackoverflow.com/questions/57121916/the-command-could-not-be-located-because-snap-bin-is-not-included-in-the-path
# https://snapcraft.io/store
snap list
snap version
sudo snap install code --classic
sudo snap install gimp
sudo snap install okular
sudo snap install postman
sudo snap install teleconsole --classic
sudo snap install retroarch
sudo snap install flutter --classic
sudo snap install google-cloud-sdk --classic
sudo snap install heroku --classic
heroku -v
sudo snap install acrordrdc
acrordrdc
sudo snap install chromium
sudo snap install mysql-workbench-community
sudo snap install dbeaver-ce
sudo snap install riseup-vpn --classic
sudo snap install konversation
sudo snap install ksnip
sudo snap install shotcut --classic
sudo snap install glade
sudo snap install squirrelsql
sudo snap install inkscape
sudo snap install blender --classic
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
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
extensions
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>
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/
# https://gitlab.com/-/profile/keys
#
git config --global --list
git config --global credential.helper cache
git config --global user.name "mozgbrasil"
git config --global user.email "[email protected]"
git config --global --list
# 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
# FIX: Error Clone: server certificate verification failed. CAfile: none CRLfile: none
git config --global http.sslVerify false
# 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
# https://tassioauad.com/2018/01/03/how-to-clone-all-branches-on-git/
git config --global alias.clone-branches '! git branch -a | sed -n "/\/HEAD /d; /\/master$/d; /remotes/p;" | xargs -L1 git checkout -t'
Dica:
mkdir -p ~/dados/compartilhado
touch ~/dados/compartilhado/touch.txt
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
Node.js
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.39.5/install.sh | bash
command -v nvm
nvm list
nvm ls-remote
nvm install lts/fermium
nvm install lts/hydrogen
node -v
npm -v
nvm run node --version
npm config list
npm list -g --depth 0
npm install -g @angular/cli
npm install -g @ionic/[email protected]
npm install -g eslint
npm install -g prettier
yarn
# https://classic.yarnpkg.com/en/docs/install#debian-stable
npm install --global yarn
node -v
yarn -v
yarn config list
ls /home/marcio/.nvm/versions/node/v14.20.1/bin/
npm install
# 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 @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>"
android-studio
# Install android-studio
sudo snap install android-studio --classic
android-studio
which java
which android-studio
# Install Java version
sudo apt install openjdk-11-jdk
java -version
# Install Java version
sudo apt install openjdk-17-jdk
java -version
# Set JAVA_HOME
sudo nano /etc/environment
# JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
# JAVA_HOME="/snap/android-studio/127/android-studio/jbr/"
echo $JAVA_HOME
source /etc/environment
export JAVA_HOME
echo $JAVA_HOME
# Switch between different Java versions
update-alternatives --config java
# ANDROID_HOME environment variable
echo '' >> ~/.bashrc
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/.android/avd/Pixel_2_API_30.avd"' >> ~/.bashrc
echo 'export CAPACITOR_ANDROID_STUDIO_PATH="/snap/android-studio/current/android-studio/bin/studio.sh"' >> ~/.bashrc
echo '# Configure the ANDROID_HOME environment variable' >> ~/.bashrc
echo '' >> ~/.bashrc
source ~/.bashrc # load the config into your current shell
nano ~/.bashrc # check
echo $ANDROID_HOME
echo $PATH
#
node --version
ionic --version
ng --version
javac -version
# touch ~/.android/repositories.cfg
sdkmanager --list
sdkmanager --licenses
PPA (Personal Package Archives)
apt-cache search --names-only 'webp' | grep open
sudo apt install pavucontrol # Fix: hdmi sounds - accer notebook
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
mysql-workbench
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
Java
React use java 8
java -version
javac -version
which java
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 -
for i in $(dpkg -l | grep openjdk | awk '{print $2}'); do
echo removing "$i"
sudo apt remove "$i"
echo purging "$i"
sudo apt purge "$i"
echo -------
done
adicionar
echo $JAVA_HOME
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)
https://brew.sh/
/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"
https://facebook.github.io/watchman/docs/install/#installing-on-macos-or-linux-via-homebrew
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
ImageMagick
https://github.com/ImageMagick/ImageMagick/issues/396#issuecomment-602026541
update(s)
npm update --global
gem update --system
Devilbox
http://devilbox.org/
Install
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
127.0.0.1 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_
Update
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
Commands
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
dmesg
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
https://askubuntu.com/questions/818929/login-ssh-with-ppk-file-on-ubuntu-terminal
sudo apt-get install putty-tools
puttygen yourkey.ppk -O private-openssh -o yourkey.pem
chmod 400 yourkey.pem
ssh -i yourkey.pem serverusername@server-ip
Conectar via SFTP pelo nautilus
sftp://[email protected]
###Conectar via Samba pelo nautilus
smb://192.168.0.4
Conectar via ssh pelo terminal
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
Remote
telnet 172.16.238.10 3306 # mysql
telnet 172.16.238.10 5432 # pgsql
telnet localhost 27017 # mongodb
curl --connect-timeout 10 --silent --show-error 0.0.0.0:27017
curl --connect-timeout 10 --silent --show-error 172.19.0.20:27017
Monitorando MySQL
Na necessidade de acessar o MySQL Client e ver os processos
mysql -h '172.16.238.10' -u root -p
show processlist;
ou melhor ainda
mysqladmin -u root -p -i 1 processlist
mysql config
mysql -h '127.0.0.1' -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 '127.0.0.1' -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 $@ {} \;
find /home/marcio/dados/projects/ -not \( -wholename "_.git_" -prune \) -type d -exec echo $@ {} \;
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 {} \;