DEV Community

Cover image for 🍑understanding windows Command Line Interface
aryan015
aryan015

Posted on

🍑understanding windows Command Line Interface

A little command line crash course
tip:

  1. use tab for avoid writing complete name.
  2. use up/down arrow key for recently used command.

How to exit from the cmd

>exit
Enter fullscreen mode Exit fullscreen mode

how to terminate any running process

ctrl+c will cause termination of any running operation and will bring you to command line prompt.

get help with particular command

>help <command-name>
Enter fullscreen mode Exit fullscreen mode

How to change drive in CMD

put the drive alphabet along with colon

>c: # navigate to c
>d: # navigate to d 
Enter fullscreen mode Exit fullscreen mode

How to clear the console

use cls

>cls
Enter fullscreen mode Exit fullscreen mode

Navigate to folder with space

cd to naviagate to any folder( not drives)

>cd "new folder"
Enter fullscreen mode Exit fullscreen mode

navigate to multiple levels

cd with complete path

>cd aryan/movies
Enter fullscreen mode Exit fullscreen mode

list all files and folders

dir to list files and folders

>dir 
Enter fullscreen mode Exit fullscreen mode

get clean list

dir /b it will clear the clutter

>dir /b
Enter fullscreen mode Exit fullscreen mode

navigate to backward

cd .. will cause one level backward

cd .. # cd ../
Enter fullscreen mode Exit fullscreen mode

navigate to multiple backward

cd / will cause root level

>cd /
Enter fullscreen mode Exit fullscreen mode

how to make directory

>mkdir "folder name" # make in current directory
>mkdir "aryan khandelwal"/"folder name" # nested cmd
Enter fullscreen mode Exit fullscreen mode

remove directory

careful deleted items won't be recoverable from recycle bin♻
🚮

>rmdir "file name"
Enter fullscreen mode Exit fullscreen mode

remove non-empty directory

careful deleted items won't be recoverable from recycle bin♻

>rmdir /s "file name"
Enter fullscreen mode Exit fullscreen mode

create a file with pre-content

# cmd #1
# below cmd will create a filename.txt with "" inside it.
>echo "" > filename.txt
# cmd #2
>copy con filename.txt
happy halloween
happy Christmas
# ctrl+z and enter to save
Enter fullscreen mode Exit fullscreen mode

del files

not reversable

>del /p file.txt # delete file.txt with confirmation
>del /P *.txt # it will delete all files in current dir with confirmation. Omitting it might cause fatal damage.
Enter fullscreen mode Exit fullscreen mode

command chaining (order matters)

below command will make dir and point to it.

>mkdir "hello world" && cd "hello world"
Enter fullscreen mode Exit fullscreen mode

sequential execution

suppose there is not folder 📁 with the name aryan k. The second command will run regardless of first command execution.

>cd "aryan k" & echo "" > file.txt
# it will create file.txt in current folder
Enter fullscreen mode Exit fullscreen mode

conditional execution

You can control your command if faliure.

>cd "hello" || echo "not exist" # incase of hello not exist it will print "not exist"
Enter fullscreen mode Exit fullscreen mode

part two is coming ♥😉

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

Top comments (0)

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay