Introduction to Linux in HPC/The Command Line /
Video
Quiz
CollapseWhich keys can be used for command history?
Info: | Working directory in console reminds user, where they are. (page 27) |
Warning: | In command line user may forget where they are. (page 26)
Child processes may stop, if parent shell exits. (page 26) |
Exercises in Terminal
1. What's your username on a Linux computer?
There are two ways to find your username on a Linux computer
ExpandAnswer:
|
1. In the command line prompt, e.g.[username@hostname ~]$ , you can find your username as username directly.
2. The Linux command whoami can also show your username.
|
2. What's the hostname of a Linux computer?
There are two ways to find the hostname on a Linux computer.
ExpandAnswer:
|
1. In the command line prompt, e.g. [username@hostname ~]$ , you can find the hostname as hostname directly.
2. The Linux command hostname can also give you the hostname.
|
3. What's your current working directory on a Linux computer?
There are two ways to find your current working directory on a Linux computer.
ExpandAnswer:
|
1. In the command line prompt, e.g. [username@hostname ~]$ , you can find your current working directory is ~ , which means your $HOME directory.
2. The Linux command pwd can also show your current working directory.
|
4. Use up- and down- (↑ and ↓) arrow keys to see the command history.
ExpandExplanation:
|
The up- and down- (↑ and ↓) arrow keys can be used to navigate command history.
|
5. Run sleep 1h command and wait, then use Ctrl-C
to kill it.
ExpandExplanation:
|
sleep 1h puts the terminal into idle, e.g. terminal is doing nothing, for 1 hour.
Ctrl-C kills the current command. In this exercise it's sleep 1h.
|