Abekta

Nothing human is alien to me

User Tools

Site Tools


This is an old revision of the document!


Bash

Function Code
Check storage df -h
System usage monitor htop
CPU information lscpu
Check drives lsblk
Check GPU sudo lshw -C display / lspci | grep -e VGA

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

screen -S name
screen -ls
screen -d -r name

Detach screen from another ssh shell: screen -d -r

Keyboard shortcuts:

  • ctrl+a d: leaving a screen without terminating
  • exit: to terminate a screen

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:

  1. Create a private-public ssh key pair.
  2. Your private key should be inside the folder ~/.ssh/
  3. Change permission of the folder: sudo chmod -R 700 ~/.ssh
  4. Then log in: ssh -Y username@server

Users and Groups

  1. Check permissions of a folder: ls -ld foldername
  2. See all users of a group: grep groupname /etc/group
  3. Give a user write permission to a folder using acl: setfacl -m u:sazzat:rwx anaconda3
sudo adduser username
sudo deluser username
sudo addgroup groupname
sudo delgroup groupname
sudo adduser username groupname
getent passwd | cut -d: -f1
getent group
sudo chown username: foldername
sudo chmod u+w foldername

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
soft/bash.1699029896.txt.gz · Last modified: 2023/11/03 10:44 by asad

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki