Basic Unix Commands

Download Report

Transcript Basic Unix Commands

Some basic Unix commands

 Understand the concept of loggin into and out of a Unix shell  Interact with the system in a basic way through keyboard and terminal window  Create, copy and delete files, edit files  Understand and use commands like: ls cd mv cp rm cat date mkdir rmdir  Be able to navigate up and down in the file system 1

Logging in and out

 As a Unix user you can log in and out  When loggin in, the system checks your user name and password – if correct, the system starts a shell for you and places you in the starting directory  The shell runs as your process until you log out  The shell gives you a prompt and interprets what you type 2

Interacting with the system

 Default input from the keyboard  Default output to the terminal window  When hitting

return

the shell interprets what you have typed  The shell finds a command with that name and starts a process to execute the command  During this time the shell process sleeps and wakes up when the command process is done 3

Working with files

 Creating files – Can use vi or any editor – Can use cat with input and output redirection  Copying files – – cp makes a copy of an existing file cat can do it also, we practice this to understand I/O redirection  Deleting files: rm  Editing files we will learn about vi , the most available Unix editor other editors are available on the system as applications 4

More important commands

 ls lists the files in the current directory by name  cd changes your position in the directory tree  mv moves a file from one directory to another  rm deletes a file  date prints the current date and time  mkdir creates a directory  rmdir deletes a directory (must be empty)  All Unix commands have options 5

Navigating in the directory tree

 The cd command changes your position in the directory tree, destination is parameter, it must be the name of a directory visible in the current directory – cd without parameter – Relative movement (relative pathname) – Absolute movement (absolute pathname) – cd ..

and cd .

6

To Make a Good Password

 A good password – Easily remembered by YOU – Difficult to be guessed by others  Tricks to make a good password – Pick letters from a sentence  I l o v e U n i x  Ioenx – Pick letters, numbers, and symbols that sound, look like, or replace a phrase  I hate carrots !

 i h8 ^s !

 A bad password not only harms you – Attacks are much easier with a compromised account on a computer 7

Some Basic Commands

 who: Who are using the system.

terra$ who katchab ttyp0 scott jenny tty02 tty03 Aug 11 08:47 Aug 10 11:01 Aug 10 07:21  who am i: Who am I.

terra$ who am i katchab ttyp0 Aug 11 08:47 8

Some Basic Commands

 ls: List the files under current directory terra$ ls readme cs211.2.ppt cs211.ppt.gz notes.zip cs211.1.ppt cs211.3.ppt make/ shell/  cat: Display the content of a file terra$ cat readme Unix is easy!

terra$ 9

Some Basic Commands

 Ctrl-c: (press and c at the same time) Interrupt the current task.

terra$ cat ^c terra$  netscape: surf the net. ONLY WHEN X is running terra$ netscape  lynx: surf the net.

terra$ lynx www.yahoo.com

10

Some Basic Commands

 man: See the manual page of a command.

terra$ man cat Reformatting page. Wait... Done User Commands cat(1) NAME cat - concatenate and display files SYNOPSIS cat [ -nbsuvet ] [ file ... ] DESCRIPTION cat reads each file in sequence and writes it on the stan dard output. Thus: example% cat file prints file on your terminal, and: example% cat file1 file2 >file3 concatenates file1 and file2, and writes the results in file3. If no input file is given, cat reads from the stan dard input file.

OPTIONS--More--(11%) 11

Commands covered today

 File Manipulation Commands: – copy (cp), rename (mv), print (lpr), examine a file (head, more, cat), search a file (grep), delete (rm)   Miscellaneous commands – echo, date, cat Basic File Compression – gzip, gunzip  Finding Utilities and help – which, whereis, apropos, man, info  Communicating online – Chat (write/talk) and email (pine) 12

Communication Utilities in UNIX

13

The talk Command

14

A Complete talk Session

15

A Complete talk Session

16

A Complete talk Session

17

The write Command

18

E-Mail Programs

 Some Programs available in Unix/Linux – Mail – most basic, low level mail command – ELM – PINE (PINE Is Not Elm), more user friendly text mail – Outlook, GUI driven – Eudora – Netscape Mailer 19

Email Address

20

PINE

 A menu-driven client  Uses pico as an editor  Allows MIME attachments  Main Menu – C - Compose to write a message – I or L - View messages – Q - Quit 21

Local login

22

Remote Login

23