Week 4: Basic Linux Commands
Linux has a nice desktop (Graphical User Interface or GUI) that is used for normal uses.
This class, however, concentrates on working at the Command line.
There are several reasons for this:
1. GUIs are all different, and they change all the time.
2. You may not have a GUI.
3. We have more power at the command line by using different options with the commands.
The GUIs probably run the same commands, but we are limited by what the programmer
allows us to do on the GUI
4. Knowing commands allows us to write scripts so that we can do the same thing over
and over, quickly and ef iciently.
A script is just a ile with a collection of commands in it. We can run it and it is
as if we typed in the commands one after another.
5. In our networked environment, it is very common to log into another Linux computer
(remember - Linux is multi-user any number of people can log into one system).
We usually use an app like ssh (or telnet in the past) from the command line and it is like
we have a window into another computer. But, the GUI doesn't go along with us!
*******************************************************************************************
Just to be clear, Linux IS Case sensitive. Both in ilenames and commands. If you type
Useradd
the shell will say Command not found because there isn't a Useradd, only useradd.
And, if you save a ile as File1 and then save a ile as ile1 , you have two different iles!
*******************************************************************************************
f
f
f
f
f
f
f
Core Commands
whoami
Displays the username of the current logged-in user.
Example:
whoami
id
Shows detailed information about your user identity (UID, GID, and group memberships).
who
Lists all users currently logged into the system, along with their login time and terminal.
uname
Prints information about the system.
- uname → OS name
- uname -a → all details: kernel, architecture, etc.
date
Shows the current system date and time.
cal
Displays a calendar for the current month or a speci ied month/year.
Example:
cal 2 2025
up me
Tells you how long the system has been running and how many users are logged in.
history
Shows a list of the most recently used commands.
echo
Prints text or variables to the screen.
Example:
echo "Hello Linux!"
ti
f
man
Displays the manual (help guide) for a command. Exit with q.
Example:
man uname
clear
Clears the terminal screen.
Extra Commands
cowsay
Prints out a talking ASCII cow (if installed).
Example:
cowsay "Welcome to Linux!"
fortune
Displays a random quote or saying (if installed).
Example:
fortune
yes
Repeats a string forever until stopped with Ctrl + C.
Example:
yes "Linux is fun!"