0% found this document useful (0 votes)
12 views

Linux 3

The document provides an introduction to using the Linux system. It covers logging in through both text and graphical modes, understanding the multi-user nature of Linux, using basic commands like date, cal, who and finger to get information. It also discusses communicating with other users using write, wall and talk. Keyboard shortcuts and command history are explained.

Uploaded by

Mark Zuña
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Linux 3

The document provides an introduction to using the Linux system. It covers logging in through both text and graphical modes, understanding the multi-user nature of Linux, using basic commands like date, cal, who and finger to get information. It also discusses communicating with other users using write, wall and talk. Keyboard shortcuts and command history are explained.

Uploaded by

Mark Zuña
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Welcome to:

Unit 3
Using the System

© Copyright IBM Corporation 2006


3.0.3
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Unit Objectives
After completing this unit, you should be able to:
Log in and out of the system
State the structure of Linux commands
Execute basic Linux commands
Use Linux commands to communicate with other users
Use the keyboard and mouse effectively
Use the command history

© Copyright IBM Corporation 2006


Linux is Multi-user and Multitasking
Linux is a multi-user, multitasking operating system
Multiple users can run multiple tasks simultaneously, independent
of each other
Always need to "log in" before using the system
Identify yourself with username, password
Multiple ways to log in to the system
Console: Directly attached keyboard, mouse, monitor
Serial terminal
Network connection

© Copyright IBM Corporation 2006


Virtual Terminals
In most Linux distributions, the console emulates a number of
virtual terminals
Each virtual terminal can be seen as a separate, directly attached
console
Different users can use different virtual terminals
Typical setup:
VT 1 through 6: text mode logins
VT 7: graphical mode login prompt (if enabled)
Switch between VTs with Alt-Fn (or Ctrl-Alt-Fn if in X)

© Copyright IBM Corporation 2006


Logging In (Text Mode VT)

© Copyright IBM Corporation 2006


Logging In (Graphical Mode VT)

Note: Different distributions and desktop environments


will display different login prompts

© Copyright IBM Corporation 2006


Linux Commands
Everything on a Linux system can be done by typing commands
(Even browsing the World Wide Web...)
The Graphical User Interface (X Window System or X) is not
needed for running a Linux system
But is sometimes more convenient
In order to be able to type commands in X, you need to start a
terminal emulator

© Copyright IBM Corporation 2006


Starting a Terminal Emulator
To run a Linux command inside the X environment, open a "terminal
window" or "terminal emulator"
Emulates a text console

KDE:
Red Hat, Fedora:

GNOME:

SUSE:

© Copyright IBM Corporation 2006


Command Prompt
The command prompt indicates that the system is ready to accept
commands
Can be configured yourself (will be covered later)
Default depends on distribution
Examples:
[user@host dir]$
dir$
$
#
The dollar ($) usually means: "logged in as regular user"
The hash (#) usually means: "logged in as root"

© Copyright IBM Corporation 2006


Linux Command Syntax
Linux commands have the following format:
$ command option(s) argument(s)

$ ls
$ ls -l
$ ls /dev
$ ls -l /dev

© Copyright IBM Corporation 2006


Command Format Examples

WRONG RIGHT

1. Separation
$ mail - f personal $ mail -f personal
$ who-u $ who -u

2. Order
$ mail test root -s $ mail -s test root
$ -u who $ who -u

3. Multiple options
$ who -m-u $ who -m -u
$ who -m u $ who -mu

© Copyright IBM Corporation 2006


Some Basic Linux Commands
passwd: Change your password
date, cal: Find out today's date and displays a calendar
who, finger: Find out who else is active on the system
clear: Clear the screen
echo: Write a message to your own screen
write: Write a message to other screens
wall: Write a message to all screens
talk: Talk to other users on the system
mesg: Switch on/off reception of write, wall, and talk messages

© Copyright IBM Corporation 2006


Changing Your Password
The passwd command allows you to change your password

$ passwd
Changing password for tux1
Old password:
New password:
Retype new password:

Passwords are important for security - choose a good password


Minimum six characters
Not a dictionary word, birthdate, license plate, ...

© Copyright IBM Corporation 2006


The date Command
date shows the current date and time

$ date
Mon Jan 1 23:59:59 UTC 2007

© Copyright IBM Corporation 2006


The cal Command
cal shows a calendar
Synopsis: cal [Month] [Year]

$ cal 1 2007
January 2007
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
$

© Copyright IBM Corporation 2006


Who Is on the System
who shows who is logged onto the system

$ who
root tty1 Jan 1 11:10
tux1 tty2 Jan 1 11:04

$ who am i
host!tux1 tty2 Jan 1 11:04

But:
$ whoami
tux1

© Copyright IBM Corporation 2006


Finding Information about Users
The finger command shows info about other users
Synopsis: finger [user][@host]

$ finger
Login Name Tty Idle Login Time
tux1 Tux (1) 2 Jan 1 11:04
root root *1 7 Jan 1 11:10

$ finger tux1
Login: tux1 Name: Tux (1)
Directory: /home/tux1 Shell: /bin/bash
On since Mon Jan 1 11:04 (UTC) on tty2
No mail.
No plan.

© Copyright IBM Corporation 2006


The clear, echo, write, and wall Commands
The clear command clears your screen
$ clear
The echo command writes messages to your own screen
$ echo Who wants to go to lunch?
Who wants to go to lunch?
Use write to display a text message on a user's terminal
$ write tux2
Message
<ctrl-d>
Use wall to place a message on all logged in user's displays
$ wall
I'm back
<ctrl-d>

© Copyright IBM Corporation 2006


Talk with Another User

If Tux1 wants to talk with Tux2, Tux1 enters:


$ talk tux2

If Tux2 also wants to talk with Tux1, Tux2 enters:


$ talk tux1

Tux1 Tux2
© Copyright IBM Corporation 2006
The mesg Command
The mesg command controls whether other users can send
messages to you with the write, wall or talk command or through
output redirection.

User tux1 at tty1:

$ mesg n

User tux2 at tty2:

$ write tux1 tty1


write: tux1 has disabled messages on tty1

© Copyright IBM Corporation 2006


Keyboard Tips (1 of 2)
<backspace>, <Ctrl-h> Corrects mistakes
<Ctrl-c> Terminates the current
command and returns to the
shell
<Ctrl-d> End of transmission
<Ctrl-s> Temporarily stops output to the
screen
<Ctrl-q> Resumes output
<Ctrl-w> Erase last word
<Ctrl-u> Erase the entire line
<tab> Command or filename
completion

© Copyright IBM Corporation 2006


Keyboard Tips (2 of 2)
<arrow up> Previous command
<arrow down> Next command
<arrow left> One character to the left
<arrow right> One character to the right
<shift page-up> Look at the output of previous
commands
<shift page-down> Look at the output of later
commands; eventually gets you
back to the command prompt
<Ctrl-r> Search for a command in the
command history

© Copyright IBM Corporation 2006


Command History
Command history also can be viewed with history command

$ history 5
99 clear
999 wc .bash_profile
1000 wc .bash_profile
1001 wc .bash_profile
1000 history

© Copyright IBM Corporation 2006


Retrieving Commands with "!"
To retrieve commands, use !

$ wc .bash_profile
16 23 238 .bash_profile
Redo previous:

$ !-1
wc .bash_profile
16 23 238 .bash_profile
or:
$ !!

Redo command No. 999:


$ !999
© Copyright IBM Corporation 2006
Console Mouse Tips
On most distributions, the mouse also works in text mode
Left mouse button
Click: Mark start of selection
Drag: Mark selection
Middle mouse button
Click: Paste selection
Right mouse button
Click: Mark end of selection

© Copyright IBM Corporation 2006


Locking
When temporary leaving a system alone, always lock your terminal
Other people might misuse your account
In a text mode terminal, use vlock (lock your terminal) or vlock -a
(lock the whole console)
In a graphical mode terminal, use the menu, the "padlock" icon or
xlock
Most screensavers support automatic locking, too
A locked terminal can only be unlocked with the users password
GNOME: KDE:

© Copyright IBM Corporation 2006


Logging Out
When finished working on a system, always log out
Other people might misuse your account
In a text mode terminal, use logout, exit or Ctrl-d
In a graphical mode terminal, use appropriate menus

GNOME: KDE:

© Copyright IBM Corporation 2006


Checkpoint

T/F 1. A Linux system always needs a Graphical


User Interface

2. Which of the following commands is not a legal


command in Linux?
a. ls/dev/bin
b. ls -al/dev/bin
c. ls -a -l .
d. ls -a-l/dev

3. How do you switch between virtual terminals?

© Copyright IBM Corporation 2006


Unit Summary
A Linux system is controlled by entering commands
A GUI is not necessary for controlling a Linux system
Linux commands can use multiple options and arguments and must
follow proper syntax rules.
There are many simple, yet powerful commands such as:
date
cal
who, who am i, whoami
finger
echo
clear
Communicate with other Linux users using commands such as mail,
write, wall and talk.

© Copyright IBM Corporation 2006

You might also like