Lab: Skills - Using the MSYS Command Shell in Windows

Instructions: Answer as many of the following questions as you can during the lab period. If you are unable to complete the assignment during the lab period it is strongly recommended that you complete it on your own.

1. Starting the Command Shell: This part of the lab will teach you how to start the MSYS command shell in Windows.
1. Click on Start, drag to All Programs, drag to MinGW, drag to MSYS, and click on msys. (Or, double-click on the MSYS icon on the desktop, if tere is one.)
2. In the CS Computer Labs, the MSYS shell prompt contains user information, rather than folder/directory information. Fortunately, you can get the current folder/directory using the command:
pwd
3. What is the current directory?

2. Navigation Basics: This part of the lab will help you learn how to move around the file system.
1. Change the current folder/directory to the root (i.e., top-most) folder/directory of the C drive using the command:
cd /c/
2. Change to the /c/temp folder/directory using the command:
cd /c/temp

In this example, you used an absolute path because you entered the complete path, starting from the root folder/directory.

3. Change to the parent folder/directory using the command:
cd ..
4. Change to the temp subdirectory folder/directory using the command:
cd temp

In this example, you used a relative path because you only entered the subdirectory name.

3. Basic Commands: This part of the lab will help you learn some basic commands.
1. Make sure that your current drive and folder/directory is /c/temp
2. Create the folder/directory named /c/temp/labs using the command:
mkdir labs
3. You just used a relative path to create a folder/directory. How could you have done the same thing using an absolute path?

4. Change your current folder/directory to /c/temp/labs using the command:
cd labs
5. Check the prompt to make sure that you are in the right folder/directory.
6. Get a listing of the contents of the current folder/directory using the command:
ls
7. What was displayed?

8. This shows that there are no files in this directory.
9. Download the file teapot.txt to the folder/directory /c/temp/labs.
10. Get a (long) listing of the contents of the current folder/directory using the command:
ls -l
11. How big is the file teapot.txt?

12. Make a copy of the file teapot.txt named teapot.bak using the command:
cp teapot.txt teapot.bak
13. Delete the file named teapot.bak by typing rm t, pressing the Tab key (this is a feature called command completion), typing b, pressing the Tab key, and pressing Enter.
14. Re-copy teapot.txt to teapot.bak by pressing the UpArrow until the cp command appears (this is a feature called the command history) and pressing Enter.
15. Get a listing of the contents of the current folder/directory using the command:
ls -l
16. How many files are in this folder/directory?

17. Display the contents of the file teapot.txt using the command:
cat teapot.txt
18. Delete all of the files that start with the letter "teapot." using the command:
rm teapot.*