Homepage
Welcome to the note book to end note books
Some helpful command line programs
This page lists some command-line tools that can significantly enhance your productivity and make working in the terminal easier and more efficient.
Tmux
Tmux (Terminal Multiplexer) allows you to create and control multiple terminal sessions within a single window.
Can be installed by running:
sudo apt-get install tmux
Tmux has a comprehensive cheat sheet for all of its commands. It's a great resource to keep handy.
Basic Usage:
To start a new Tmux session:
tmux
To list existing sessions:
tmux list-sessions
To reattach to the most recent session:
tmux attach
To reattach to a specific session (replace 0
with the session number):
tmux attach -t 0
TLDR
TLDR provides simplified, community-maintained examples for command-line programs. It cuts through lengthy man pages to give you just the common use cases.
Basic Usage:
To see examples for the tar
command:
tldr tar
To see examples for the ls
command with macOS options:
tldr ls --platform osx
htop
htop is an interactive process viewer for Unix-like systems. It provides a dynamic real-time view of processes running on the system, showing CPU usage, memory usage, swap usage, and tasks.
Can be installed by running:
sudo apt-get install htop
Basic Usage:
Simply run htop
to launch the interactive viewer:
htop
Inside htop
, you can use arrow keys to navigate and function keys (like F1 for Help, F3 for Search, F9 for Kill, F10 to Quit) for various actions.
Managing the Graphical User Interface (GUI)
This document provides commands to switch your system's default boot target between the graphical user interface (GUI) mode and the command-line interface (CLI) mode.
Switching between these modes can be useful depending on whether you need a graphical environment or prefer working solely from the command line.
Disable GUI (Boot to Command Line):
To set the system to boot directly into the command line (multi-user mode) without a graphical environment, use the following commands:
- Set the default target to
multi-user.target
:sudo systemctl set-default multi-user.target
- Reboot the system for the change to take effect:
sudo reboot
Enable GUI (Boot to Graphical Interface):
To set the system to boot into the graphical user interface, use the following commands:
- Set the default target to
graphical.target
:sudo systemctl set-default graphical.target
- Reboot the system for the change to take effect:
sudo reboot
Docker
Docker is a platform used for developing, shipping, and running applications in containers. Installing it can sometimes involve several steps, and if you're setting up multiple machines or doing it frequently, remembering the exact process can be tedious.
This note serves as a quick reference for installing Docker using the convenience script provided by the Docker team.
-
Download the script:
curl -fsSL https://get.docker.com -o install-docker.sh
This command downloads the installation script from get.docker.com and saves it as
install-docker.sh
. -
Run the script:
sudo sh install-docker.sh
-
Add your user to the
docker
group:sudo usermod -aG docker (username)
Replace
(username)
with your actual username. This command adds your current user to thedocker
group. Membership in this group allows you to run Docker commands without needingsudo
. While convenient, understand that members of thedocker
group have permissions equivalent to the root user regarding Docker, so exercise caution. -
Reboot your system:
sudo reboot
-
Verify the installation: After your system has restarted and you've logged back in, you can verify that Docker is installed and you can run commands without
sudo
by running thehello-world
container:docker run hello-world
Portainer
Portainer is a lightweight management UI for Docker , Kubernetes , Docker Swarm, and Azure ACI . It allows you to manage your containers, images, networks, and volumes from a web browser. This page provides instructions for installing the Portainer Community Edition (CE).
While Portainer is a popular choice, here are some alternatives you might consider:
- Rancher - More for Kubernetes (container orchestration)
- Dockage - Portainer but made by the same people who made Uptime Kuma mainly focuses on the
docker-compose.yml
side, but some users have found it more helpful than Portainer
Installation Steps
Follow these steps to install the Portainer Community Edition:
-
Create a Docker Volume:
sudo docker volume create portainer_data
-
Deploy the Portainer Container: Run the following command to download and start the Portainer container.
sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
-
Create a Docker Network (Optional but recommended):
It's good practice to put your containers on a dedicated network. Replace
(name of network)
with your desired network name (e.g.,my-app-network
).sudo docker network create (name of network)
App Templates
In Portainer, App Templates enable you to easily deploy services with a predetermined configuration, while allowing you to customize options through the web UI. While Portainer ships with some default templates (see portainer/templates), it’s often helpful to have 1-click access to many more apps + stacks, without having to constantly switch template sources.
Under Settings → App Templates in your Portainer GUI, paste this URL:
https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Minecraft Servers in Docker
I use itzg/docker-minecraft-server containers whenever possible since they are easy to maintain and run.
I like to run the server in a compose file, because it makes managing it a little easier than trying to remember what run command I would need to use with every single variable needed.
So, I'd like to keep some commands handy that I use to manage them.
For instance, running commands inside the container can be done be running
docker exec -i mc_server rcon-cli
note
This command's mc_server
is a placeholder for whatever you called your container name in your compose file
Some things to keep in mind
There are somethings that you should utilize, regardless of server software. Like online-mode or creating a whitelist. Enabling both of those options should protect your server from unauthorized visitors.