Windows 10 tricks for the engineer

Started by Dieselboy, February 20, 2019, 01:16:31 AM

Previous topic - Next topic

Dieselboy

As engineers we have a tool set that we hold on to. Myself, these tools consist of putty.exe and the puttyCM Tabs application. I have a directory called D:\Tools and in there, contains (contained) a bunch of things:

grepwin.exe - Grep on Windows, so I can search through all my .txt files for config. I also keep my own knowledgebase for doing things. I need a grep tool so I can quickly find certain things.

md5-sha-check-utility.exe - tool for checking .bin images and .iso files so that I can make sure the file didnt change during the ftp transfer.

mtupath.exe - checking mtu in the path

wget.exe - wget on windows

The list goes on....


What I find now is that a growing number of these tools are redundant as they have been replaced by the bash.exe which is Ubuntu on windows 10.

For example, here's how I checled an MD5 hash of a file in my FTP directory:

PS D:\tpearce\Desktop\WSL> cd D:\tftpboot\
PS D:\tftpboot> wsl md5sum atlassian-jira-software-8.0.0-x64.bin
54c6642f5c84d85e687f12fa1dc3ec7b  atlassian-jira-software-8.0.0-x64.bin
PS D:\tftpboot>


What I did was:
1. open powershell
2. Change to the directory
3. invoke md5sum ubuntu application via windows command "wsl"
4. md5 hash result is printed: 54c6642f5c84d85e687f12fa1dc3ec7b  (which matches what I copied to the remote server).


Another example, my personal knowledgebase grows every day. Currently standing at 108 files and 8 folders of text files. To manage this I use notepad++ and select the top folder as a workspace. But sometimes I cant find the text file that I wrote last year, to say, how to use packet capture on IOS:

PS D:\tftpboot> cd "C:\Users\tpearce\Google Drive\Work\My how-to guides"
PS C:\Users\tpearce\Google Drive\Work\My how-to guides> wsl grep -rn -e 'packet cap'
Cisco/ios packet capture.txt:1:[ios packet cap]
PS C:\Users\tpearce\Google Drive\Work\My how-to guides>


You can see that you can just use powershell and give it extra powers via the 'wsl' command  :mrgreen:

I have set up powershell to always start in a folder, because in there I have python virtual environments and other linux-y type stuff that I use to manage openstack etc. However you can just enter "wsl" on it's own to get into ubunt:

PS C:\Users\tpearce\Google Drive\Work\My how-to guides> wsl
kubectl: command not found
tony@CV000142:/mnt/c/Users/tpearce/Google Drive/Work/My how-to guides$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"


I tend to use both wsl and going into Ubuntu shell.

Going forward I think I'll finally be able to replace the 3cdaemon tftp/ftp server that I've been using since 2007 on Windows XP which was given to me by a senior guy that had been using it for a long time before that. It still works perfect on Windows 10 but does not have SCP server functionality. I am sure I can set up FTP/TFTP/SCP server in Ubuntu and just start the server when I need it.

The mixing of Windows and Linux like I showed above has been extremely helpful. For example when managing virtual images, you can easily covert from qcow > Microsoft VHD. "qemu-img" is great:

PS D:\tpearce\Desktop\WSL> wsl qemu-img info wanos-4.2.7-ub.qcow2c
image: wanos-4.2.7-ub.qcow2c
file format: qcow2
virtual size: 12G (12884901888 bytes)
disk size: 336M
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
PS D:\tpearce\Desktop\WSL>


Hope it helps  :)

deanwebb

I think it's great that some of the best tools for Windows are basically CLI utilities ported over from *nix.
Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.

wintermute000

I just use Windows on Linux for this kinda thing now. But thanks for mtupath.

Dieselboy

You run a windows VM inside Linux? Or did I misunderstand?

The point I am making is that you dont need clunky VMs or virtualisation tools like vmware or virtual box to do this anymore :)

icecream-guy

Quote from: Dieselboy on February 25, 2019, 07:52:08 PM
You run a windows VM inside Linux? Or did I misunderstand?

The point I am making is that you dont need clunky VMs or virtualisation tools like vmware or virtual box to do this anymore :)

is that via the Windows subsystem for Linux  or the Cygwin project tools?
:professorcat:

My Moral Fibers have been cut.

Dieselboy

Hi Ristau, it's the Windows Subsystem for Linux (WSL). But they changed how you install it. Now, you just go to the "market store" and pick one of the Linux distros there. As of writing, the list is currently::

Ubuntu 16
Ubuntu 18
openSUSE
SUSE Linux Enterprise Server 12
Debian
Kali Linux