CS 497C – Introduction to UNIX Lecture 6: General-Purpose Utilities Chin-Chih Chang

Slides:



Advertisements
Similar presentations
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Advertisements

Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process A process is.
Chapter One The Essence of UNIX.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CS 497C – Introduction to UNIX Lecture 11: - The File System Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 24: - Simple Filters Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 20: - The Shell Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 36: - Customizing the Environment Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 15: - File Attributes Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 34: - Shell Programming Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 25: - Simple Filters Chin-Chih Chang
Chapter7 Serial Devices. Computer Center, CS, NCTU 2 Serial devices  Terminal  Modem  Mice  …
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
CS 497C – Introduction to UNIX Lecture 27: - The Process Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 16: - File Attributes Chin-Chih Chang
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
CS 497C – Introduction to UNIX Lecture 4: Understanding the UNIX Command Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
CS 497C – Introduction to UNIX Lecture 1: Getting Started Chin-Chih Chang
CCNA 2 v3.1 Module 2.
UNIX chapter 03 Getting Started Mr. Mohammad Smirat.
Using Linux Commands 2 Lab#5
Using Linux Commands 2 Lab#5. Sort command Sort the lines of text files. $ sort fileName by default it will sort in normal order(alphabetical 0-9 A-Z.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
Advanced Shell Programming. 2 Objectives Use techniques to ensure a script is employing the correct shell Set the default shell Configure Bash login and.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
UNIX Unbounded 5th Edition Amir Afzal Chapter 3 Getting Started
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Shell The Shell The agency that.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
CS 497C – Introduction to UNIX Lecture 7: General-Purpose Utilities Chin-Chih Chang
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Chapter 2: Getting Started Logon to Logout. In this chapter … Logging on The Shell Superuser Getting Help Logging off.
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
Linux Operations and Administration
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
De Anza College Instructor: Clare Nguyen
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands Major part of the of learning.
Guide To UNIX Using Linux Third Edition Chapter 8: Exploring the UNIX/Linux Utilities.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Day 6 COP 3502 David A. Gaitros Department of Computer Science Florida State University.
June 1, 1999Customizing the UNIX Environment1 Introduction to UNIX G. Customizing the UNIX Environment.
Introduction to Programming Using C An Introduction to Operating Systems.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Serial Devices. Computer Center, CS, NCTU 2 Serial devices  Terminal  Modem  Mice  …
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
SCSC 455 Computer Security Chapter 3 User Security.
 Terminal  Modem  Mice  …  RS-232 standard on DB25 connector › Electrical characteristics › Meaning of each signal wire › Ping assignment › DB25P.
FTP COMMANDS OBJECTIVES. General overview. Introduction to FTP server. Types of FTP users. FTP commands examples. FTP commands in action (example of use).
1 © 2001 John Urrutia. All rights reserved. Chapter 2 Getting Started.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Digital Literacy: Computer Basics
BIF713 Introduction to Linux. Agenda Getting Started: Using Linux Unix and Linux - Structure / Features Elements of the Linux Philosophy Linux Command.
June 1, 1999UNIX - Basic Environment1 Introduction to UNIX A. Basic Environment.
Introduction to UNIX.
Chapter7 Serial Devices
Chapter7 Serial Devices
Chapter7 Serial Devices
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
Serial Devices.
Chapter Four UNIX File Processing.
Serial Devices.
Presentation transcript:

CS 497C – Introduction to UNIX Lecture 6: General-Purpose Utilities Chin-Chih Chang

General-Purpose Utilities The general-purpose utilities of the system can be broadly divided into two categories: –Some commands tell you the state of the system. –Others can aid you directly in your work. In chapter 1, you used the passwd command to change your password. When used without arguments, it sets the user’s own password:

passwd: Change Your Password $ passwd Changing password for gates (current) UNIX password: Enter new UNIX password: Retype new UNIX password: When invoked by an ordinary user, passwd asks for the old password, then it demands the new password twice.

passwd: Change Your Password If everything goes smoothly, the new password is registered by the system, and the prompt is returned. Depending on the way they are configured, many systems conduct certain checks on the string that you enter as password. They may either disallow you from framing easy-to-remember passwords or advise you against choosing a bad password.

passwd: Change Your Password These are good practice when handling your own password: –Don’t choose a password similar to your old one. –Don’t use commonly used names. –Use a mix of alphabetic or numeric characters. –Make sure the password is unmeaningful enough to prevent other from guessing it. –Don’t write down the password in an easily accessible document. –Change the password regularly.

passwd : Change Your Password When you enter a password, the string is encrypted by the system. Encryption generates a string of seemingly random characters that UNIX uses subsequently to determine the authenticity of a password. This encryption is stored in a file named shadow in the /etc directory.

who and w : Know the Users UNIX maintains an account of all users who are logged on to the system. There are two commands which display an informative listing of users – who and w. Who produces a simple three or four- columnar output. $ who romeo pts/2 Aug 31 12:00 (sisko.cs.twsu.edu) juliet pts/5 Sep 2 15:10 ( )

who and w : Know the Users The first column show the user-ids of the users currently working on the system. The second column shows the device names of their respective terminals. These terminals are actually special files representing devices. The third column shows the date and time of logging in. The fourth column show the location (domain name or IP address) of logging in.

who and w : Know the Users The option –H prints line of column headings. The option –u adds user idle time. $ who –Hu USER LINE LOGIN-TIME IDLE FROM romeo pts/3 Aug 31 12:57 00:40 (kira.cs.twsu.edu) juliet pts/5 Sep 2 15:10. ( ) A. shows juliet has activity in the last one minute. Romeo seems to be idling for the last 40 minutes.

who and w : Know the Users The w command produces a more detailed output of users’ activities, and additionally displays many details of the system: $ w 4:46pm up 124 days, 19:10, 5 users, load average: 0.00, 0.00, 0.00 USER TTY FROM IDLE JCPU PCPU WHAT romeo pts/1 ge.cs.twsu.edu 3:02pm 40: s 0.04s -bash juliet pts/2 alonzo.cs.twsu.e Fri12pm 2days 2.03s 1.98s pine The first line of output shows the command was executed at 4:46 p.m. on a system having two users.

who and w : Know the Users The system has been up and running for 124 days and 19 hours and 10 minutes. The system load averages for the past one, five and fifteen minutes are virtually negligible. The remaining output is who -like except for the last three columns. The output shown under JCPU shows the total CPU time consumed by all processes at that terminal.

who and w : Know the Users The command the user is currently executing is shown in the last column. PCPU refers to the time consumed by that process. Because the multitasking nature of UNIX permits a user to run more than one job at the same time, the JCPU and PCPU times can often be different. who and w are regularly used by the system administrator to monitor whether terminals are being properly utilized.

tty : Know Your Terminal The tty command tells you the filename of the terminal you are using. $ tty /dev/pts/6 This shows the user is using the number 6 of pts terminal. pts is known as pseudo terminal system. The lock command lets you lock your terminal. But it is not available in Linux.

stty : Set Terminal Characteristics The terminal is the device with which a user communicates with the system. Different terminals are configured differently. It’s possible that your terminal may not behave in the way it’s meant to. The stty command helps straighten these things out. stty uses an enormous number of keywords.

stty : Set Terminal Characteristics The –a (all) option displays the current settings. $ stty -a speed 9600 baud; rows 25; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop - echoprt echoctl echoke

stty : Set Terminal Characteristics The output shows the baud rate (the speed) of the terminal is In this system, the [Ctrl-c] key interrupts a program. The erase character is [Ctrl-?], and the kill character is [Ctrl-u]. Of special significance is the eof (end-of- file) character which is set to [Ctrl-d]. You can use this key with the cat command to end input from the keyboard.

stty : Set Terminal Characteristics A series of keywords with a – prefixed are options which are turned off. The ones without a – prefixed are options which are turned on. echoe decides whether backspacing should erase character. If it is set (without – prefix to it), backspacing removes the character from display.

stty : Set Terminal Characteristics This setting can be reversed in this way: stty -echoe The echo option decides if the input is echoed. By default, the option is turned on. You can turn it off and on as follows respectively: stty –echo stty echo

stty : Set Terminal Characteristics If you like to use use [Ctrl-c] as the interrupt key instead of [Delete], you can use stty intr \^c When you insert control characters into a file, you’ll see a ^ symbol prefixed to the character. For example, [Ctrl-l] is seen as ^l. It’s actually a single character occupying two slots on the terminal.

stty : Set Terminal Characteristics When creating files with cat, you can use [Ctrl-d] to terminate input. Instead of [Ctrl- d], you can use [Ctrl-a] as the eof character: stty eof \^a To set the terminal characteristics to values that will work on most terminals, use the following command: stty sane