Login
main >   ubuntu >  


Aptitude:
sudo apt-get install software-properties-common
sudo apt update
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update

Default editor: sudo update-alternatives --config editor

No sudo password:
sudo visudo
%username ALL=(ALL) NOPASSWD:ALL

Install Python:

sudo add-apt-repository universe
sudo apt install python2
curl https://bootstrap.pypa.io/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py

Bash

Rename files:
https://www.computerhope.com/unix/rename.htm

  • rename 's/test/new/' test.txt
  • rename 's/$/.jpg/' *
  • rename 's/^/cat_/' *

Move 500 jpgs:

  • find . -maxdepth 1 -name "*.jpg" |head -500 |xargs mv -t "../dog_test/"
  • for file in *; do echo mv -- "$file" "$file.jpg"; done

Count directories files:

  • for f in */; do echo "$f -> $(ls $f | wc -l)"; done

Hardware info:

PyENV:
curl https://pyenv.run | bash

 ~/.bashrc
 export PATH="~/.pyenv/bin:$PATH"
 eval "$(pyenv init -)"
 eval "$(pyenv virtualenv-init -)"

pyenv install -l

show versions:
https://gist.github.com/frnhr/dba7261bcb6970cf6121

hidden1

hidden2