Configuration your environment Many user-configurable Unix programs (such as your shell) read configuration files when they start up. These configuration.

Slides:



Advertisements
Similar presentations
Chapter 9: The TC Shell Everything you thought you knew is now wrong.
Advertisements

''Unix is user friendly -- It's just picky about who it's friends are...'' -- Unknown, seen in.sigs around the world.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Chapter Seven Unix Shell Environments1 System Programming UNIX Shell Environments.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
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
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Linux Commands LINUX COMMANDS.
Advanced Shell Programming. 2 Objectives Use techniques to ensure a script is employing the correct shell Set the default shell Configure Bash login and.
Welcome to CSE  Name: Di Cao   Classroom: DL357  Class Time: T 8:30am - 9:18am  Office.
Introduction to Linux Operating System Tutorial 1
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface (or Terminal) What is the filesystem tree.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Introduction to Shell Script Programming
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
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/LINUX SHELLS.  “A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and.
Introduction to Unix Shell & Scripting with csh/tcsh  Brief Unix History  Unix Shell & Flavor  CSH/TCSH Scripts.
1 Applied CyberInfrastructure Concepts ISTA 420/520 Fall Nirav Merchant Bio Computing & iPlant Collaborative Eric Lyons.
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.
Introduction to Programming Using C An Introduction to Operating Systems.
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?
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
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.
Module 1 - Introduction to Linux. Users must log-in Linux is case sensitive File and Directories naming conventions (No spaces!) Files and Directories.
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 A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
Linux+ Guide to Linux Certification, Second Edition
Learning Unix/Linux Based on slides from: Eric Bishop.
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.
Lab 7 Shell Script Reference: Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook
Shell scripts – part 1 Cs 302. Shell scripts  What is Shell Script? “Shell Script is series of command written in plain text file. “  Why to Write Shell.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Information Technology Services Brett D. Estrade, LSU – High Performance Computing Phone:
MaSH – Miniature Shell ● Brief introduction to shell. – What is a shell? ● A program that reads inputs from the keyboard and executes the commands. ● Basic.
Introduction to Unix for FreeSurfer Users
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Development Environment Basics
SUSE Linux Enterprise Desktop Administration
Introduction to Shells
Shell Features CSCI N321 – System and Network Administration
Bash Introduction (adapted from chapters 1 and 2 of bash Cookbook by Albing, Vossing, & Newham) CPTE 440 John Beckett.
Andy Wang Object Oriented Programming in C++ COP 3330
CAP652 Lecture - Shell Programming
LINUX System : Lecture 5 (English-Only Lecture)
The Linux Operating System
Shell Environments.
UNIX and Shell Programming (06CS36)
John Carelli, Instructor Kutztown University
CSCI The UNIX System Shell Startup and Variables
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Shell Script Programming
Unix Shell Environments
Linux Commands LINUX COMMANDS.
CMPSC 60: Week 5 Discussion
Presentation transcript:

Configuration your environment Many user-configurable Unix programs (such as your shell) read configuration files when they start up. These configuration files contain settings and commands that determine how the programs will behave Many configuration filenames begin with a dot (.), so they are called dot files (use ls -a to see them). Often the filenames end in "rc" (for resource) Configuration files for shells are actually scripts. This means they are a series of commands written in the scripting language for the corresponding shell.

Common Configuration Files TCSH /etc/csh.cshrc Systemwide configuration file for the tcsh and csh shells. This is the first file that tcsh executes when it starts up /etc/csh.login Systemwide configuration for tcsh and csh, executed only for interactive shells. ~/.tcshrc The main personal configuration file for your tcsh shell. If tcsh doesn't find this, it looks for a.cshrc file. ~/.login This file is executed after the.tcshrc file, but only if the shell is an interactive log-in shell. It won't be used if some other process is starting the shell. ~/.logout Tcsh executes this file when you log out of an interactive shell.

BASH /etc/profile Systemwide configuration file for the bash and sh shells. ~/.bash_profile The first personal configuration file that bash looks for. ~/.bashrc This file is executed for interactive shells but not for your log-in shell (the shell that starts up when you open each Terminal window). ~/.bash_logout Executed when you log out from a bash log-in shell.

Environment Variables A variable is simply a piece of memory with a name. When the variable is used, the contents stored in memory are substituted for the name. The environment variables are managed by the shell

Common Environment Variables Variable Meaning HOME Full path of home directory. SHELL current shell USER User name PATH List of directories containing commands. LOGNAME Same as USER. PWD Full path of present working directory. MANPATH List of directories containing man pages. VISUAL Name of editor (such as vi, emacs) to be used when another program wants you edit a file.

To temporarily change or create an environment variable in tcsh (or csh): setenv VISUAL vi This sets the environment variable named VISUAL to have the value vi. Test that it worked: echo $VISUAL

To change or create an environment variable in bash (or sh): export VISUAL=vi Make sure there are no spaces on either side of the equal sign. The export command brings variables into the environment. The command line above actually combines two operations: the setting of the VISUAL variable (VISUAL=vi) and the exporting of that variable into the shell's list of environment variables. The same result could be achieved in two separate steps: VISUAL=vi export VISUAL

The Bash prompt export PS1="\[\033[1;35m\]\u\[\033[0m\] \[\033[1;34m\]\w\[\033[0m\] " Sets the user name in pink and the present working directory in blue.

Shell scripts A shell script is, as we saw in the shell configuration examples, a text file containing shell commands