Docker commandsIn the article DOCKER 101, I wrote about the basics of Docker and its components. In this article I will cover a set o Docker basic commands very useful for any kind of usage.
Docker command line structureThe old way:
1 docker <command> (options) The new recommended way:
1 docker <command> <sub-command> (options) Checking the Docker versionThere are two possible ways to check the version of docker is currently installed: docker version and docker --version.
IntroductionThe purpose of this article is to give you a basic understanding of Docker, its components, and how it can be used to improve the development and deployment of applications.
Docker is a platform for developing, shipping and running applications. It provides a way to package applications and their dependencies into a lightweight, portable container that can run on any infrastructure. Docker has become increasingly popular in recent years due to its ability to streamline the development process, increase deployment efficiency, and improve collaboration between teams.
List files within gzipHow to list the files within a compressed gzip file without extracting it and get information like the timestamp and permissions?
To achieve this, we can use a tool called zcat.
Looking to its help session we can see:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 zcat --help Usage: /usr/bin/zcat [OPTION]... [FILE]... Uncompress FILEs to standard output.
Find files by ageA while ago I needed to find old files in a Linux server. The find utility have the -mtime option to complete this task.
Here’s an example command:
1 find /path/to/directory -type f -mtime +730 Running this command will list all the files in the specified directory (and its subdirectories) that are older than two years.
Let’s break down the command:
find /path/to/directory: Search recursively starting from the specified folder.
Find broken symbolic linksA while ago, I was willing to contribute with a GitHub project, but I found some issues with broken links. This situation led me to a question: how can I recursively find all broken links within a directory?
The command below will print the path to any broken symbolic links found in the specified folder and its subfolders.
1 find /path/to/folder -type l ! -exec test -e {} \; -print Let’s explain each part of the command does:
We frequently use logrotate to control log rotation on Linux servers. By default, logrotate use the custom configuration files locate in /etc/logrotate.d.
But what if we need a specific log file to be handled separately from the system-wide log rotation?
In this case, we can create a custom logrotate configuration file outside the /etc/logrotate.d directory.
Create a Custom Configuration File 1 sudo vim /apps/app_name/logrotate/app_name Configure Log RotationIn this new file, specify the log file, how frequently you want it to rotate, how many rotated versions to keep, and any other specific settings: