Skip to main content

Make your Windows command line better

In my current project, I am stuck with Windows 7 which means no Bash :(
I could have installed Cygwin as usual but this time, I decided to extend my knowledge of the Windows command line and I found this: doskey. With the doskeys defined below, the Windows command line is still far from being as powerful as an old good Bash but it is a bit more user friendly.
Even better, I found the Windows PowerShell which has familiar notions like profile and aliases.

The doskeys I use:
:: http://technet.microsoft.com/en-us/library/bb490894.aspx
:: F7 = history
:: Alt+F7 = history -c
:: F8 = Ctrl+R
:: Use & to run multiple commands e.g.: command1 & command2
:: Add this file as a REG_SZ/REG_EXPAND_SZ registry variables in HKEY_LOCAL_MACHINE\Software\Microsoft\Command or Processor\AutoRun HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
@echo off
:: Linux commands
doskey alias = doskey $*
doskey cat = type $*
doskey clear = cls
doskey cp = copy $*
doskey cpr = xcopy $*
doskey grep = find $*
doskey history = doskey /history
doskey kill = taskkill /PID $*
doskey ls = dir $*
doskey man = help $*
doskey mv = move $*
doskey ps = tasklist $*
doskey pwd = cd
doskey rm = del $*
doskey rmr = deltree $*
doskey sudo = runas /user:administrator $*
:: Easier navigation
alias o = start $*
alias oo = start .
doskey .. = cd ..\$*
doskey ... = cd ..\..\$*
doskey .... = cd ..\..\..\$*
doskey ..... = cd ..\..\..\..\$*
:: Maven
:: Requires M2_HOME\bin to be added to the Path environment variable
:: -rf --resume-from <project>
doskey mci = mvn clean install
doskey mcis = mvn clean install -Dmaven.test.skip
doskey mcp = mvn clean package
doskey mcps = mvn clean prepare-package war:exploded -Dmaven.test.skip
doskey mct = mvn clean test
doskey mvns = mvn $* -Dmaven.test.skip=true
:: User specific doskeys
:: Add your own doskeys below
view raw doskey.bat hosted with ❤ by GitHub

My PowerShell profile:
# http://technet.microsoft.com/en-us/library/ee692685.aspx
# F7 = history
# Alt+F7 = history -c
# F8 = Ctrl+R
Set-Location C:
# Easier navigation
Set-Alias o start
function oo {start .}
function .. {Set-Location ..}
function ... {Set-Location ..\..}
function .... {Set-Location ..\..\..}
function ..... {Set-Location ..\..\..\..}
#
function google ($q) {start http://www.google.com/?#q=$q}
function so ($q) {start http://stackoverflow.com/search?q=$q}
# Maven
# Requires M2_HOME\bin to be added to the Path environment variable
# -rf --resume-from <project>
function mci {mvn clean install}
function mcis {mvn clean install '-Dmaven.test.skip'}
function mcp {mvn clean package}
function mcps {mvn clean prepare-package war:exploded '-Dmaven.test.skip'}
function mct {mvn clean test}

Recommended link:

Comments

Popular posts from this blog

IntelliJ IDEA not starting: Initial heap size set to a larger value than the maximum heap size

IntelliJ IDEA didn't want to start this morning. Got the following error when trying to start it from a shell: Error occurred during initialization of VM Initial heap size set to a larger value than the maximum heap size What happened is that IntelliJ IDEA loaded the JVM Options from the new custom vmoptions file in the config directory. On Windows: %APPDATA%\Roaming\JetBrains\IntelliJIdea2020.1\idea64.exe.vmoptions On macOs: ~/Library/Application Support/JetBrains/IntelliJIdea2020.1/idea.vmoptions This file was not updated properly when I updated IntellIJ IDEA. It contained: -Xms4g -Xmx2048m Fixed the issue by editing this file: -Xms4g -Xmx4g Source: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004701620-idea-vmoptions-not-used-by-default  

Accessing a Docker container running in a Docker-Machine on localhost

On Linux you can access your running Docker container on localhost or remotely by publishing the desired port. On macOS it will only give you access to the Docker container from the Docker-Machine it is running on, i.e. from docker-machine ip <machine_name> . To access it on localhost, you can use ssh port forwarding: docker-machine ssh <machine_name> -fNTL <local_port> :localhost:<machine_port> You can now access your Docker container on localhost:<local_port> . Bonus: Accessing your Docker container from a remote computer. By default, with ssh -L , the local port is bound for local use only. You can use the bind _address option to make your Docker container available publicly: docker-machine ssh <machine_name> -fNTL \*:<local_port>:<localhost>:<machine_port> You can now access your Docker container on <your_ip>:<local_port> .

VSCode in the Browser: Coder vs Gitpod vs Codespaces

Coder SaaS doesn't seem to be for individuals → "Request Demo". But they have a Setup Guide if you want to give it a try. I didn't as I just want SaaS. N.B.: Differences compared to VSCode? TL;DR: Some extensions might be missing. Gitpod Go to https://gitpod.io/#/https://github.com/<your_repository> and login with your GitHub account. Done! Also works with GitLab. Based on Eclipse Theia which is based on Visual Studio Code . Same as Coder. Some extensions might be missing. Free tier gives you enough to give it a try: 50 hours / months Public Repos Private Repos (30-Day Trial) Codespaces (Preview) Slower setup compared with Gitpod: Register to Microsoft Azure Create a Billing Plan. Timed out the first time Create Codespace Done! Full-fledged Visual Studio Code in the Browser! Freebies : 12 months of popular free services £150 credit to explore Azure for 30 days Azure free account FAQ Pricing. Conclusion I'll try both Gitpod and Codespaces in the upcoming w...