Skip to content

Instantly share code, notes, and snippets.

@guilhermewop
Last active March 25, 2020 21:04
Show Gist options
  • Save guilhermewop/3821792 to your computer and use it in GitHub Desktop.
Save guilhermewop/3821792 to your computer and use it in GitHub Desktop.
Linux useful commands
#=====================================
# locale
locale-gen pt_BR pt_BR.UTF-8
dpkg-reconfigure locales
#=====================================
# timezone
# change non interactive
timedatectl set-timezone <timeszone>
# current timezone
cat /etc/timezone
# reconfiguring
dpkg-reconfigure --frontend noninteractive tzdata
# timezones list:
ls /usr/share/zoneinfo/*
#=====================================
# user and groups management
# change user id
usermod -u <id> <user>
# change group id
groupmod -g <id> <group>
#=====================================
# reset gnome panels
dconf reset -f /org/gnome/gnome-panel/
#=====================================
# editing files
find . -type f -exec sed -i 's/current/new/g' {} \;
#=====================================
# extracting files
# zip
gunzip filename.zip
# rar
unrar x filename.rar
# tar
tar -xvf filename.tar
# tar.gz
tar -vzxf filename.tar.gz
# bz2
bunzip filename.bz2
# tar.bz2
tar -jxvf filename.tar.bz2
#=====================================
# distro version
cat /etc/*-release
cat /proc/version
lsb_release -a
#=====================================
# troubleshooting
tcpdump -ni any host <ip-origem>
#=====================================
# manage docker as a non-root user
# ref: https://docs.docker.com/install/linux/linux-postinstall/
sudo groupadd docker
sudo usermod -aG docker $USER
#=====================================
# debian vim copy and paste
https://unix.stackexchange.com/questions/318824/vim-cutpaste-not-working-in-stretch-debian-9
#=====================================
# update-alternatives
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
# refs:
# https://gist.github.com/kentblake/6910dd256f989abb41af30a8eeb01237
# https://gist.github.com/patrickmmartin/5b6b2ddecd29d6a1b2ffee2d8eea31ec
# https://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment