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.

Slides:



Advertisements
Similar presentations
Chapter One The Essence of UNIX.
Advertisements

NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
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.
Exploring the UNIX File System and File Security
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.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
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.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Unix Basics Chapter 4.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
An Introduction to Unix Shell Scripting
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface What is the directory tree Some UNIX commands.
Linux+ Guide to Linux Certification, Second Edition
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Chapter Two Exploring the UNIX File System and File Security.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
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.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
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.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
Chapter Two Exploring the UNIX File System and File Security.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
8-2 What is a program? What is a “Window Manager” ? What is a “GUI” ? How do you navigate the Unix directory tree? What is a wildcard? Readings: See CCSO’s.
Writing Scripts Hadi Otrok COEN 346.
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.
Introduction to Programming Using C An Introduction to Operating Systems.
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.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
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.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
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.
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  There are many different.
Lesson 6-Using Utilities to Accomplish Complex Tasks.
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 Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
Introduction to LINUX command line Allegra Via IBBE, National Research Council, Italy Sapienza Università di Roma, Italy EMBO Practical Course on Computational.
Introduction to Unix for FreeSurfer Users
Prepared by: Eng. Maryam Adel Abdel-Hady
The Linux Operating System
Shell Script Assignment 1.
Shell Environments.
Basic UNIX OLC Training.
WELCOME FREESURFER COURSE ATTENDEES!
LING 408/508: Computational Techniques for Linguists
Exploring the UNIX File System and File Security
(Chapter 2) John Carelli, Instructor Kutztown University
Introduction Paul Flynn
Linux Shell Script Programming
January 26th, 2004 Class Meeting 2
Presentation transcript:

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 and how to navigate it Where and how to write a program How to run programs on Unix

The shell The shell is an interpreter (a program) that lets you interact with the operating system graphical interface graphical shellcommand-line shell command-line interface

graphical interface

What happens when you double click on the icon of an application? command

command-line interface prompt Here you write the command

to send typed instructions to the computer (i.e., run programs, move/view files, etc.) to see the output that results from those instructions. The command-line interface (terminal) allows you: Every time you type any Unix command and press enter, the computer will attempt to follow your instructions and then, when finished, return you to the command prompt.

Open a command-line terminal on your computer

You can type a program name at the terminal prompt and then type [Return] command

The Terminal can be customised Change default color Change text size and font Increase/decrease transparency Resize it Have multiple windows open side by side Change the command prompt (most commonly a $ or % sign) Make the cursor blinking

Type the Unix command ‘ ls ’ at the command prompt What happens?

The directory structure Root (/) home bin etcvartmpusr allegrakristian courses applications data phospho tmp The file-system is arranged in a hierarchical structure, like an inverted tree The top of the hierarchy is traditionally called root When you first login, the current working directory is your home directory (containing files and directories that only you can modify)

Navigating the filesystem tree Slashes separate parts of the directory path: /home/allegra/courses/TGAC2015/Academis_Linux.pdf What else do you need? Find out where you are in the filesystem Change directory Find your way home Make a new directory Remove a file Remove a directory

Everything in Unix is either a file or a process A process is an executing program identified by a unique PID (PID = Process IDentifier) A file is a collection of data

Access your home directory using the command-line interface Create a text file “myfile.txt” and save it in your home directory Start the gedit text editor Go to the command-line interface and type “ls” at the prompt

About Unix commands %rm myfile.txt [Return] The shell searches the file containing the program rm executes the program rm on myfile.txt After the process rm myfile.txt has finished running, the shell returns the prompt % to you, indicating that it is waiting for further commands. Commands are themselves programs Here you can type a new command

General remarks If you've made a typo: CTRL-u to cancel the whole line Unix is case-sensitive There are commands that can take options The options change the behaviour of the command UNIX uses command-line completion

%command_name -options [Return] %man [Enter] %whatis [Enter] General remarks

CTRL-A sets the cursor at the beginning of the line CTRL-E sets the cursor at the end of the line You can use a text editor to write stuff You can use up and down arrows to recall commands The command whereis tells you where is a given program General remarks

File system security (access rights) -rwxr-xr-- 1 gould admin :57 new_scop.txt Each file (and directory) has associated access rights, which may be found by typing ls -l permissions number of links owner group owner size in bytes date and time of the last modification file's name r allows users to list files in the directory w allows users to delete files from the directory or move files into it x allow users to access files in the directory Access rights on directories d

Changing access rights: chmod %chmod go-rwx myfile.txt %chmod a+x my_script

The Unix shell The shell is a command-line interpreter that lets you interact with Unix The shell takes what you type and decides what to do with it The shell is actually a scripting language somewhat like Python It is always possible to change shell (either temporarily or permanently)

UNIX environment variables Unix keeps track of several special variables that are associated with your account Written in upper-case letters Start with a $ echo $SHELL printenv SHELL setenv or printenv

You can write shell commands in a file and make the file executable

#!/bin/bash "Aha, you want to use the program located at /bin/bash to interpret all the instructions that follow" Bradnam&Korf - Unix and Perl to the Rescue

Where Unix searches for programs? Once you have made a script executable you can always run it by prefixing its name with a path:./shell_commands.sh ~allegra1/Documents/didattica/TrainingCourses/TGAC/April2 015/varie/shell_commands.sh Anytime you are running a program, Unix will check through a list of predefined directories to see if that program exists in any of those locations. If it finds a match, it will try running the program and stop looking in any other directory. If it cannot find a match, it will print " command not found "

If the system returns a message saying " command: Command not found ", this indicates that either the command doesn't exist at all on the system or it is simply not in your path. echo $PATH # for shells in the bash family export PATH=$PATH:~/allegra1/TGAC # for shells in the csh family setenv PATH $PATH\:~/allegra1/TGAC Any program in ~/allegra1/TGAC can be run from anywhere in the filesystem (as long as the program file is executable) You can use tab-completion Your scripts will be treated like any Unix command

Listing files and directories The directories ‘. ’, ‘.. ’, and ‘ ~ ’ % ls -a [Enter] % cd. [Enter] % cd.. [Enter] % ls ~/oeiras

Handling files and directories clearlessmore

Redirection