From Microsoft documentation: The Test-NetConnection cmdlet displays diagnostic information for a connection. It supports ping tests, TCP tests, route tracing, and route selection diagnostics. Depending on the input parameters, the output can include the DNS lookup results, a list of IP interfaces, IPsec rules, route/source address selection results, and/or confirmation of connection establishment.
To mimic the Telnet command one can use:
powershell
Test-NetConnection -ComputerName <HOSTNAME OR IP> -InformationLevel "Detailed" -Port <DESTINATION PORT> Test ping connectivity with detailed results
How to add contents to a fileTo add contents to a file we can use the Add-Content cmdlet.
powershell
Add-Content -Path C:\path_to_destination_file "Content to be added" How to add the contents of a file to another fileTo get a file contents we can use the Get-Content cmdlet.
powershell
Get-Content C:\file_to_source | Add-Content -Path C:\path_to_destination_file NoteThis is similar to use cat and redirection >> in the Unix world.
bash
cat /file_to_source >> /path_to_destination_file How to combine the above two commands powershell
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:
shell
docker <command> (options) The new recommended way:
shell
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:
shell
zcat --help Usage: /usr/bin/zcat [OPTION]... [FILE]... Uncompress FILEs to standard output. -f, --force force; read compressed data even from a terminal -l, --list list compressed file contents -q, --quiet suppress all warnings -r, --recursive operate recursively on directories -S, --suffix=SUF use suffix SUF on compressed files --synchronous synchronous output (safer if system crashes, but slower) -t, --test test compressed file integrity -v, --verbose verbose mode --help display this help and exit --version display version information and exit With no FILE, or when FILE is -, read standard input.
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:
shell
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.