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.

Slides:



Advertisements
Similar presentations
PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
Advertisements

Unix. Outline Commands Environment Variables Basic Commands CommandMeaning lslist files and directories ls -alist all files and directories mkdirmake.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
The Linux Shell The shell contains
Chapter Seven Unix Shell Environments1 System Programming UNIX Shell Environments.
Git/Unix Lab March Version Control ●Keep track of changes to a project ●Serves as a backup ●Revert to previous version ●Work on the same files concurrently.
Find Command Characteristics –Locate files descending from multiple starting points –Employs regular expressions Examples On entire system: >find / -name.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
UNIX chapter 04 UNIX Shells Mr. Mohammad Smirat. Introduction The shell is the software that listens to commands typed in at the terminal and translates.
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
CS 497C – Introduction to UNIX Lecture 36: - Customizing the Environment Chin-Chih Chang
Information Networking Security and Assurance Lab National Chung Cheng University 1 What Linux is? Free Unix Like Open Source Network operating system.
Guide To UNIX Using Linux Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
UNIX By Darcy Tatlock. 1. Successful Log Into Unix To actively manipulate your website you need to be logged in. Without being logged in you cannot enter.
Linux & Shell Scripting Small Group Lecture 4 How to Learn to Code Workshop group/ Erin.
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.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Shell Programming, or Scripting Shirley Moore CPS 5401 Fall August 29,
Introduction to Shell Script Programming
Homework 3-4 Sarah Diesburg Operating Systems COP 4610.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
– 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.
Drexel University Software Engineering Research Group Git for SE101 1.
Workbook 6 – Part 1 The Bash Shell
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.
Basic Shell Scripting - Part 1 Objective - Learn to: Read Start-up Files Edit Start-up Files Modify Your User Environment Communicate with Users Write.
CS465 - UNIX The Bourne Shell.
Beyond sh Not everyone is as fond of UNIX as most other people. The tutorial talks about the dark side of UNIX.
Using Commands Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
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.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Lecture One. Objective: Provide description of the Command-Line Editor of Linux operating system. Enable students to understand the practical side of.
Writing Scripts Hadi Otrok COEN 346.
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
Lab 3 + Using the Terminal 1. "Under Linux there are GUIs (graphical user interfaces). where you can point and click and drag, and hopefully get work.
UNIX shell environments CS 2204 Class meeting 4 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
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?
Compunet Corporation Introduction to Unix (CA263) Your Environment By Tariq Ibn Aziz Dammam Community College.
Manually Creating a New User Account Presented by Carl South.
CSCI 330 UNIX and Network Programming Unit III Shell, Part 1.
Module 1 - Introduction to Linux. Users must log-in Linux is case sensitive File and Directories naming conventions (No spaces!) Files and Directories.
Agenda The Bourne Shell – Part II Special Characters Ambiguous File Reference Variable Names and Values User Created Variables Read-only Variables (Positional.
Configuration your environment Many user-configurable Unix programs (such as your shell) read configuration files when they start up. These configuration.
Day 12 Intro to Shell Scripting. Doing it all together Up until now, we have only used built in functions in Unix. What if we want to define our own functions?
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
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.
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.
SUSE Linux Enterprise Desktop Administration
Introduction to Shells
PowerShell Introduction Copyright © 2016 – Curt Hill.
Shell Features CSCI N321 – System and Network Administration
Andy Wang Object Oriented Programming in C++ COP 3330
The Linux Operating System
Shell Environments.
UNIX and Shell Programming (06CS36)
Basic UNIX OLC Training.
John Carelli, Instructor Kutztown University
(Chapter 2) John Carelli, Instructor Kutztown University
Linux Shell Script Programming
Unix Shell Environments
Introduction to Bash Programming, part 3
Presentation transcript:

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 will show you ALL files. Notice that any file which began with a “.” was omitted unless you give ls the –a flag.

3 Why? The Dot files are configuration files. Many programs you run need to store preferences and other information. –This is usually stored in a file called.programname Example –Each time you use vi to edit a file, it keep an autosave of the file in a file called.filename.swp –If you get kicked off the server, when you go back it will tell you that you can recover most of the changes you had made before you logged out. These are in the.swp file.

4 The.bash_history Each command you type is being stored in a history file. –This is why you can use the up and down arrows to get to previous commands you typed. Look at your.bash_history

5 The.profile and.bashrc The. profile is probably the most important file –On this particular version of Unix, its configured to just call.bashrc and let it do all the work..bashrc –It sets up the environment you use each time you log into Unix. –It sets some important shell variables PATH PS1 A lot of your settings come from the fact that.bashrc then calls /etc/profile which is a system wide default profile.

6 Fortune Want to get your day off to the right start. Make your shell give you your fortune each time you log in. –There is a program called fortune –Which each time its run, it gives you a “witty” comment. –Edit your.bashrc and add to the end the command fortune.

7 Rerun.bashrc You can make Unix pretend that you are just logging in again. –This is only useful if you have made changes to your.bashrc file –Execute:..bashrc

8 $PATH This lists all directories which Unix will look in each time you enter a command. Type: –echo $PATH See where all programs you run are. –which more Would show you which directory the program “more” is in. This directory is in your path, which is why you can run it.

9 Adding to your path. Imagine you have a directory called scripts in your home directory. –export PATH=$PATH:/home/enda/scripts Would add it to your path. Now any script you create and put in that directory, can be run from ANY directory you are in. –You no longer have to be in the directory where the script is, to run it.

10 $PS1 $PS1 is a variable which stores your prompt. Now your prompt looks something like: > Bash has special characters you can put in the prompt: –\d -Date –\H -Hostname –\t - Current time (Also \T and –\u - Current user –\w - Current working directory (pwd) For more options see man bash

11 Change your prompt: Make your prompt look like this: kahuna – 12:27:30 > Remember to make this a permanent change, put it into your.bashrc file.

12 Seeing all variables We know we can create variables: –read x –x=17 We know there are some magic default variables: –$PATH, $PS1 etc. How do we see a list of all variables and what they are currently set to? –set