====== Bash ====== ^ Function ^ Code ^ | Check storage | ''df -h'' | | Check storage | ''du -hs foldername'' | | Physical volumes | ''pvs'' | | Remove | rm -rf sth | | System usage monitor | ''htop'' | | CPU information | ''lscpu'' | | Check drives | ''lsblk'' | | Check GPU | ''sudo lshw -C display'' / ''lspci | grep -e VGA'' | ===== - Building from source (with python) ===== cd software mkdir build cd build cmake -D BUILD_WITH_PYTHON=ON -DCMAKE_INSTALL_PREFIX= .. sudo make install export LD_LIBRARY_PATH=/lib/:$LD_LIBRARY_PATH export PYTHONPATH=/lib/python3.11/site-packages:$PYTHONPATH ===== Ports ===== To kill everything listening to a port: ''%%sudo fuser -k 2121/tcp%%'' ===== Profile ===== Create a hidden file called ''.bashrc'' in your home folder and add aliases for different commands as: alias something='ssh -Y uder@server.com' So ''something'' will always execute the command ''ssh -Y uder@server.com''. ===== Screen ===== * Create a screen: ''screen -S name'' * Detach from the screen with keyboard shortcut: ''ctrl+a d'' * See a list of screens: ''screen -ls'' * Attach to the desired screen: ''screen -r name'' * Detach from outside (not needed usually): ''screen -d -r name'' ===== Server ===== ssh -Y user@10.50.17.66 # login ssh -N -f -L localhost:8889:localhost:8889 user@address # tunneling Login to server using private key: - Create a private-public ssh key pair. - Your private key should be inside the folder ''~/.ssh/'' - Change permission of the folder: ''sudo chmod -R 700 ~/.ssh'' - Then log in: ''ssh -Y username@server'' ==== Users and Groups ==== | Check permissions of a folder | ''ls -ld foldername'' | | See all users of a group | ''grep groupname /etc/group'' | | Give a user write permission to a folder using acl | ''setfacl -m u:username:rwx foldername'' | | Change owner group of a folder | ''chown -R :groupname foldername'' | | Change owner user of a folder | ''chown username: foldername'' | | Change permissions of a folder | ''chmod -R u+w foldername'' / ''chmod -R 770 foldername'' | sudo adduser username sudo deluser username sudo addgroup groupname sudo delgroup groupname sudo adduser username groupname getent passwd | cut -d: -f1 getent group ===== Storage ===== sudo mount -t auto /dev/sdb /media/plato/ ===== GPU ===== sudo apt autoremove nvidia* --purge sudo /usr/bin/nvidia-uninstall sudo /usr/local/cuda-X.Y/bin/cuda-uninstall sudo apt update sudo apt upgrade lspci | grep -e VGA ubuntu-drivers devices sudo ubuntu-drivers autoinstall reboot nvidia-smi ===== IP setting ===== ip link sudo nano /etc/netplan/*.yaml Create the yaml file the following way: # This is the network config written by 'subiquity' network: version: 2 renderer: networkd ethernets: eno1: dhcp4: no addresses: [10.50.255.33/27] gateway4: 10.50.255.62 nameservers: addresses: [8.8.8.8] eno2: dhcp4: no version: 2