Exploring the potentials of your PC (THE COMMAND LINE 2)

2 36
Avatar for Davis
Written by
4 years ago

Good Day Guys and a happy New Month to each and every one of you. This article kicks off from where my previous article β€œEXPLORING THE POTENTIALS OF YOUR PC” stopped. The aim of this series is to make open various things you can do with your PC and we started on exploring the command line of the windows operating system. Previously, we were able to navigate through directories comfortably on the command line, list the various contents of a directory and so on. We have lots of interesting to learn and we are going to achieve that completely by the time we must have come to an end of this series.

Let’s go a little bit more advanced on what we did last time before we get to what we have to do;

  • MORE ON LISTING FILES AND DIRECTORIES

Like we did before, to list the contents of a directory; we just have to navigate to the location and use the command dir

HERE I NAVIGATED TO THE DESKTOP DIRECTORY AND USED THE DIR COMMAND AS WE SAW IN THE PREVIOUS ARTICLE
  • Β  Now to the big question; What if I just want to list a particular type of file ??

Β To do this you just have to use the command dir *.### (where you replace the ### with the file type you want to list)

In this context, * just plays like a wild card. For example, let me say I just want to list just the documents (the .docx file type); I would use the command dir *.docx ; this command simply means give me a list of all files that are word documents.

AS YOU CAN SEE, HERE I USED THIS COMMAND IN THE SAME DIRECTORY I WAS WORKING ON IN THE FIRST IMAGE, BUT THIS TIME AROUND, IT JUST GAVE ME A LIST OF ONLY THE FILES THAT ARE DOCUMENTS WITH THE .DOCX FILE EXTENSION

TIPS:

  • whenever your screen gets messy, instead of opening another window; you can just use the command cls

  • You can use the up and down arrow keys to go through your command history rather than typing same commands over and over again.

  • You can discover all the options associated with a command by adding a /? after the command. For example: using the /? option after the color command (color /?) will give you a list of all operations you can perform with the command, same thing applies to the dir command (dir /?), the cd command (cd /?) and so on.

OPENING FILES ON THE COMMAND LINE

This is a very simple task you can execute on the command line. This is executed in a faster and simpler way when compared to how this task will be carried out with our normal GUI. To do this:

  • Navigate to the directory that contains the file you want to open.

  • Type the complete name of the file you want to open and hit enter.

  • The file opens with the default application used to open that type of file on your PC

    TO EXPLAIN THAT I WOULD BE OPENING A DOCUMENT IN MY DESKTOP DIRECTORY IN THE IMAGE BELOW ...

THE COMMANDS ABOVE ARE JUST SIMPLE ONES; I NAVIGATED TO THE DESKTOP FOLDER, LISTED ITS CONTENTS AND THEN TYPED IN THE DOCUMENT I WANTED TO OPEN (metformin.docx) AND THEN IT OPENED WITH MS-WORD BECAUSE IT'S MY DEFAULT APPLICATION FOR OPENING WORD DOCUMENTS

NOTE: I was in the Desktop Directory before I opened the document.

CREATING AND REMOVING DIRECTORIES ON THE COMMAND LINE

  • To create and delete directories on the command line, we use the commands mkdir and rmdir respectively.

    Let's go ahead and create some directories/folders; we would be working in the desktop directory as usual

    HERE I NAVIGATED TO THE DESKTOP DIRECTORY AND USED THE COMMAND "mkdir EXPLORE" AND IMMEDIATELY I HIT ENTER; A DIRECTORY WITH THE NAME EXPLORE WAS CREATED ON MY DESKTOP
    NOW AS YOU CAN SEE, IF I GO TO MY DESKTOP DIRECTORY AND LIST ITS CONTENTS; THE DIRECTORY WE CREATED IS NOW LISTED AS ONE OF ITS CONTENTS

ALRIGHT LET'S GO AHEAD AND DELETE THE DIRECTORY WE JUST CREATED; TO DO THAT WE JUST USE THE COMMAND "rmdir EXPLORE"

THE MOMENT I USED THAT COMMAND, THE FOLDER WAS DELETED FROM MY DESKTOP

Let's go more advanced in this aspect of creating and deleting Directories; To do that let's create a new directory (named EXPLORER) on our Desktop and then we create two other directories inside the new directory we created {EXPLORER1 AND EXPLORER2 RESPECTIVELY}. Mine is shown in the image below;

WITH THESE SET OF COMMANDS DISPLAYED, I HAVE SUCCESSFULLY ACHIEVED WHAT WE WERE ASKED TO DO ABOVE
YOU CAN VISIBLY SEE THE OUTPUT OF WHAT WE JUST DID ON OUR COMMAND LINE RIGHT HERE ON OUR GUI

LET'S TRY TO DELETE THE EXPLORER DIRECTORY THE SAME WAY WE DELETED THE FIRST DIRECTORY WE CREATED EARLIER IN THIS ARTICLE

ACTUALLY WE WERE NOT ABLE TO DELETE THIS DIRECTORY BECAUSE IT IS NOT EMPTY

HOW DO YOU DELETE A DIRECTORY WITH ITS CONTENTS ?

To do that, We simply use the command rmdir /s **** (WHERE **** IS THE NAME OF THE DIRECTORY WE WANT TO DELETE)

IF WE USE THAT COMMAND, IT WILL GIVE YOU A PROMPT TO CONFIRM YOUR ACTION; ALL YOU HAVE TO DO AT THIS POINT IN TIME IS TO SIMPLY TYPE THE CAPITAL LETTER "Y" AND HIT ENTER

ONCE YOU FOLLOW THE STEPS ABOVE, YOU WOULD SUCCESSFULLY DELETE THE DIRECTORY AND ITS CONTENTS

OK GUYS, I WOULD SIMPLY END THIS ARTICLE HERE AND CONTINUE ON THE NEXT ONE πŸ˜ͺπŸ˜ͺ; HOPE YOU LEARNT SOMETHING COOL πŸ₯‚πŸ₯‚. SEE YOU SOON... AND THANKS FOR READING😊😊.... Don't forget to like and drop a comment ✍️✍️

Sponsors of Davis
empty
empty
empty

@micropresident @MarcDeMesel @Read.Cash @Secure @scottcbusiness

9
$ 0.07
$ 0.07 from @yara
Avatar for Davis
Written by
4 years ago

Comments

Get nice article keep it up

$ 0.00
4 years ago

nice article u have cheers :)

$ 0.00
4 years ago