Remove All Ads from XDA

Commander: [Cygwin + Cmder]

25 posts
Thanks Meter: 7
By Ferather, Junior Member on 13th March 2019, 09:59 PM
Post Reply Email Thread

Cygwin + Cmder, this pack is intended for Android, but does much more. I consolidated the pack myself, and thought it might help others using Windows.


Easy admin and shell switching, with tabs and multi shell support.
Full drag and drop "to-path" support, even as admin.
Various user defined settings and features.
Fully portable (usb for example).



Right click "Cmder.exe" and select "create shortcut", then right click it and "rename" it to "Commander".
Press the "Windows key + R" and copy-paste the following directory location:

%ProgramData%\Microsoft\Windows\Start Menu\Programs

Right click and "cut" your shortcut, then right click "paste" into the folder, then close the folder.

Note: You can also change the icon of the shortcut, there are more in the "icons" folder.


Change the "startup shell" if you want to replace-combine CMD and PowerShell.


I take no credit for the app and binary's, I simply consolidated the two and pre-configured it.
Current version: 2019-03-14 (14-03-2019, UK), stable.


Screenshots and more info below

The Following 2 Users Say Thank You to Ferather For This Useful Post: [ View ] Gift Ferather Ad-Free
14th March 2019, 03:23 PM |#2  
OP Junior Member
Flag Near London
Thanks Meter: 7
Donate to Me
Example usage and path strings:

Add path to environmental path:

Optional install method:

17th March 2019, 12:17 AM |#3  
OP Junior Member
Flag Near London
Thanks Meter: 7
Donate to Me
How to setup working directories, plus a few other tricks. In this guide I will be using 'bootimg' which unpacks-repacks boot.img and recovery.img files, it also requires a working directory.

Method 1 is the quickest, but teaches much less. Method 2 takes longer but teaches you a few tricks along the way.


Method 1:

First I make a 'TMP' folder on my 'D:' drive || mkdir D:\TMP
Next I move my 'boot.img' to 'TMP' || mv D:\Files\Desktop\boot.img D:\TMP
Now I check all is well || ls D:\TMP
Next to set the working directory || cd /d D:\TMP
Now I run 'bootimg' || bootimg --unpack-bootimg boot.img

Method 2:

First I make a working directory || mkdir %commander%\rom
Next I check that worked || ls %commander%
Now I move 'bootimg.exe' to '\rom' || mv %commander%\bin\bootimg.exe %commander%\rom
Next I check that worked || ls %commander%\rom

Now I make a winlink as 'admin', making things easier || mklink %commander%\bin\bootimg.exe %commander%\rom\bootimg.exe

Now I check the symlink is working' || bootimg /?
Next I copy my 'boot.img' to '\rom' || xcopy D:\Files\Desktop\boot.img %commander%\rom

Now I set the working directory || cd /d %commander%\rom
Next I run 'bootimg' || bootimg --unpack-bootimg boot.img

Note: %commander% is an environmental path, which points to my Commander location (see post 2).



You can run more than one command per line, by using '&' or '&&' (and then), which can be used more than once.
Make a folder and explore it || mkdir %commander%\rom & explorer %commander%\rom

Winlinks are symlinks, they also accept 'posixpath' as strings, example: "/vendor".


Useful apps (limited use with Android): OSFMount | Ext2fsd | VirtualBox

VB Images:


Screenshot weblinks fixed, I apologize.

17th March 2019, 05:02 PM |#4  
OP Junior Member
Flag Near London
Thanks Meter: 7
Donate to Me
How to customize, and in some part produce a rom from another rom (ideally a stock one), without data corruption and incorrect metadata, corrupt other.
Note: OSFMount + Ext2fsd, and also FreeBSD (Unix) do not interface with non-standard data for android partitions (ext4, lightly modded).


Interestingly both OSFMount + Ext2fsd and FreeBSD fail at the same general issue, metadata and file attributes (ext is not native).
With FreeBSD, chattr and lsattr do not function, they run, but read and write nothing, 'noatime' is not applied to files.

Note: FreeBSD will allow you to change permissions on symlinks (chmod -h), whereas linux does not.


First, it's likely the 'system.img' file is a sparse one, and cannot be mounted, so you will need to convert it to a raw 'system.img'.
simg2img Path-to-in\system.img Path-to-out\system.img


Now you will need to setup a debian distro on VirtualBox, I suggest 'Lubuntu', it's lighter and faster, and fully compatible., here is a quick after install guide:

Install guest additions via the iso, and terminal as 'root' (sudo), simply type 'sudo' and drag and drop the linux setup file into the console.
Setup shares for the current user || sudo usermod -aG vboxsf YOURUSERNAME

Full install guide:


Once you have setup shared folders (in my case 'D:\Files' as '/home/ferather/Files') copy the 'system.img' to '/'.
You can now mount it, and modify almost everything without metadata corruption.

Lubuntu (18.10):

sudo mkdir /system & sudo mount /system.img /system & sudo pcmanfm-qt /system
sudo mkdir /system & sudo losetup -fP /system.img & sudo mount -o noatime /dev/loop1 /system & sudo pcmanfm-qt /system

NomadBSD (1.2):

sudo mkdir /system & sudo mdconfig -a -t vnode -f /system.img -u 1 & sudo mount -t ext2fs -o noatime /dev/md1 /system & sudo pcmanfm /system

Note: 'pcmanfm-qt' and 'pcmanfm' are file managers, with root icons and theme.


How to boot:

You will need to unpack your 'boot.img', see post 3 for more details. Once unpacked you will need to modify the 'fstab.xxxx', where xxx varies with device.
I am using 'Programmers notepad' to modify linux files under windows, it's fully compatible with LF and CR line endings.

Now open your '' file, and find /system, and remove the verify part, example:

Old || /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait,verify=/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata
New || /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait

Now you will need to repack your modified boot back into 'boot.img', for good measure you should unpack and do the same to the 'recovery.img'.

Note: If you wish to add tweaks to a '.prop' file, but want to maintain stock and verify, add them to 'default.prop' in 'boot.img'.



Using 7-zip on windows you can inspect the raw 'system.img', which includes permissions, file attributes and symlink targets.
If you go to 'File > Properties' you can also see additional drive and-or partition information, and hidden bits.

Setting attributes (noatime) to symlinks may be difficult with Linux and Unix, try Android (xattr?).
Cygwin symlinks are actual files, and can have file attributes (using 'chattr').

You can also run Lubuntu direct from live cd-dvd or usb.


If you need to install the 'VirtualBox Extension Pack', use Commader as Admin:


Helpful commands for Android, alter to suit, various commands also work with Commander, enjoy:

18th March 2019, 04:08 PM |#5  
OP Junior Member
Flag Near London
Thanks Meter: 7
Donate to Me
How to convert a less common drive image into a more common drive image, and then convert it into a virtual drive image, which is dynamic and is 12GB in size.
In this example I will be using 'NomadBSD' which normally flashes to a USB, and has no drive install method (setup for current drive, usb).

First I need to convert the '.efi' file into an '.img' file using Commander || dd if=D:\Files\Downloads\nomadbsd-1.2-RC2.efi of=D:\Files\Downloads\NomadBSD.img
Next I convert it into a dynamic '.vdi' file || "C:\Program Files\Virtual Box\VBoxManage" convertfromraw -format VDI "D:\Files\Downloads\NomadBSD.img" "D:\Files\Downloads\NomadBSD.vdi" --variant Standard
Now I want to resize it to 12GB || "C:\Program Files\Virtual Box\VBoxManage" modifyhd "D:\Files\Downloads\NomadBSD.vdi" --resize 12288
I prefer another format '.vmdk' || "C:\Program Files\Virtual Box\VBoxManage" clonehd "D:\Files\Downloads\NomadBSD.vdi" "D:\Virtual\NomadBSD.vmdk" --format vmdk
Next I delete unused files || del /f D:\Files\Downloads\NomadBSD.img & del /f D:\Files\Downloads\NomadBSD.vdi
For good measure I check before closing || ls D:\Files\Downloads\ & ls D:\Virtual\

Now setup VirtualBox, when at the drive setup part, drag and drop your created drive into the VirtualBox created folder, in this case 'D:\Virtual\Nomad\'.
Select 'Existing drive' and add your created drive image, I have a SSD, so I also check the 'SSD' option within the machine preferences.


How to setup nomad as a virtual guest:

sudo su
pkg update && pkg upgrade
pkg install virtualbox-ose
pw groupmod vboxusers -m nomad
pw groupmod operator -m nomad
pkg autoremove

geany /boot/loader.conf

Add || vboxdrv_load="YES"
Add || vboxvfs_load="YES"

geany /etc/rc.conf

Add || vboxservice_enable="YES"
Add || vboxguest_enable="YES"



How to mount a drive img:

After mdconfig (see post 4) || sudo dsbmc || This will open the mount manager as 'root'.
Generic method || sudo mount -t FILESYSTEM /DEVICE /LOCATION


How to fix the screen resolution:

Menu > Settings > ARandR > Outputs > Select a supported resolution > Save as: monitor > Open Pcmanfm > View > Show Hidden > .screenlayout > Edit '' to suit.

Menu > Settings > DSBAutostart > Add: ~./screenlayout/ > Move up to the top > Delete: redphase, batterymon and the audio monitor.


How to setup shared folders:

In your virtual machine, select: Settings > Shared Folders > Add > Select your folder, but don't bother with auto-mount as it does not work with FreeBSD.

Now I make a folder to mount my shared folder || mkdir ~/Files & chmod 777 ~/Files || Note '~' means current user home: /home/nomad

Next I create a script that will auto-mount drives || >~/.config/
Now I need to edit the script || geany ~/.config/
Header: #!/bin/sh || Code: mount -t vboxvfs Files ~/Files

Next I add the script to auto start || dsbautostart



Note for Lubuntu:

To install Lubuntu on virtualbox, disconnect the network cable (in preferences), I believe a web address has changed.
Do not 'disable' the virtual adapter, otherwise the install will not setup any drivers by default.


How to create a shared storage drive:

This method uses a virtual drive with NTFS as a universal filesystem bridge between OS's.
The drive can be mounted via Windows, which allows you to transfer files.


Drive image files (example, system.img) can be directly mounted from the storage.
Remember to unmount, detach the virtual disk in Windows.


If you have 'su', superuser on your phone, you can use Commander as the terminal:

adb shell || Then || su || To test || ls /system/bin


Helpful links:

Linux manual | FreeBSD manual | A-Z bash commands | ADB shell manual

2nd April 2019, 08:21 PM |#6  
OP Junior Member
Flag Near London
Thanks Meter: 7
Donate to Me
Android for PC, can be used in VirtualBox, or installed to a hard-drive or usb-flash.

Recommended: PrimeOS - I tested the classic edition.
Other: PhoenixOS, Bliss ROM's, Android-x86.

My UEFI motherboard allows me to fully power down internal sata devices.
This prevents boot installers from overwriting the current one.

Tip: You can download apps (example: Terminal) via the market or Chrome.

5th April 2019, 05:22 PM |#7  
OP Junior Member
Flag Near London
Thanks Meter: 7
Donate to Me
Guide updated slightly, also the command 'cp' can preserve attributes, including symlink attributes (noatime).
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes