Bash startup files Linux/Unix files stty 1.  midterms  bash startup files  stty 2.

Slides:



Advertisements
Similar presentations
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
Advertisements

1 © 2001 John Urrutia. All rights reserved. Chapter 5 The Shell Overview.
Chapter 13 Processes. What is a process? A process is a program in execution A process is created whenever an external command is executed Whenever the.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Chapter Seven Unix Shell Environments1 System Programming UNIX Shell Environments.
Linux+ Guide to Linux Certification, Second Edition
CS 497C – Introduction to UNIX Lecture 36: - Customizing the Environment Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
Advanced Shell Programming. 2 Objectives Use techniques to ensure a script is employing the correct shell Set the default shell Configure Bash login and.
Homework 3-4 Sarah Diesburg Operating Systems COP 4610.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
Introduction to Computer Organization & Systems Topics: Intro to UNIX COMP John Barr.
CS 2061 Shells Also known as: Unix Command Interpreter.
Shells. A program that is an interface between a user at a terminal and the computers resouces ▫The terminal may be real or an emulator The shell is.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Bash startup files Linux/Unix files stty Todd Kelley CST8207 – Todd Kelley1.
Chapter 4 UNIX Common Shells Commands By C. Shing ITEC Dept Radford University.
Linux+ Guide to Linux Certification, Third Edition
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
UNIX/LINUX Shells Shell is an UNIX/LINUX command interpreter. Shell command can be internal or external. The code to execute an internal command is part.
Linux+ Guide to Linux Certification, Third Edition
Basic Shell Scripting - Part 1 Objective - Learn to: Read Start-up Files Edit Start-up Files Modify Your User Environment Communicate with Users Write.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Workbook 6 – Part 2 The Bash Shell
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Introduction to Unix Shell & Scripting with csh/tcsh  Brief Unix History  Unix Shell & Flavor  CSH/TCSH Scripts.
Customizing Linux Environment Tutorial 4 ENGR 3950U / CSCI 3020U Operating Systems Instructor: Dr. Kamran Sartipi.
June 1, 1999Customizing the UNIX Environment1 Introduction to UNIX G. Customizing the UNIX Environment.
Unix Shell Environments February 23rd, 2004 Class Meeting 6.
UNIX shell environments CS 2204 Class meeting 6 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
User Environments Objectives –to provide appropriate environments for different types of users Contents –different login programs –user profiles –restricted.
UNIX shell environments CS 2204 Class meeting 4 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
LING 408/508: Programming for Linguists Lecture 8 September 23 rd.
Customizing the Shell Environment. UNIX Shells Two characteristics of shells –Interactive: prompts ($) and waits for your response/requests –Noninteractive:
Executable scripts. So far We have made scripts echo hello #for example And called it hello.sh Run it as sh hello.sh This only works from current directory?
1 Day 18 Bash and the.files. 2 The.files ls shows you the files in your directory –Or at least most of them. –Some files are hidden. Try: ls –a –This.
Compunet Corporation Introduction to Unix (CA263) Your Environment By Tariq Ibn Aziz Dammam Community College.
Environment After log in into the system, a copy of the shell is given to the user Shell maintains an environment which is distinct from one user to another.
CSCI 330 UNIX and Network Programming Unit III Shell, Part 1.
Chapter 8: The Bourne Again Shell It’s a command interpreter, it’s a programming language, and it makes a mean martini.
Jozef Goetz, expanded by Jozef Goetz, 2006 Credits: Parts of the slides are based on slides created by textbook authors, Syed M. Sarwar, Robert.
Linux+ Guide to Linux Certification, Second Edition
Configuration your environment Many user-configurable Unix programs (such as your shell) read configuration files when they start up. These configuration.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
Announcements Today is the CS Dept Career Fair. 4-7pm in the atrium. Assignment 0 was due last night, if you didn't get it done you need to make sure you.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
Lesson 8-Specifying Instructions to the Shell. Overview An overview of shell. Execution of commands in a shell. Shell command-line expansion. Customizing.
Linux Administration Working with the BASH Shell.
Agenda Customizing a Unix/Linux account Environment Introduction to Start-up Files (.bash_profile,.bashrc,.profile,.kshrc) Safe Methods for Changing Start-up.
ULI101 Week 10. Lesson Overview ● Shell Start-up and Configuration Files ● Shell History ● Alias Statement ● Shell Variables ● Introduction to Shell Scripting.
LX0-104 Dumps PDF CompTIA Linux+ Powered by LPI 2
Shells.
User environment and processes Operating systems I800
SUSE Linux Enterprise Desktop Administration
Introduction to Shells
Shell Features CSCI N321 – System and Network Administration
UNIX and Shell Programming (06CS36)
Download LX0-104 Exam Dumps Questions & Answers - LX0-104 Braindumps Dumps4download
LING 408/508: Computational Techniques for Linguists
CHAPTER 8 (skip , ) CHAPTER 10
Shell Commands Using BASH Copyright © 2017 Curt Hill.
The Linux Command Line Chapter 11
Linux Shell Script Programming
Unix Shell Environments
Introduction to Unix Shell & Scripting with csh/tcsh
CST8177 Scripting 2: What?.
Chapter 3 The UNIX Shells
Introduction to Bash Programming, part 3
The Linux Command Line Chapter 11
Presentation transcript:

bash startup files Linux/Unix files stty 1

 midterms  bash startup files  stty 2

 We customize our shell behavior by ◦ setting environment variables, for example, export PATH=/bin:/usr/bin:/sbin ◦ setting aliases, for example alias ll="ls –l" ◦ setting shell options, for example, shopt –s failglob or shopt –s dotglob ◦ setting shell options, for example, set –o noclobber we make these customizations permanent using bash startup files 3

  ~/.bash_profile is sourced by your login shell when you log in ◦ the things we set up here are done only once when we log in ◦ export- ed variables here are inherited by subshells ◦ we source ~/.bashrc here because login shells do not source it  ~/.bashrc is sourced by each non-login subshell, interactive or not ◦ here we set up things that are not inherited from the login shell ◦ inside this file, at the top, we check whether it’s an interactive or non- interactive shell: [ -z "${PS1-}" ] && return ◦ we set aliases in this file ◦ we set options configured with shopt and set in this file 4

 When a login shell starts 1.execute commands from /etc/profile, if that file exists 2.execute commands from the first of these that is readable (in order): 1.~/.bash_profile 2.~/.bash_login 3.~/.profile  When a login shell exits 1.read and execute commands from the file ~/.bash_logout, if it exists 5

 When an interactive non-login shell starts 1.execute commands from ~/.bashrc, if that file exists  The -– rcfile file option specifies that file should be used instead of ~/.bashrc 6

 The system administrator can configure the default shell environment for all users  Configuration in /etc/profile applies to all users on the system  The files in /etc/skel/ are copied to newly created user accounts (can give new users a default copy of.bash_profile and.bashrc ) 7

 The bash process used to execute a shell script is non-interactive  stdin and stdout not connected to a terminal (more details in bash manpage) 8

.bash_profile is loaded once by a login shell .bashrc is loaded by non-login shells  There are cases where there never is a login shell, for example ssh remote-server.com  So the method we'll use in this course: ◦.bash_profile does nothing except load.bashrc ◦.bashrc keeps track of things that should be done only once 9

[ -z "${PS1-}" ] && return if [ "${_FIRST_SHELL-}" = "" ] ; then export _FIRST_SHELL=$$ export PATH="$PATH:$HOME/bin" export LC_ALL=en_CA.UTF-8 export LANG=en_CA.UTF-8 # here we put things that # should be done once fi # here we put things that need to be # done for every interactive shell 10

Contains just one line: source./.bashrc 11

 recall the effect of these control characters: ◦ ^Z suspend the current foreground process ◦ ^C terminate the current foreground process ◦ ^D end of file character ◦ ^U kill character to erase the command line  these are actually properties of the terminal  they can be set with the stty command  stty –a : print out the current tty settings  stty susp ^X : (that’s a caret ^, shift-6 on my keyboard, followed by capital X) means set the susp character to CTRL-X instead of CTRL-Z 12

 if you accidentally dump the contents of a binary file to your screen, and all the control characters reconfigure your terminal on you, you can reset it to sane values with stty sane 13