Debian based ssh

install ssh server

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

configure firewall and enable port 22

$ sudo ufw allow ssh
$ sudo ufw enable
$ sudo ufw status

add putty key

Now, you need to paste the copied public key in the file ~/.ssh/authorized_keys on your server.


$ mkdir ~/.ssh
$ chmod 0700 ~/.ssh
$ touch ~/.ssh/authorized_keys
$ chmod 0644 ~/.ssh/authorized_keys
after that you can copy public key created by putty to authoized_keys file
$ sudo systemctl restart sshd

ubuntu C++ configurations

build-essential : tools and libraries that are required to compile a program. For example, if you need to work on a C/C++ compiler, you need to install essential meta-packages on your system before starting the C compiler installation. When installing the build-essential packages, some other packages such as G++, dpkg-dev, GCC and make, etc. also install on your system.

Cmake + Ninja

GDB: The GNU Project Debugger

then for Qt and vcpkg

Besides build-essential and cmake you need to install git

for vcpkg

sudo apt-get install curl zip unzip tar
sudo apt-get install pkg-config
apt install gperf
sudo apt-get install bison
sudo apt install git
sudo apt install autopoint  
sudo apt install gettext
sudo apt install libtool 

for Qt

sudo apt-get install mesa-common-dev
sudo apt install libglu1-mesa-dev -y
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
sudo apt install libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev

bash command lines

Builtin Bash

echo string string string : multiple string
echo ~ : tilde expansion return user absolute path
echo "string string  string" : single string
echo $((arithmetic operation)) : arithmetic operations support + - * / % **
echo "x"{a,b,c} : xa xb xc brace expansion 
file f1 f2 f3  = file "f"{1,2,3} = file "f"{1..3}
echo $(ls x) : command sustitution syntax
ls dir | sort : pipeline commands 
ls -l *.html : wild card expansion
ls > file :to write output to the file 
ls >> file :to append output to the file 
command .................. &  : to run command in background

what is different between double quote and single quote
double-quote is prevent space expansion and tilde expansion and brace expansion but arithmetic expansion and parameter expansion and command substitution still performed in the other hand single quote will prevent all of them

& after command to let the command execute in the background

&& lets you do something based on whether the previous command completed successfully
for example in c++ if main function return -1 the command on right && never perform

The nohup command executes another program specified as its argument and ignores all SIGHUP (hangup) signals. SIGHUP is a signal that is sent to a process when its controlling terminal is closed.

apt install wget && wget url

for more resources visit
https://www.geeksforgeeks.org/basic-operators-in-shell-scripting/?ref=lbp

File System

cp originalFile newFile  :  copy original to new 
cp -r originalDir newDir : copy directory recursively

rm file or directory :  remove file or directory
rm -rf  directory :  force remove non-empty directory 
rm -r directory : remove directory recursively 

mkdir directory :  create directory 

mv fileFrom fileTo : move file from to 

ls director : display all directory content
ls -l dir: display files create date and owner and mod
ls -a dir: display all files including files start with dot(.)

cd path: set the current path

pwd : get current path

file filename : get file type like if it text or binary or symbolic link 

dir directory : diplay all directories inside directory

touch file : create file

cat filename file2name : display file content
cat -n filename : display file content with line number
cat > filename : to write to file
cat >> filename : to append to file
less filename : display file content
less -n filename : display file content with line number
head -n number filename : display the first number lines of the content 
tile -n number filename : display the last number lines of the content

ln -s targetfile linkname : create symbolic link for target file
readlink linkname : get the absolute path of the target this file linked to it  

which command : get absolute path for command

chmod {options} filename : change permision of file
chown  USERNAME:GROUPNAME path  :  change owner
chown -R USERNAME:GROUPNAME path : change owner recursive
chgrp group file1 file2 dir1  :  change group of file

zip|unzip file  
cat ./file.txt | grep "^hello .*ld.*$"
user@host:/home/user$ chmod ugo+rwx file4 #add read and write and execute permision for owner and group and others

System

lspci : pci hardware info
inxi : hardware info more readable need to install
free : memory size and how much used and free
dmesg : debug all devices
lsusb : all serial devices connected
top : monitor all processors
kill -9 pid : force kill for proccesor
ps -aux :to get all arunnig processors

Users

sudo : play command as root
sudo -i : always as root
adduser userName : add user
su : switch user
usermod -aG group user : add user to group
deluser user group : remove user from group
groups : display groups of current user
exit : logout
passwd : change passward of current user
adduser –system userName : add system user
addgroup group : add new group
userdel username : to delete user -r for remove every thing belong to user

note: if you want to add new command move your program to /usr/bin directory