0% found this document useful (0 votes)
3 views4 pages

IA212-Assignment 2

The document provides a step-by-step guide for an assignment on using the command line or terminal, including accessing the terminal, executing commands, and retrieving help documentation. It emphasizes the importance of command syntax, case sensitivity, and navigating manual pages. Additionally, it covers command history and techniques for recalling previous commands in the Bash shell.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

IA212-Assignment 2

The document provides a step-by-step guide for an assignment on using the command line or terminal, including accessing the terminal, executing commands, and retrieving help documentation. It emphasizes the importance of command syntax, case sensitivity, and navigating manual pages. Additionally, it covers command history and techniques for recalling previous commands in the Bash shell.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

IA212 Command Line Basics

Assignment 2: Getting to Know the Command Line or Terminal


 Write your answer to the questions in your report. Take screenshots for steps
marked with “***”

1. Accessing the Command Line

1. Log on and open the terminal. There are multiple ways. Pick what works best for
you.
a. Open in applications and find terminal
b. Ctrl + Alt + T
c. Right click on desktop and open terminal

2. After the terminal emulator window is open, you should see a command line prompt
ending in a dollar sign ($).

3. ***At the prompt, type whoami and press Enter.


a. You should see the user account name you used to log in to the system (though
the name may be slightly different than what you saw when you logged in via the
GUI), and then another command line prompt.
Record the account name (also called username) here: __________

4. At the prompt, type date and press Enter.


a. You should see the date and time (or at least what the computer thinks the date
and time is currently), and then another command line prompt.

5. This next command won’t work. Type Date and press Enter.
a. You should see a message that says “command not found” or something
similar. This is because all command line commands are case sensitive.
b. In other words, date does not equal Date!

2. Getting Help on the Command Line

1. ***At the CLI prompt, type man man and press Enter.
a. The manual command is the help page for commands. In this case we are asking
for the manual for the manual command.

2. Within the help for the man pages, read through the Description; Manual Sections;
and all the Options.
a. Use either the arrow keys, the Enter key, or the space bar to move through the
displayed text.

1|P a g e
IA212 Command Line Basics

Below, write the standard "Manual Sections":


1. ____________________________

2. ____________________________

3. _____________________________

4. _____________________________

5. _____________________________

6. _____________________________

7. _____________________________

8. _____________________________

9. _____________________________

3. Getting Help on the Command Line (continued)

1. Type q to quit the man pages and return to the prompt.

2. Type man uname and press Enter.


a. Notice that at the top left and right of the manual page, the uname command is
displayed with a (1) behind it, and in the middle of the top of the page are the
words "User Commands."
b. These items appear at the top of the man page because this man page is within
the User Commands standard section of the manual (\

3. Type q to quit the man pages and return to the prompt.

4. ***Type man -S 2 uname and press Enter.


a. Notice that at the top left and right of the manual page, the uname command is
displayed with a (2) behind it this time, and in the middle of the top of the page
are the words "Linux Programmer's Manual."
b. You see these items at the top of the man page because this man page is within
the Linux Programmer's Manual standard section of the manual.
c. To reach different sections of the man pages, use the -S option. You can also
use a different command syntax: man 2 uname has the same effect.

2|P a g e
IA212 Command Line Basics

5. Type q to quit the man pages and return to the prompt.

6. ***See what various sections there may be for the uname command by typing man -K
uname and pressing Enter.
a. There should be several results listed! The -k stands for "keyword." The whatis
database allows you to search through it for certain man pages keywords to find
helpful information and learn which sections the information is in, using the -k
option.

7. The man pages all live in the /usr/share/man/ directory.


a. You can see the different man page sections and miscellaneous files located
there by typing ls /usr/share/man/ and pressing Enter.
b. Notice the man1 and man2 files. These are actually directories that contain the
various man pages.

8. ***You can find the various files with the name “uname” that may be associated with the
uname command, including the man pages.
a. Try this out: type whereis uname and press Enter. The output is not very easy
to read, because it’s not formatted nicely.
b. The whereis command searches particular directories to find files associated with
the name you give it.

9. ***You get a lot more system information, including the Linux kernel's version number,
by typing uname -a and pressing Enter.

10. One more source of documentation is the directory /usr/share/doc.


a. Take a look at this directory by typing ls /usr/share/doc and pressing Enter.
b. Nothing too exciting here, but you should be aware of this directory if you are
searching for documentation on your Linux system.

11. Take a look at a specific documentation file by typing in the command


less /usr/share/doc/ and pressing Enter.
a. The /usr/share/doc directory has miscellaneous documentation, such as various
products’ licenses.

12. Press Enter a few times to read through the license, and then type q to quit and return
to the prompt.

4. Looking at Command History

1. Type whoami and press Enter to display your current username.

3|P a g e
IA212 Command Line Basics

2. Here's an interesting little trick: Type !! and press Enter.


a. You should see that the Bash shell "re-issued" the command from the step
above.
i. The !! command "pulls out" the last command you did from your
command history, displays the command, and runs it again.

3. To see all your command history (commands you have previously entered in the
bash shell), type history and press Enter.
a. You should see several commands listed along with a number by each one.

4. ***Pick one of the commands from the history list and note its number.
a. Type !# (where # is the number of the command in your history) and press
Enter.
i. The command should display and execute!
b. This is another method, besides the up arrow key, you can use to recall
previous commands.

4|P a g e

You might also like