Your First Commands
Your first commands ask the shell for simple facts about this machine. Each one prints one short answer.
Your name
The answer is a single word.
$ whoamiThis machine
The answer is a single name.
$ hostnameToday
The answer names the day, the date, and the time.
$ datePast commands
The list shows four past lines, oldest first.
$ historyExample
$ whoami
$ hostname
$ dateKey points
- A user is the person at the computer.
- Use whoami to print the name of the current user.
- Use hostname to print the hostname, the name of this machine.
- Use date to print the current date and time.
- Use history to print the history, a list of past commands in order.
- A home is where one user keeps their own work.
In this example, three lines ask three facts. The first line gives the name root. The second line gives the name htch-runtime. The third line gives the date and time. Each answer comes from this machine.
Note
The answers in this lesson differ on each machine, so your answers will differ from the ones shown here.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
What does whoami print?