Your First Commands

Theory time is over. Let's run some commands.

Open your terminal and type along. Don't copy-paste. Type every character. Your fingers need to learn this.

Terminal Anxiety is Normal

If looking at a blank terminal makes you nervous - that's completely normal. Almost everyone feels this at first. The blinking cursor, the fear of typing the wrong thing... I've been there. Here's the good news: you cannot break anything by running the commands in this lesson. The worst that happens is an error message. Just type along and watch that anxiety fade.

echo - Print Text

The echo command prints text to the screen. It's the "Hello World" of the terminal.

Terminal
$echo Hello World
Hello World
$echo "Hello World"
Hello World
$echo 'Hello World'
Hello World

All three work. Quotes are optional for simple text, but you'll need them for text with special characters.

hljs bash
echo Hello     World      # Multiple spaces become one
echo "Hello     World"    # Quotes preserve spaces

Try It

Type echo "I am learning Linux" in the terminal panel right now.

clear - Clean the Screen

Your terminal getting cluttered? Clear it:

Terminal
$clear
(screen clears)

Or use the keyboard shortcut: Ctrl + L

This doesn't delete your history - it just scrolls the mess out of view. You can still scroll up to see previous commands.

pwd - Where Am I?

pwd stands for Print Working Directory. It tells you where you are in the file system.

Terminal
$pwd
/home/user

Think of it as GPS for your terminal. Lost? Type pwd.

whoami - Who Am I?

Tells you which user you're logged in as.

Terminal
$whoami
user

Useful when you have multiple terminal windows open and you're not sure which user you're running commands as.

date - What Time Is It?

Shows the current date and time:

Terminal
$date
Tue Jan 14 15:30:42 UTC 2025

Servers often run in UTC regardless of your timezone. You'll see this a lot when reading logs.

uname - System Information

Get basic info about the system:

Terminal
$uname
Linux
$uname -a
Linux debian 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 x86_64 GNU/Linux

The -a flag means "all" - it gives you the kernel version, architecture, hostname, everything.

Flags

Most commands accept flags (also called options) that modify their behavior. They usually start with - or --. We'll cover this more later.

history - What Did I Type?

See your command history:

Terminal
$history
1 echo Hello World 2 pwd 3 whoami 4 date 5 history

Even better: press the Up Arrow to cycle through previous commands. This is a huge time saver.

History Search

Press Ctrl + R and start typing to search your history. This is one of the best shortcuts in the terminal.

exit - Leave the Terminal

Done? Close the session:

Terminal
$exit
(terminal closes)

Or use Ctrl + D. This logs you out of the current shell session.

Putting It Together

Let's run a quick sequence:

Terminal
$whoami
user
$pwd
/home/user
$date
Tue Jan 14 15:35:00 UTC 2025
$echo "I am $(whoami) and I'm at $(pwd)"
I am user and I'm at /home/user

That last one is a preview of something called command substitution - we'll cover it later. For now, just notice that you can combine commands creatively.

Quick Reference

CommandWhat It Does
echo "text"Print text to screen
clear / Ctrl+LClear the terminal screen
pwdPrint current directory
whoamiPrint current username
datePrint current date/time
uname -aPrint system information
historyShow command history
exit / Ctrl+DExit the terminal
Knowledge Check

Which command shows your current location in the file system?

Key Takeaways

  • echo prints text - useful for scripts and debugging
  • clear or Ctrl+L cleans up your terminal
  • pwd tells you where you are
  • whoami tells you who you are
  • Use the Up Arrow to recall previous commands
  • Ctrl+R searches your command history

These might seem basic, but they're commands you'll use every single day. Next: how to get help when you don't know what a command does.