121k views
3 votes
Use the pwd command to show that the present working directory is the home directory, and then set the PS1 shell variable to your student number so that your shell prompt looks like this: u12345678-task1:=> (if your student ID was u12345678)

User Vkg
by
7.1k points

1 Answer

4 votes

Final answer:

To display the home directory, use the 'pwd' command. Then set the 'PS1' shell variable with 'export PS1='u12345678-task1:=> '' to change the shell prompt to your student number, where 'u12345678' should be replaced with your actual student number.

Step-by-step explanation:

To confirm that the present working directory is the home directory, you can use the pwd command in the terminal. Once you have verified that you're in the home directory, you can change the shell prompt to display your student number. The shell variable responsible for the prompt is PS1. You will use the export command to set this variable.

Here's a step-by-step explanation of how to set your prompt:

  1. Open the terminal.
  2. Type pwd and press Enter to execute the command. Confirm that the output is the path to your home directory, usually represented as ~ or something like /home/yourusername.
  3. To set the PS1 variable to your student number, type the following command:
  4. export PS1='u12345678-task1:=> '
  5. Press Enter. Now, your prompt should change to reflect your student number.

Remember to replace 'u12345678' with your actual student number. The shell prompt will now display your student number followed by -task1:=> before each command you type.