Login
main >   ubuntu >  


Install:
https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#2-install-wsl
Windows search powershell
Run as Administrator
wsl --install

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

SSH:
sudo apt install openssh-server
sudo vi /etc/ssh/sshd_config
PasswordAuthentication yes
sudo service ssh stop
sudo service ssh start
ssh localhost

XMing:

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 -)"

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl

pyenv install -l

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

hidden1

hidden2