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.
All three work. Quotes are optional for simple text, but you'll need them for text with special characters.
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:
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.
Think of it as GPS for your terminal. Lost? Type pwd.
whoami - Who Am I?
Tells you which user you're logged in as.
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:
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:
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:
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:
Or use Ctrl + D. This logs you out of the current shell session.
Putting It Together
Let's run a quick sequence:
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
| Command | What It Does |
|---|---|
echo "text" | Print text to screen |
clear / Ctrl+L | Clear the terminal screen |
pwd | Print current directory |
whoami | Print current username |
date | Print current date/time |
uname -a | Print system information |
history | Show command history |
exit / Ctrl+D | Exit the terminal |
Which command shows your current location in the file system?
Key Takeaways
echoprints text - useful for scripts and debuggingclearor Ctrl+L cleans up your terminalpwdtells you where you arewhoamitells 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.