A collection of notes on using Linux systems, in particular Ubuntu.
Basic Terminal Commands
List all installed packages
# List everything sudo dpkg -l # List things with apache in the name sudo dpkg -l | grep apache
Generate an ssh-key for every client
ssh-keygen -t ed25519 -a 100 [-C "comment your client name"] [-f output_path]
Some older software such as Solid file explorer require RSA keys in PEM key format
ssh-keygen -t rsa -b 4096 -a 100 -m PEM [-C "comment your client name"] [-f output_path]
You can also convert existing keys to PEM format
ssh-keygen -p -m PEM [-C "comment your client name"] [-f output_path]
Manage ssh keys
# On the client ssh-copy-id email@example.com
# On the server vim ~/.ssh/authorized_keys
- According to this you should avoid using ECDSA and DSA keys.
Also: SSH Tunneling, SSH Proxy, SSH Reverse Proxy
If you need to access a port on the remote computer, you can use the
-L option to forward ports from the remote to the local machine.
ssh -L <localport>:localhost:<remoteport> <remoteurl> # E.g. ssh -L 8080:localhost:80 firstname.lastname@example.org
You can also do the reverse, giving the remote access to a local port using
ssh -R <localport>:host:<remoteport> <remoteurl> # E.g. ssh -R 8080:localhost:80 email@example.com
Reference I recommend not exposing VNC. Set it to localhost only and use ssh port forwarding.
How to use Remmina to connect to over ssh tunnel
Switching between Nvidia and Intel
Make sure the Nvidia graphics drivers are installed. Then you can select between Nvidia and Intel GPUs using the Nvidia X Server Settings application
nvidia-settings. Alternatively, you can use the following commands in the terminal.
To switch to the Nvidia GPU:
sudo prime-select nvidia
To switch back to the Intel GPU:
sudo prime-select intel
prime-select query will print either
intel to stdout.
Tmux cheat sheet
Tmux, or Terminal Multiplexer is an alternative to screen.
Use it to keep terminals open and tasks running after you disconnect your SSH connection.
# Make a new session tmux # Make a new named session tmux new -s my_session # Rename a session # Keybinding: Ctrl + b, $ tmux rename-session [-t current-name] [new-name] # Detach from a session # Keybinding: Ctrl + b, d tmux detach # List windows tmux ls # Attach to a session tmux attach -t my_session
echo "deb https://deb.etcher.io stable etcher" | sudo tee /etc/apt/sources.list.d/balena-etcher.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61 sudo apt update sudo apt install balena-etcher-electron
Logs are stored under
/var/log. These can end up taking up a lot of space.
You can delete logs in the journal folder Reference