Homepage

Welcome to the note book to end note books


Contributors:

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

Tip

To detach from a session (leaving it running in the background): Press Ctrl+b followed by d.

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

Info

Shows simplified examples for command-line tools.

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

Tip

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.


Contributors:

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.

Note

These commands are applicable for systems using systemd.

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:

  1. Set the default target to multi-user.target:
    sudo systemctl set-default multi-user.target
    
  2. 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:

  1. Set the default target to graphical.target:
    sudo systemctl set-default graphical.target
    
  2. Reboot the system for the change to take effect:
    sudo reboot
    


Contributors:

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.

  1. 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.

  2. Run the script:

    sudo sh install-docker.sh
    

    Info

    This executes the downloaded script with superuser privileges to perform the installation.

  3. Add your user to the docker group:

    sudo usermod -aG docker (username)
    

    Warning

    Replace (username) with your actual username. This command adds your current user to the docker group. Membership in this group allows you to run Docker commands without needing sudo. While convenient, understand that members of the docker group have permissions equivalent to the root user regarding Docker, so exercise caution.

  4. Reboot your system:

    sudo reboot
    

    Tip

    A reboot is usually required for the group changes made in the previous step to take effect.

  5. 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 the hello-world container:

    docker run hello-world
    

    Info

    This command downloads a test image and runs it in a container. If everything is set up correctly, you should see a message confirming that your Docker installation is working.


Contributors:

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:

  1. Create a Docker Volume:

    sudo docker volume create portainer_data
    

    Info

    This volume will store Portainer's persistent data.

  2. 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
    
  3. Create a Docker Network (Optional but recommended):

    Tip

    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


Contributors:

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.


Contributors: