Useful

In this page, I save some useful information for instant-access.

My own Ubuntu environment

sudo apt install htop
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda_installer.sh # conda
sudo apt install git -y
# FreeCAD
sudo apt update
sudo apt install ubuntu-desktop  
sudo apt-get install -y fuse libfuse2 # required by some apps
sudo apt install snapd
sudo snap install freecad
# Brave
sudo apt install curl
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt install brave-browser
# inkscape
sudo apt-get install -y inkscape
# paraview
sudo apt-get install paraview
# VSCode
sudo apt install code
# Setting up remote pc
sudo apt install -y tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer dbus-x11
sudo apt install xfce4 xfce4-goodies tasksel
sudo tasksel
sudo update-alternatives --config x-session-manager
sudo snap install -y onlyoffice-desktopeditors
sudo apt install -y libreoffice
# other softwares
cd $HOME
mkdir Applications
cd Applications
# Arduino IDE
wget https://downloads.arduino.cc/arduino-ide/arduino-ide_2.3.4_Linux_64bit.AppImage
chmod +x arduino-ide_2.3.4_Linux_64bit.AppImage
# Ultimaker slicer for 3D printing
wget https://github.com/Ultimaker/Cura/releases/download/5.9.0/UltiMaker-Cura-5.9.0-linux-X64.AppImage
chmod +x UltiMaker-Cura-5.9.0-linux-X64.AppImage
# Zoom
# download deb file from https://zoom.us/download?os=linux
sudo apt-get install libxcb-xtest0 libxcb-cursor0
sudo dpkg -i zoom_amd64.deb

Making a Linux server machine

First, we need to install ssh:

sudo apt install openssh-server -y
sudo systemctl enable ssh
sudo systemctl start ssh

then check if it is running

sudo systemctl status ssh

Now we need to allow ssh through firewall:

sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status

For adding user

First add the user

sudo adduser --disabled-password user1

then run

sudo passwd user1

It will ask you a password, set something. Each commend will ask for user info, press enter for optional fields like phone number, office no etc.

Now we want users to setup their own password:

sudo chage -d 0 user1

Now, go to ssh config file and allow this user for access:

sudo nano /etc/ssh/sshd_config

Then add this line at the bottom:

AllowUsers user1

Then restart ssh to apply changes:

sudo systemctl restart ssh

To get the ip, run in the remote linux pc:

hostname -I

and you will get something like 10.208.15.53.

Then for connection from other pc:

ssh user1@10.208.15.53

(Optional) For securing the server: go to

sudo nano /etc/ssh/sshd_config

and make the following changes:

PermitRootLogin no
PasswordAuthentication yes

then reload SSH:

sudo systemctl reload ssh

The configuration should be complete now.

If password is forgotten

You set the password with on the linux machine with:

sudo passwd user1

and manually set the password again. Then run

sudo chage -d 0 user1

for user to set their own password in their next login.

vncserver commands

To specify the port of vncserver:

vncserver :2 

To kill the process of vncserver:

vncserver -kill :2

If port is in use;

lsof -ti:5902 | xargs kill -9

Reference link is here.

For graphical login

Simply type ssh ekrem@10.208.15.53 then

env - HOME=$HOME PATH=$PATH LANG=$LANG USER=$USER vncserver 

Then note the desktop id like :2 and append this to the 590 below run this:

ssh -t -L:5902:localhost:5902 ekrem@10.208.15.53

Then run tigervnc and enter 127.0.0.1:5902

SSH tunneling

First do;

ssh-keygen

Then, modify config file in .ssh folder using this link.

After them you should be able to login just by ssh computer_name.

gif generator

ffmpeg -i animation.mp4 -vf "fps=20,scale=960:-1:flags=lanczos" -loop 0 wound_healing.gif -y

File Transfer

From remote to local;

scp -r destrier:/home/ee331/folder   /home/ekrem/folder

From local to remote;

 scp -r folder destrier:/home/ee331/

Ubuntu terminal commands;

Saving the terminal output to a file.

Disabling ipv6 for some networks

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1

About PhD - Advices;

Jack Baker’s Advices are here.