Special File Types   «Prev  Next»

Search Paths | Commands - Exercise

Search Paths and Commands in Unix

Locating commands in Linux and Unix

Objective: Determine where a command is located and modify the search path to use the command.

Exercise scoring

This exercise is not scored. When you have completed the exercise, click the Submit button to continue with the course.

Background

You are the systems administrator for an organization with offices in Bombay, Seattle, and London. Currently, you are in Seattle. You have found that you must reboot one of your UNIX systems. You have learned that the shutdown -t1 -r command will reboot the system. This system is relatively new, and no one has used the shutdown command on it before.

Instructions

In this exercise, you will see how well you understand determining where a command is located and modifying the search path. Although the simulation uses a Linux machine, the process is almost identical across all versions.
Start the simulation below and work through the situation presented.

Linux Command 1
1) Linux Command 1

Linux Command 2
2) Linux Command 2

Linux Command 3
3) Linux Command 3

Linux Command 4
4) Linux Command 4

Linux Command 5
5) Linux Command 5

Linux Command 6
6) Linux Command 6

Linux Command 7
7) Linux Command 7

Linux Command 8
8) Linux Command 8

Linux Command 9
9) Linux Command 9

  1. You are already logged on as root, so shut down the system by typing |||(S1)shutdown -t 1 -r now shutting down|||(S0).
  2. Shutdown system
  3. shutdown -t 1 -r now shutting down
  4. Note the error message. Now, use the |||(S7)whereis|||(S0) command to determine the location of the shutdown file.
  5. The whereis command
  6. whereis shutdown
  7. Type |||(S1)whereis shutdown|||(S0). This will tell you where the shutdown command is located.
  8. Note that the system returns two entries: The first informs you about the location of the actual shutdown file (/sbin/shutdown). The second informs you about the presence of a man file about shutdown. Now, change to the /sbin directory.
  1. Change directories
  2. cd /sbin
  3. Type cd /sbin. Remember that you must refer to sbin as residing off of root, not off your user1 home directory.