Compare commits

..

4 Commits

4 changed files with 40 additions and 24 deletions

View File

@ -1,20 +1,20 @@
% compression % compression
# Create a tar containing files # Create a tar archive containing files
tar cf <name>.tar <files> tar cf <name>.tar <files>
# Extract the files from a tar # Create a tar archive with gz compression
tar xf <tar_file>
# Create a tar with Gzip compression
tar czf <name>.tar.gz <files> tar czf <name>.tar.gz <files>
# Compress file and appends .gz to its name # Extract a tar archive
gzip <path> tar xf <tar_file>
# Decompress compressed file # Create a gz archive containing files
gzip -9 -c <files> > <name>.gz
# Extract a gz archive
gzip -d <gz_file> gzip -d <gz_file>
$ path: ls $ files: ls | awk -F: '{ print $1}'
$ tar_file: ls *.{tar,tar.*} 2>/dev/null $ tar_file: ls *.{tar,tar.*} | awk -F: '{ print $1}'
$ gz_file: ls *.gz $ gz_file: ls *.gz | awk -F: '{ print $1}'

View File

@ -1,12 +1,15 @@
% docker-compose % docker-compose
# Builds, (re)creates, starts, and attaches to containers for all services # Up a compose YAML
sudo docker-compose -f <file> up sudo docker-compose -f <file> up
# Builds, (re)creates, starts, and dettaches to containers for all services # Up and daemonze a compose YAML
sudo docker-compose -f <file> up -d sudo docker-compose -f <file> up -d
# Stops containers and removes containers, networks created by up # Up and daemonze a compose YAML (force)
sudo docker-compose -f <file> up -d --force-recreate
# Up and daemonze a compose YAML
sudo docker-compose -f <file> down sudo docker-compose -f <file> down
$ file: ls *.yaml | awk '{print $1}' $ file: ls *.yaml | awk '{print $1}'

View File

@ -1,4 +1,4 @@
% docker-volumes % docker
# Create a volume # Create a volume
sudo docker volume create <name> sudo docker volume create <name>
@ -11,29 +11,36 @@ sudo docker volume rm <volume>
$ volume: sudo docker volume ls --format "{{.Name}}" | awk '{print $1}' $ volume: sudo docker volume ls --format "{{.Name}}" | awk '{print $1}'
% docker-network
# Create new network # Create new network
docker network create <name> docker network create <name>
# List the networks # List the networks
sudo docker network ls sudo docker network ls
% docker # Remove volume
sudo docker volume rm <network>
$ network: sudo docker network ls --format "{{.Name}}" | awk '{print $1}'
# List the running containers # List the running containers
sudo docker ps sudo docker ps
# Stop a running container through SIGTERM # Stop a running container through SIGTERM
sudo docker stop <container_id> sudo docker stop <container>
# Stop a running container through SIGKILL # Stop a running container through SIGKILL
sudo docker kill <container_id> sudo docker kill <container>
# Execute bash on a running container
sudo docker exec -it <container> bash
# Execute a command on a running container
sudo docker exec -it <container> sh -c '<command>'
# Print the last lines of a container's logs # Print the last lines of a container's logs
docker logs --tail 100 <container_id> | less sudo docker logs --tail 100 <container> | less
# Print the last lines of a container's logs and following its logs # Print the last lines of a container's logs and following its logs
docker logs --tail 100 <container_id> -f sudo docker logs --tail 100 <container> -f
$ container_id: sudo docker ps --format "{{.ID}}" | awk '{print $1}' $ container: sudo docker container ls --format "{{.Names}}" | awk '{print $1}'

View File

@ -36,7 +36,10 @@ sudo usermod -a -G <group> <user>
# Remove user from a group # Remove user from a group
sudo deluser <user> <group> sudo deluser <user> <group>
# Port binding # List port bindings
sudo lsof -i -P -n | grep LISTEN
# Show binding on a port
sudo lsof -i:<port> sudo lsof -i:<port>
# Get IP on interface # Get IP on interface
@ -51,6 +54,9 @@ meld <(hexdump -C <file_1>) <(hexdump -C <file_2>)
# Compare 2 files (bcompare) # Compare 2 files (bcompare)
bcompare <file_1> <file_2> bcompare <file_1> <file_2>
# Replace expression in files
ack -rl "<expression>" | xargs sed -i 's#<expression>#<replace_expression>#g'
# Disable Bluetooth ERTM # Disable Bluetooth ERTM
sudo bash -c "echo Y > /sys/module/bluetooth/parameters/disable_ertm" sudo bash -c "echo Y > /sys/module/bluetooth/parameters/disable_ertm"