Hello, this is George again, and today I’d
like to teach you how to navigate across the command line directory, showing
you how to make and remove directories, and how to move files between them.
Directories are a lot like files on Windows in that they contain the exact same
files and addresses, but only come in text form on command. Many machines used
in businesses don’t make use of native GUIs, and many consoles use command line
OSs to avoid clutter and space being taken on their hardware to ensure
efficiency. Learning to use a command line is crucial in these cases.
First,
use cd to navigate to your main hard drive of choice, using the cd command and the address of your hard
drive (i.e. cd C:\ for most users.)
When you’ve
navigated to the main drive of your choice, enter the following command : mkdir [name]
This
tells the computer to make a directory (a folder in Windows) at the address
your currently on. When you’ve finished making the directory, use cd C:\[name]
to navigate into your new directory and enter another new directory with mkdir [name2], which will represent a new
sub directory of the current directory. Use cd C:\name\name2 to navigate to the new directory.
From here,
type in this command dir. This
command will output the current contents of the directory your on; for now it’s
won’t output any names to the far right, but two lines: ‘.’ And ‘..’ Type cd .. to navigate back to the previous
directory, the first one you made.
Now,
enter notepad and create a new txt file for demonstration purposes, adding any
text inside you’d like, if at all. This txt file will be used to demonstrate some
more commands, and that’s all. When this file is finished, save it and exit Notepad,
then enter dir to see the contents
of your directory; you should see the new file you’ve made listed as a txt
file.
Now to
demonstrate the move command: First,
use the new text file you’ve made and enter it into the sub directory name2 by typing: move txtfile.txt name2 (remember to include the .txt at the end of
the file. This will move the text file to the new sub directory, and you can
use cd to navigate to that directory
and use dir to find the text file.
Now, using move again, we will change the name of the .txt file you’ve just moved: this is the other use of the move command, and it is the keyword used in the Windows GUI when you rename a file with right-click!
Now, using move again, we will change the name of the .txt file you’ve just moved: this is the other use of the move command, and it is the keyword used in the Windows GUI when you rename a file with right-click!
This of
a new name for the .txt file, and enter the following : move oldName.txt newName.txt. Then try dir to test your new text file name.
But
remember to make it different than the current name somehow, because
capitalization isn’t relevant to this command, but it can’t be the same
sequence of characters used from the oldName:
(i.e move txtFile.txt txtfile.txt will not
work, and will return an error)
Now to
clean up the project without the GUI, follow the next two commands closely, to
avoid damage to the hard drive and minimize risk! First use del textFile.txt to eliminate your text
file from the current directory [name2].
Use dir to ensure the file was
removed.
Finally,
navigate with cd to the first
directory [name], then enter rd [name2] to remove the sub directory
from [name]. The navigate back to
the main hard drive to remove the first directory: rd [name].
Finally,
type exit to return from the command line window and close it! Ok, recap and practice
these commands at your leisure, with definitions below!
mkdir - Make a new directory at the
current address.
cd - Change Directory (equivalent of
print working directory (pwd) when no argument is present)
(also,
use 'cd ..' to move back a directory)
dir - Outputs a list of the contents
of the current directory.
move - Move the files into another
directory with a directory, and rename a file with a new file name.
del - delete files from directory
rd - remove directories
No comments:
Post a Comment