Open terminal, you will see the following prompt:
username@hostname:~$If you don't know how to open
terminal, you need to search the internet for some tutorials on how to use Ubuntu.
This prompt shows your username, host name, and the current working directory.
The username should be the same as you set during the installation.
The current working directory is ~ now.
As you switching to another directory, the prompt will change as well.
You are going to code under this environment, so try to make friends with terminal!
Many of you always use operating system with GUI, such as Windows. But the terminal is completely with CLI (Command Line Interface). Have you wondered if there is something that you can do it in CLI, but can not in GUI? Have no idea? If you are asked to count how many lines of code you have coded during the Fundamentals of Programming course, what will you do?
If you stick to Visual Studio, you will never understand why
vimis called The God of Editors. If you stick to Windows, you will never know what is Unix Philosophy. If you stick to GUI, you can only do what it can; but in CLI, it can do what you want. One of the most important spirits of young people like you is to try new things to bade farewell to the past.GUI wins when you do something requires high definition displaying, such as watching movies. Here is an article discussing the comparision between GUI and CLI.
Now you can see how much disk space Ubuntu occupies. Type the following command:
df -hTo shut down the system, issue the following command:
poweroffIn some Linux distributions, executing the command above may give an error message:
-bash: poweroff: command not foundThis error is due to the property of the
poweroffcommand - it is a system administration command. In such Linux distribution, executing this command requires superuser privilege.Therefore, to shut down the system, you should first switch to the root account:
su -Enter the root password you set during the installation. Note that the password is not shown in the terminal to avoid password leaks. If the password is correct, you will see the prompt changes:
root@hostname:/home/username#The last character is
#, instead of$before you executingsu -.#is the indicator of root account. Now executepoweroffcommand again, you will find that the command is executed successfully.
question::Why executing the "poweroff" command requires superuser privilege in some Linux distributions?
Can you provide a scene where bad thing will happen if the
poweroffcommand does not require superuser privilege?
If you are using a virtual machine, you must shut down the virtual machine via the
poweroffcommand or menu. If you force shutdown the VM by clicking theXbutton in the upper right corner of the window, it may cause file corruption in the VM. Several past students have been affected by this, and even their grades have been affected by the corruption of lab-related files. Please take this as a lesson and don't use it as a convenience, or you will suffer the consequences!