Command Line Basics for Windows and Linux

Command Line TerminalToday’s subject is, by popular demand, a continuation of last week’s introduction to the command line.

The conversation that I’m calling “popular demand” went something like this:

Mom: You left me hanging! That’s the first time I’ve ever brought the command post up in my life, and now I don’t know what to do with it!

Me: …do you mean the command prompt?

Mom: Yes! That’s what I mean!

So now that you have your command line open (or know how to re-open it), let’s make use of it.

On every command line is a prompt, or a short line of text, after which you enter in your command.

The prompt may look something like one of the following examples:

C:\Users\Gwen>

[gwen@localhost ~]$

[root@localhost ~]#

The prompt usually gives some indication of which directory you are in and/or what your user name is.

After you type your command, you have to press the Enter key (also called the return key) to run it.

When the command has finished running, a new prompt will show up, ready for your next command.

Basic Commands for the Windows Command Line

These simple commands are a good starting point. The will get you familiar with running commands, but will not allow you to do damage (or much of anything) to your system.

chdir will display the path to your current directory location.

systeminfo will display details about your computer and operating system.

dir will show a list of files and folders at your current location (directory).

ping will check to see if there is a network connection to the specified location. (Examples: ping localhost to find yourself on the network, ping takingnothingforgranted.com to see if you can reach this site.)

Ctrl+C will terminate a running command.

hostname will show you what your PC is named.

start followed by the name of a program (eg. notepad or explorer or firefox) will open a new instance of that program.

doskey /history will show a list of commands that have been executed in the command line (this session only).

cls will clean up the command line screen by removing previous commands/results.

help will give you a list of commands that could be run.

Use help followed by the name of a command to view the manual for that command, and find out what options are available for it.

exit will close the command line window.

Note: The Windows command line is not case-sensitive.

Basic Commands for the Linux Command Line

Running commands on Linux differs a little from the commands used on Windows. Some are the same, some are similar, and others are completely different.

pwd will “print working directory”, that is to say it will display the path to your current directory location.

uname will display details about your computer and operating system.

ls will show a list of files and folders at your current location (directory).

ping will check to see if there is a network connection to the specified location. (Examples: ping localhost to find yourself on the network, ping takingnothingforgranted.com to see if you can reach this site.)

Ctrl+C will terminate a running command (such as a never-ending ping, if you tried out the above command).

history will show a list of commands that have been executed in the command line.

hostname will show you what your PC is named.

Type in the name of a program (eg. kate or dolphin or firefox) to open a new instance of that program. Use an ampersand (&) at the end of the file name to run the program in the background and free up your command prompt.

clear will clean up the command line screen by bumping previous commands and responses out of sight.

help will give you a list of commands that could be run.

Use man followed by the name of a command to view the manual for that command, and find out what options are available for it.

exit will close the command line window.

Note: The Linux command line is case-sensitive.

Conclusion

Hopefully this will not only tide you over, but also whet your appetite for our next lesson on the command line, where we can begin to actually make some changes.

Leave a Reply

You have to agree to the comment policy.

Scroll to top