Ok? Do I have a choice??
Living with the Evil Empire :)
Windows Services for Linux aka Ubuntu on Win10
WSL is official in Fall Creator Edition of Windows 10, avail in Windoze App Store.
It is a Comptatibility Layer, no VM (hardware emulation), no recompilation.
It is like reverse of WINE.
Linux ELF binary is run directly on windows. WSL handles what would normally be linux kernel API calls.
It allows for userland process like bash.
Graphics mode stuff is not stable at this time.
DBUS-X11, the interprocess messaging system in X11, is not avail in WSL at this time.
c:\windows\system32\bash.exe is a PE32+ executable. source code compiled to work on windows.
/bin/bash is ELF LSB executable.
VM is Hardware emulation.
ParaVirtualization is Hardware Emulation, but has extra API calls that allows for Guest OS to interact with paravirtual
layer to run hard-to-execute code directly on host domain env.
Can be better in performance, less translation, but require guest to be ported to utilize the ParaVirtualization API cal
ls (drivers from the ParaVM). eg: Xen hypervisor for Winwdows VM. pv-ops.
Ubuntu root "visible" on windows under c:\users\$USERNAME\AppData\Local\lxss\
But changing open files with windows tool would cause permanent data corruption, get file in locked state, and may require reinstall.
This maybe why in fall creator edition, this folder path isn't even there (even after unhiding system files).
- Terminal is based on the DOS prompt window, cut and paste is tedious.
- No tab support in terminal. Maybe look into ConEMU...
- No way to access linux subsystem files from Windows. I am putting all files on the windows side in /mnt/c/Users.
- git works for files written to the windows side. file downloaded with Unix LF format remains so. vim will preserve this. Did not invoke UNIX2DOS conversion. Did not need git-for-windows :)
- Ansible can be installed and it will work as ansible client/target. Well, for now, I am using it with "localhost", so it is not ssh in from some central server. But the Ubuntu is similar enough to say a VM running inside VirtualBox that largely the same playbook can be used in WSL instance.
- MS seems to have the heart in a good place (did i really think this??!! :P).
- if the comptability layer keeps up, WSL would actually provide the closest Linux environment short of running a VM. Better than Cygwin, probably better than macOS.
"Single User" recovery mode for WSL
stop all user level instance of wsl (ie, stop all bash process).
Preview/Beta C:\> lxrun /setdefaultuser root
Fall Creator C:\> ubuntu.exe config --default-user root
bash # this will get into elevated mode, but only after all user-level process have stoped
ubuntu run vi /etc/passwd
ubuntu run id
To return back to normal user mode:
ubuntu config --default-user jane
ref: ms doc.
WSL doesn't provide an X-server. So, like the old days, a windows based X server software is needed.
Have not tried to run vncserver, but DBUS isn't avail, gnome-session has been reported not to work. Maybe some old school Desktop Env that does not use DBUS may work. Not sure if LXDE uses DBUS. twm should not :)
QMonkey at github has instructions to use xfce, even have way to fix DBUS error. Will also need to fix fonts (including unicode and chinese), but implies it has gotten to work.
- vcXsrv - small package. Compiled by VC++. Referred by QMonkey and other.
- Xming - Latest version is not entirely free anymore. maybe a tad slower than vcXsrv.
- Cygwin X - may come with the full Cygwin env, which maybe big for system using WSL or Git-for-windows.
- Exceed (moneyware)
Unix-fying Windows/DOS, from Windows 7 days
- Cygwin add a lot of standard unix tools, libraries, etc. Includes a bash shell and X Window Manager for running X-based (GUI) apps. It even has GNOME, KDE, keepassx (Qt), tetris!
add this to PATH system variable
modern cygwin creates .bashrc in user's home dir and source that, so PATH can be setup there.
A somewhat yum-like feature to add new packages, eg python:
setup-x86_64.exe -P python
it still run the GUI, but then the python package is selected,
so can just click next/next/next to complete.
setup-x86_64.exe -M -P wget,curl,dog,openssh,ctorrent,openldap,nc,rsync
-M will skip many GUI prompt and go right into the package selection window.
openssh is for both client and server?
openldap is for the client portion only
apt-cyg (not fully stable) may provide an apt-get like command interface to install packages, one at a time.
chmod +x apt-cyg
mv apt-cyg /usr/local/bin
apt-cyg install nano
apt-cyg install git
apt-cyg install ca-certificates
- MKS Toolkit. This actually pre-date cygwin, but this is moneyware.
- SFU Microsoft Services for Unix. Add NFS client and server, telnet server, and other tools to bridge Unix and Windows machines. In the same manner that Samba teaches Unix to talk Windows, SFU teaches Windows to talk Unix.
xcopy d:\ z: /s /e /c /f /z /h # xcopy from d: to z: , include sub dir, hidden file, etc.
robocopy s:\source\folder1 d:\destination\folder2 /e /move /copyall /tee /log+:robo.log /w:1 /r:2
# Robust copy, lot of options, separate tool from MS?
# /move = move files and dirs (hopefully not copy and delete if on same FS)
# /copyall = copy NTFS ACL, owner, and audit info also (these are not included by default)
# but if ACL cannot be copied, copy will fail (reported)
# /e = include sub dirs, even if empty
# /tee /log+:robo.log will do a "T" and append to log file
# /w:1 /r:2 = wait 1 sec before retry, max 2 retries
# (good if know waiting won't help unlock file, or will do multi-scan)
# Note that folder1 itself won't be moved, it is the content inside the folder
# It is more like folder1\* to folder2.
# But folder1 itself will be deleted if /MOVE is used.
# Don't think too much like Unix!
# Additional notes:
# File that cannot be moved (cuz it is locked)
# is not reported as error in summary (but as skipped?).
# But instead of whining and stopping if using the Win Explorer GUI,
# Robocopy will continue to move the next file.
# Files created after Robocopy completes its indexing are not touched.
# Redirecting output to a log file is good, as it is quite verbose.
# \\unc\path can be used.
# files that already exist in the destination are reported as EXTRA
# can be /purge if desired.
cacls = change acl's. NT cli version of solaris setfacl.
compact = file compression util (list, maybe set?)
type file | find /i "string"
# equiv to unix cat file | grep -i string
# the quotes MUST be used or
# find will complain with weired error message!
# /i = case Insensitive grep.
type file | findstr /i "string"
# similar to find above, but different binary...
rdisk = nt4 create emergency recovery disks (erd)
regback = registry backup (add on?)
title any text string desired
Set the DOS CLI window to have the desired title
bgjob prog arg
run bg job inside a telnet session
so that even if telnet goes away, job remains.
There is still probably a nohup.
Sample .bat file:
assoc .dxp=dxpfile >NULL
REM ftype dxpfile="C:\winnt\system32\notepad.exe" "%%1"
if exist "C:\Program Files\TIBCO\Spotfire\3.0\Spotfire.Dxp.exe" (
ftype dxpfile="C:\Program Files\TIBCO\Spotfire\3.0\Spotfire.Dxp.exe" "%%1" >NULL
echo "Updated dxp extension for SpotFire 3.0
if exist "C:\Program Files\TIBCO\Spotfire\2.1\Spotfire.Dxp.exe" (
ftype dxpfile="C:\Program Files\TIBCO\Spotfire\2.1\Spotfire.Dxp.exe" "%%1" >NULL
echo "Updated dxp extension for SpotFire 2.1
echo "No SpotFire found in standard directory locations, no changes made."
Alternate Data Stream
echo "main stream" > stream.txt
echo "alternate stream" > stream.txt:ads
not supported in NFS.
Similar stuff on Apple's HFS?
windows network stuff
net use R: \\host\share password /user:DOMAIN\USERNAME
map network drive; funky session weireness, watch out use in script
net user USERNAME PASSWORD /add
net statistics server # info about uptime, etc
nbtstat -n = list all comp (NetBIOS name, WINS)
nbtstat -c = clear the cache
nbtstat -RR = Release and Reregister NetBIOS name with WINS
NetBIOS names can only be 15 chars long. The 16th char encode the NetBIOS Suffix.
A list (albeit not comprehensive, at least 4F is not listed) can be found at
All code in hex
00 = Workstation Service
03 = Manager Service (allow MMC to connect to it?)
1B = Domain Master Browser, defined for a domain rather than a computer
1C = Domain Controllers, defined for a domain
20 = File Server Service
netsh (shell for config of dhcp, ras, wins, routing) [w2k]
runas # kind of like sudo
runas /user:domain\adminUser c:\winnt\system32\cmd.exe # create a dos prompt with admin credentials
c:\"Program Files\Internet Explorer\iexplore.exe" # start IE using the credential of the DOS session (ie admin acc).
set # display system environment
# LOGONSERVER is the Domain Controller the machine is currently talking to
# Other interesting variables displayed by set:
# USERNAME, USERDOMAIN
network browser cmd (some gui stuff) in Resource or Supplement kit.
net config rdr, see network device info, eg NetBT_E100B1
browstat gb NetBT_E100B1
tell which one is the master browser in the network.
GUI browser monitor. similar to above
browstat view NetBT_E100B1 NTDOM1
browstat getpdc NetBT_E100B1 NTDOM1
other obscure stuff, w2k only?
netusers \\computername /history
# see who has logged in to a given machine
mmc # win magement console,
# many plugin, eg computer mgnt
# customizable and store them as .msc file
nt4 / w2k reousrce pack
\\computer : remote computer to shutdown (local if omitted)
/A : abort shutdown
/R : reboot
/T:xx : wait xx secs (def=30)
msg : message to user of shutdown
/C : force running app to close
reg query HKCR\dxpfile
reg export ROOTKEY/subkey regdump.reg
Did not find command line equivalent of doing find on all fields and repeat using regedit and F3 ...
can't export and do grep either :(
accepted abbreviations (likely in order of decreasing priority):
HKCU HKEY_CURRENT_USER (take precedence over local_machine if there are duplicates)
windows program auto load, from registry instead of Startup folder:
TLA (likely in order of decreasing priority):
HKCU HKEY_CURRENT_USER (take precedence over local_machine if there are duplicates)
each program has an entry with full path as value, delete individually as needed.
XP has a System Configuration Utility under control panel | help support
section, so that all current startup places are listed and can be turned off via uncheck.
Many of these can be recognized as normal software, but just always run
at startup, which becomes anoying.
Some spyware may also add hooks here, but if they are really good,
spyware may replace legit system file and it will need a tool to check
if it is really spyware or the legit file!
Probably legit programs (could still be replaced by spyware!):
HKLM...Run mobsync.exe /logon. Sync Manager
KHCU...Run ctfmon. Office2003 text2speech [potentially key logger]
Additional crap that is loaded somehow...
C:\Program Files\Common Files\Real\Update_OB\
apperently lot of .dll and .exe which somehow get executed
rnms3270.dll is the realone messanger center crap that do lot of pop up messageging ads. Delete or rename them!
Internet MIME programs (may load all the time)
C:\winnt\Downloaded Program Files\
Each control has its own entry, right click and then choose remove
(eg, will see DBFullInst Control for the stupid SpyWare program).
SpyBot AntiSpyware program has tool that list all program that will be
loaded up at boot time and allow single click disactivation.
Hackish way to reset password
At least for Win 7.
Idea is to replace the sethc.exe program, which is what accessibility invokes, and replace it with cmd.exe
then during login, press shift 5 times or alt sh prtSc to invoke the accessibilty program, get dos prompt instead, and
net user geek newPassword
detailed steps are listed in
(replace sethc.exe when done. or maybe not... nice quick shortcut to cmd, but perpetual back door...)
Cool SA tools
Get it from sourceforge.net, a program that will collect disk stat usage (network share ok),
keep track of subfolder disk usage, and also give aggregate of files type usage
(eg mp3, m4a, avi, pst, zip, etc).
PDF Forge A freeware to generate PDF for windows (freeware version of Acrobat Writer).