Command Line
Last updated
Last updated
Let us have the first try on using Linux. Although Linux has a GUI(Graphical User Interface) as Windows and macOS, the server always disable it due to the heavy resource load by GUI. So you have to ensure yourself familiar with the Command Line Operation.
Tips: Although you can use my Linux Server now, I strongly advise you try to install it in your own Laptop. Since you can enjoy the configuration of your own Computer System.
For students at Macao Polytechnic Institute Interest Group, you are welcome to use my server before you have installed one on your computer. Here is a tip on how to open the CLI(Command Line Interface).
Using Spotlight Search (⌘ + Space). Open Terminal.app
and you can see an interactive Interface with a rectangle cursor.
Right-click Start Button, open Windows Terminal
or Windows Powershell
or CMD
. 如果你在使用 Windows 中文版,则是Windows Powershell
或者 命令提示符
.
Since you have already opened your Terminal Software, try to type ssh
in the interactive line. And you will get something like this.
After having a brief read of the instruction, you should be clear that if the command ssh
is installed on your computer (If you are using Windows 10 or 11, any versions of macOS, you should have this command by the OS)
Then we shall use it to log in to my Linux Server.
And you will get this, just type the password I gave you, but you will not see what characters you have typed due to the security.
Then you will get this output:
This is the welcome message by Ubuntu. And now, you are manipulating my Server rather than your computer via the Internet connection. You can play around with my Server freely without malicious intention. So do not do some stupid kinds of stuff like deleting my file system.
Now let's try to type some commands. What you type is after the -> Symbol. So in the following example, the command is only ls
and what you can see from the shell after you type ls
is hello.txt
which is the output of the shell.
Google search:
shell vs terminal
This hello.txt
is a file that is located at the entry directory when you ssh
into my Server. To see what it contains, the very simple way is cat
(means to concatenate the file content in the output)
Image ->
as a mouse pointer, it is the command line prompt. Use pwd
to see where you are.
Now let us create your own folders with your name (change steve-yan
to your name)
And go inside your folder
Then you are at
Actually, we can see it before the ->
prompt at home/steve-yan
, ~
refers to the ubuntu
directory. You can think of it as Windows' C:\Users\Ex10si0n
or macOS's /Users/ex10si0n
.
👍 Goal: make your own folder at
/home/ubuntu/
In Linux, an absolute path is defined as the location of a file or directory relative to the root directory and is designated by a forward slash ( / ). The root directory refers to the top directory that comprises the filesystem containing a series of sub-directories which leads to further sub-directories. On the contrary, a relative path refers to the location of a file or directory relative to the current working directory rather than the root directory. For example,
In the first example, the path starts from the / directory which is the root directory which makes it an absolute pathname. We removed the forward slash / in the second example which makes it a relative pathname meaning it relates to the current working directory instead of the root directory.
Try to type
This will send you to the home directory /home/ubuntu/
, now typing ls
to show the file under this directory. What you will find?
That is because a Linux computer can serve many users at the same time. In fact, this scenario is not appropriate. That is, you are all acting as the user ubuntu
now, for ease of use, I do not let you create your own user in my Server, but it is available in Linux, many users can manipulate the computer at the same time.
👍 Goal: Try to use these commands and tell the usage