CMPSC 60: Week 5 Discussion

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

Chapter 9: The TC Shell Everything you thought you knew is now wrong.
LINUX System : Lecture 3 (English-Only Lecture) Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University Acknowledgement.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Find Command Characteristics –Locate files descending from multiple starting points –Employs regular expressions Examples On entire system: >find / -name.
CS 497C – Introduction to UNIX Lecture 36: - Customizing the Environment Chin-Chih Chang
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.
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
UNIX. find command ● The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Linux Commands LINUX COMMANDS.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Welcome to CSE  Name: Di Cao   Classroom: DL357  Class Time: T 8:30am - 9:18am  Office.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Introduction to Shell Script Programming
Lesson 11-Locating, Printing, and Archiving User Files.
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.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
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.
Carnegie Mellon Linux Boot Camp Jenna MacCarley, Peter Pearson, Shashank Goyal 9/19/2015.
1 UNIX essentials (hands-on) the directory tree running programs the shell → command line processing → special characters → command types → shell variables.
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.
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.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang.
UNIX shell environments CS 2204 Class meeting 4 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
Linux Commands C151 Multi-User Operating Systems.
Jozef Goetz, expanded by Jozef Goetz, 2006 Credits: Parts of the slides are based on slides created by textbook authors, Syed M. Sarwar, Robert.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
Configuration your environment Many user-configurable Unix programs (such as your shell) read configuration files when they start up. These configuration.
Learning basic Unix command It 325 operating system.
1 Lecture 7 Introduction to Shell Scripts COP 3353 Introduction to UNIX.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
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.
Lecture 7 Introduction to Shell Programming
Lecture 7 Introduction to Shell Scripts COP 3353 Introduction to UNIX.
Chapter 11 Command-Line Master Class
Shell Features CSCI N321 – System and Network Administration
Linux 101 Training Module Linux Basics.
California State University Fresno
Andy Wang Object Oriented Programming in C++ COP 3330
The UNIX Shell Learning Objectives:
Some Linux Commands.
C151 Multi-User Operating Systems
The Command Prompt Commands are the way to “do things” in Unix
LINUX System : Lecture 5 (English-Only Lecture)
Shell Environments.
Basic UNIX OLC Training.
FTP and UNIX TOPICS Exploring your Web Hosting Site FTP UNIX
An Introduction to UNIX System --- Cosc513 Presentation
CS 60 Discussion Review.
CSCI The UNIX System Shell Startup and Variables
Shells, Help, and Paths.
Andy Wang Object Oriented Programming in C++ COP 3330
Shell Programming.
Linux Shell Script Programming
What is Unix? A multi-user networked operating system
Linux Commands LINUX COMMANDS.
January 26th, 2004 Class Meeting 2
Presentation transcript:

CMPSC 60: Week 5 Discussion

Topics for Today Some Unix commands Unix shells

Find Recursively search for files find . -name “*.txt” –list all files ending with “.txt” under the current dir find ~ -name ‘*.txt’ -maxdepth 2 Find files ending with .txt within home dir up to 2 levels deep find / -type d -user cshiflet find all directories on the server owned by cshiflet find ~ -mtime -7 find files under your home modified in the last 7 days (week)

Find (cont.) find ~ -size 0 -exec rm {} \; Delete all zero length files under your home dir find ~ -perm -006 -exec chmod o-rw {} \; change all files under your home dir that can be read and written by all users so that they cannot

Grep search multiple files for a pattern grep text * print the lines of any files that have “text” in them grep -r sometext * same as before, searching recursively grep -l sometext * print only the filenames of files with “sometext”

More Grep grep -n ‘//’ *.cpp grep -v text file grep -i text * print the lines from all .cpp files that have a ‘//’ in them, and print the line number it was found on grep -v text file print all the lines of file that do not have “text” in them grep -i text * print the lines of all files with “text” in them, insensitive to case

Tar – Tape ARchive Copy files to or from an archive -x to extract -t to test (list contents) -c to create -v to be verbose, print out what it’s doing -f filename -- specifies input/output archive -z -- gzip/gunzip the archive -j -- bzip2/bunzip2 the archive

Tar examples tar -tzvf some.tar.gz tar -xzf some.tar.gz List the files in some.tar.gz tar -xzf some.tar.gz Extract the files in some.tar.gz to the current dir tar -czf out.tar.gz indir/ Compress the dir “indir” and all files in it into out.tar.gz

Unix Shells Program that launches at login and allows you to enter commands Examples: CSH / TCSH BASH SH ZSH… and more

CSH - Manipulating Variables env - List all environment variables set - Set a normal variable set class = cs60 setenv - Set an environment variable for the life of the shell (i.e. until you logout) setenv PATH ${PATH}:/my/path/dir

CSH - Important Env Variables PATH - Directories to search when executing a program HOME - Full path of your home directory SHELL - Full path/name of your shell HOSTNAME - Host the shell is running on USER - User who invoked the shell (YOU)

CSH - Important Normal Variables prompt - Defines the prompt displayed set prompt=“%M:%~%” New prompt: host:~/current% set prompt=“[%t] %M:%~%” New prompt: [6:35pm] host:~/current% Other prompt variables can be found by in the tcsh man page history - Number of history commands stored set history=100

More prompt fun %M – the machine you’re logged into %~ – your current directory %t – the current time %n – your user name %h – the current history event number set prompt = "\n%n@%M [%t] %~\n%h %

CSH - Configuration Files ~/.cshrc - Run whenever CSH is started ~/.login - Run when you login with CSH ~/.logout - Run when you logout

CSH - ~/.cshrc Used to setup initial: PATH prompt aliases User defined variables Anything else you want every time you start CSH

CSH - ~/.login Put commands here that you only want execute when you first login