DEV Community

Cover image for How cmder made my life easier

How cmder made my life easier

drissboumlik profile image Driss Boumlik ・Updated on ・6 min read

As developer I always look for ways to automate and/or shortcut my day to day tasks, Today I would love to share with you my favorite command line tool and show you how you can benefit from it’s features.

Get Cmder

First things first, this is for windows users and here is the link to download cmder
scroll down to download section.
Personnaly I take the Full version (Both of them are Portable versions)

Alt Text

Then you can head to the shortcut section (very useful)

Alt Text


Here is a bonus
Personnaly I extract cmder inside C:/cmder directory then I add the cmder path like this
1- Open the 'Advanced system settings'

Alt Text

2- Got to 'Environment Variables..'

Alt Text

3- Select 'Path' then click on 'Edit...'

Alt Text

4- Click 'New' and add the cmder path

Alt Text

After that ,you can type the cmder on the directory path field

Alt Text

and this will open cmder pointing to that directory

Alt Text

Wouff, finally lets get down to business

Visual Part

Note :

Before we start, you need to know that cmder supports linux commands such as touch file, nano file .. etc, which is amazing already πŸ₯³.

I always hated 😣 to write commands on the same line on the default command tool windows, which is not the case with cmder.

Alt Text

Tabs, Tabs, Tabs

Cmder allows to create tabs which is very useful when you are running multiple stuff like angular, node, laravel artisan, ...etc and this prevents from being overwhelmed with lot of opened command windows - One window, Multiple tabs 😎

Alt Text

Another thing about tabs is that (I love this 🀭) you can split into two (or more) sections

Alt Text

To make this happen you (images below)
1- Got to tasks section
2- Click the + button to add new task
3- Give it a name
4- Add this code to the snippet section

-cur_console:s50H:d: -cur_console:C:C:\cmder\icons\cmder.ico cmd /k ""%ConEmuDir%..\init.bat" "

5- Add a Hotkey if you like

Alt Text
Alt Text


Let's say you type a command and you get an output and (may be you're overwhelmed 😱 by how large 😡 the output is), and you want to search for a text, you can use (image below)

Alt Text

And just like bash, you can search for previous typed commands via this shortcut 'Ctrl + R', (1) is what I'm typing and (2) is what matches my search

Alt Text

Tech Part

Simple alias

Now I will tell you about one of my favorite things about cmder "ALIASES" 🀩🀩.
As a developer I type lot of command lines but there are certain commands that we type more than others : (example for (git : git status, git commit -m "message") or (angular : ng g c myComponent) or (laravel : php artisan make:migration myMigration) or ..... etc)
so to create an alias you just have to type

alias 'the alias you like'='the command you hate to write every time'

example here : replacing git status with gs

alias gs=git status

Alt Text

Alias with parameters

Q: But wait what if I want to have parameters in my commands
A: I didn't create cmder 🀣 ... just kidding, of course you can add parameters, here is an example of replacing git add file/directory

alias ga=git add $*

the $* means what ever comes after your alias (your parameter)

Alt Text

Q: What if I want to have a parameter in the middle of my command
A: Again, I didn't ... 🀣🀣, of course you can
Here is how you can do and use it (example : creating laravel controller)

alias pamkc=php artisan make:controller $*Controller

pamkc => initials of 'php artisan make:controller
to use this alias :

pamkc Post

this will create a PostController.php file

Alt Text

Q: What if I want to have more than one parameter in my command
A: Again, of course you can
You can do something like (example : serve a laravel app on different host and port)

alias pashp=php artisan serve --host $1 --port $2

to use this alias :

pashp 8888

Be careful about the order of your parameters ($1 = and $2 = 8888) 😬

Alt Text

Before you ask βœ‹ any other question, here is how you can use the same parameter in more than one place (example : creating a laravel factory for a specific model)

alias pamkf = php artisan make:factory $1Factory --model=$1

to use this alias :

pamkf Post

The result will be

php artisan make:factory PostFactory --model=Post

Alt Text

One alias, multiple commands

Now let's see how to chain more than one command in one alias.
Example: Sometimes you want to switch to another partition, so you are in C:, and you want to switch to E:\MyDirectory, you type 'cd E:\MyDirectory' but you see nothing until you type 'E:', then your switch is done and you're now in 'E:\MyDirectory', this brings me to another thing I like which is creating aliases for directories.
Example :

alias desktop=cd C:\Users\UserName\Desktop\ $t C:

which will take me to my desktop then ($t) execute second command 'C:' to force it into the 'C:' partition (just in case I'm in a different partition)

You can also make alias for files / programs
Example :

alias npp="C:\Program Files\Notepad++\notepad++.exe" $*

Here I'm running notepad++ editor with parameter $* which is the file i want to open.

Final Thoughts

Personally I'm currently satisfied with cmder, but I can't say if it's the best, may be other tools exists out there way better than cmder, but the idea is about "Always look for ways to get things done better, faster, cleaner".
Thanks for reading

Before you close this window I would like to share my list of aliases I use

For Explorer

e.=explorer .
exp=explorer $*

For Git:

ga.=git add .

ga=git add $*

gaa=git add .

gs=git status $*

gb=git branch $*

gc=git commit

gck=git checkout $*

gcl=git clone $*

gcm=git commit -m "$*"

gd=git diff $*

gi=git init

gl=git log

gm=git merge

gpl=git pull $*

gplbit=git pull bitbucket master $*

gplgit=git pull github master

gplo=git pull origin $*

gplom=git pull origin master $*

gps=git push $*

gpsbit=git push bitbucket master

gpsgit=git push github master

gpso=git push origin $*

gpsom=git push origin master $*

gr=git reset $*

grfl=git reflog $*

grh=git reset --hard $*

grhh=git reset --hard HEAD

grs=git reset --soft $*

grm=git rm $*

grv=git remote -v


ni=npm install $*

nu=npm update

nrb=npm run build

nrd=npm run dev

nrs=npm run serve

nrw=npm run watch

For Composer

ci=composer install

cu=composer update

cmpref=composer dump-autoload

For Angular

nggc=ng generate component --skipTests $*

nggcs=ng generate component $*

nggd=ng generate directive --spec=false $*

nggds=ng generate directive $*

nggs=ng generate service --spec=false $*

ngs=ng serve

ngsa=ng serve --aot

For Laravel

pa=php artisan $*

padbs=php artisan db:seed $*

pakg=php artisan key:generate

pam=php artisan migrate

pamf=php artisan migrate:fresh

pamfs=php artisan migrate:fresh --seed

pamk=php artisan make:$*

pamkall=php artisan make:model $1 -m -c -f $t php artisan make:seeder $1sTableSeeder

pamkc=php artisan make:controller $*Controller

pamkcmp=php artisan make:component $*

pamkcr=php artisan make:controller $*Controller -r

pamkf=php artisan make:factory $1Factory --model=$1

pamkfm=php artisan make:factory $1Factory --model=$2

pamkmdl=php artisan make:model $*

pamkmg=php artisan make:migration create_$*_table

pamkmm=php artisan make:model $1 -m

pamkmmc=php artisan make:model $1 -m -c

pamkmmcr=php artisan make:model $1 -m -c -r

pamkr=php artisan make:resource $*Resource

pamkrc=php artisan make:resource $*Collection

pamks=php artisan make:seeder $1sTableSeeder

pams=php artisan migrate --seed

parl=php artisan route:list

pas=php artisan serve

pash=php artisan serve --host $*

pashp=php artisan serve --host $1 --port $2

pasp=php artisan serve --port $*

pasph=php artisan serve --port $1 --host $2

pat=php artisan tinker

pav=php artisan --version

rfl=composer dumpautoload $t php artisan optimize $t php artisan cache:clear $t php artisan view:clear

For Docker

dc=docker-compose $*

dcx=docker-compose exec $*

dk=docker $*

dkim=docker image $*

dkimls=docker image ls $*

dkims=docker images $*

dkimsa=docker images -a $*

dkll=docker kill $*

dksp=docker system prune $*

dkspa=docker system prune -a $*

dps=docker ps $*

dpsa=docker ps -a $*

rmcn=docker container rm $*

rmim=docker image rm $*

Discussion (0)

Forem Open with the Forem app