Filesystem and common commands

Similar documents
Processes. System tasks Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Your daily cup of CLI

Archives. Gather and compress Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Access Control Lists. Beyond POSIX permissions Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Sudo: Switch User Do. Administrative Privileges Delegation Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Files

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Lab 2: Linux/Unix shell

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection

CSCI 2132 Software Development. Lecture 4: Files and Directories

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

A Brief Introduction to the Linux Shell for Data Science

Files and Directories

Lec 1 add-on: Linux Intro

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

UNIX File Hierarchy: Structure and Commands

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

Unix tutorial. Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based.

Welcome to Linux. Lecture 1.1

Advanced Linux Commands & Shell Scripting

Linux Command Line Primer. By: Scott Marshall

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line

11/10/2011. Directory Structures (continued)

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

Week 2 Lecture 3. Unix

Essential Linux Shell Commands

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

Lab Working with Linux Command Line

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

Working with Basic Linux. Daniel Balagué

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Bioinformatics? Reads, assembly, annotation, comparative genomics and a bit of phylogeny.

Introduction to Unix: Fundamental Commands

Introduction: What is Unix?

Chapter-3. Introduction to Unix: Fundamental Commands

Operating Systems. Copyleft 2005, Binnur Kurt

Perl and R Scripting for Biologists

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois

5/8/2012. Creating and Changing Directories Chapter 7

CS246 Spring14 Programming Paradigm Notes on Linux

Mills HPC Tutorial Series. Linux Basics I

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

Chapter 1 - Introduction. September 8, 2016

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms:

EECS2301. Lab 1 Winter 2016

UNIX System Programming Lecture 3: BASH Programming

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

Unix Tutorial Haverford Astronomy 2014/2015

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

5/20/2007. Touring Essential Programs

Links, basic file manipulation, environmental variables, executing programs out of $PATH

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

Linux for Beginners. Windows users should download putty or bitvise:

Introduction to Linux

Introduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017

Getting your department account

Introduction to Linux

Unix Filesystem. January 26 th, 2004 Class Meeting 2

INF322 Operating Systems

An Introduction to Using the Command Line Interface (CLI) to Work with Files and Directories

Linux Command Line Interface. December 27, 2017

CSC UNIX System, Spring 2015

Introduction to Linux

Short Read Sequencing Analysis Workshop

CSC209. Software Tools and Systems Programming.

Linux & Shell Programming 2014

The UNIX Operating System. HORT Lecture 2 Instructor: Kranthi Varala

Outline. Structure of a UNIX command

Introduction to UNIX command-line

Course 144 Supplementary Materials. UNIX Fundamentals

Std: XI CHAPTER-3 LINUX

Command-line interpreters

Introduction to Linux Workshop 1

Introduction to Linux

AOS Linux Tutorial. Introduction to Linux. Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University. September 15, 2011

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

CST Algonquin College 2

CSE 390a Lecture 1. introduction to Linux/Unix environment

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

System Administration

Linux Nuts and Bolts

CSE 391 Lecture 1. introduction to Linux/Unix environment

Working With Unix. Scott A. Handley* September 15, *Adapted from UNIX introduction material created by Dr. Julian Catchen

CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

CS4350 Unix Programming. Outline

CSE 391 Lecture 1. introduction to Linux/Unix environment

Computer Systems and Architecture

Operating System Interaction via bash

Introduction to Linux. Fundamentals of Computer Science

Basic Survival UNIX.

Transcription:

Filesystem and common commands Unix computing basics Campus-Booster ID : **XXXXX www.supinfo.com Copyright SUPINFO. All rights reserved

Filesystem and common commands Your trainer Presenter s Name Title: **Enter title or job role. Accomplishments: **What makes the presenter qualified to present this course. Education: **List degrees if important. Publications: **Writings by the presenter on the subject of the course or presentation. Contact: **Campus-Booster ID: presenter@supinfo.com

Filesystem and common commands Course objectives By completing this course, you will: n Talk about fs hierarchy. Forest vs tree. n Tell files from directories. Using the command line. n Guess where removable devices are. Mounting concept and conventions. n Navigate in the filesystem. And work with files and directories. n Combine tools. Using streams, pipes, and redirections.

Filesystem and common commands Course topics Course s plan: n Unix filesystem. Finding your way through. n Using the shell. Terminal shell and console. n Common commands. Survival kit. n Streams and redirections. STDOUT and friends.

Filesystem and common commands Unix filesystem Finding your way through.

Unix filesystem Forest vs Tree Unix vs Windows fs models n Windows n multi-root n One root per FS Disk drive n No single entry point n Forest n Unix n Single root n Single entry point n Tree

Unix filesystem Windows

Unix filesystem Unix

Unix filesystem Paths Relative vs Absolute n Absolute n aka Full path n Begins with a / /home/supinfo/ Documents/doc.txt n Can be (very) long n Relative n From the current working directory n CWD = /home/supinfo Documents/doc.txt

Unix filesystem Mounting What about removable devices? n Windows n Unix n New disk drive n Need to attach the new fs to the existing hierarchy n Bind a filesystem to a directory n Usually under /mnt/ n mount command

Unix filesystem Everything is a file If not, it s a process n Devices exposed n Special files char block n /dev n Examples /dev/dsp /dev/sda n System settings n /proc/sys/

Unix filesystem Stop-and-think Do you have any questions?

Unix filesystem Stop-and-think I m a file. I ll sing out what s written to me. I am: u

Unix filesystem Stop-and-think I m a file. I ll sing out what s written to me. I am: u /dev/dsp

Filesystem and common commands Using the shell Terminal, shell and console

Using the shell Definition Shell - also called "command interpreter executes commands that the user types.

Using the shell The prompt The shell prompt is a set of characters at the start of the command line that indicates that the shell is ready to receive commands. Username Current working directory Path [supinfo@linux-tpl1:~/documents]$ Hostname Privilege level $ for regular users # for root

Using the shell Terminal, shell and console n Terminal n Hardware n Connected to the server n Terminal emulator n Software n Understand the original protocol (VTx) n Shell n User interact with it through the terminal n TTY/Console n Generic term for any {STDIN,STDOUT,STDERR} tuple

Using the shell Terminal example n Bull Questar 4000 n Many stations n screen, keyboard n One server (the cube) n Used by French administration(trésor Public) n Original terminals until late 90 s n Moved to terminal emulators running on PC s in the early 2k s

Using the shell Virtual Terminals Old concepts, modern hardware n TTY subsystem n Generic Local/Network n Virtual terminals n Like workspaces n Available through alt +F1..F6 ctrl from X n Different from terminal emulators

Using the shell Stop-and-think Do you have any questions?

Using the shell Stop-and-think The prompt is provided by: The terminal The console A TTY The Shell

Using the shell Stop-and-think The prompt is provided by: The terminal The console A TTY The Shell

Filesystem and common commands Common commands Survival kit

Common commands Listing files Good ol list segments from multics. ls [options] file-expression Option Definitions -l -h Long listing: Mode, owner, size,... Human-readable file size -a Also list hidden files Example: ls -lh *.zip

Common commands Globbing Matching files using joker characters * Corresponds to none or some characters.? Corresponds to one character. [a-z] [^a-z] Corresponds to all the letters between a and z Corresponds to all the characters except the letters between a and z. [user@linux ~]$ ls [b-c]*.txt batman.txt chocolate.txt

Common commands File properties Anatomy of a ls -l File mode bitfield represent permissions and file type mode User owner and group owner Ownership Last modification date (mtime) File -rwxr-xr-x 1 user group 64 Nov 29 17:07 file.txt Hard links Number of hard links. File size In bytes. Use -h to get humanreadable sizes. Filename

Common commands The current working directory n To get the current working directory [user@linux bin]$ pwd /usr/bin n To move into a directory : [user@linux ~]$ cd directory n directory : relative or absolute path.

Common commands The current working directory n To get back to the home directory cd or cd ~ [user@linux bin]$ pwd /usr/bin [user@linux bin]$ cd ~ [user@linux ~]$ pwd /home/user n To get back to the previous directory cd - : [user@linux ~]$ cd /usr/bin [user@linux bin]$ cd - [user@linux ~]$

Common commands Copying files The cp command: cp [options] source destination Option Definitions -r -f Recursively copy directories Delete destination if exists -p Preserve ownership Example: cp -p /etc/lilo.conf./lilo.conf

Common commands Delete files The cp command: rm [options] file... -r, -R -f Option Definitions Recursively delete directories Don t prompt for confirmation -i Prompt for confirmation Example: rm -Rf ~

Common commands Rename/move files The mv command: mv [options] source destination Option Definitions -f -i -b Don t prompt before overwrite Prompt before overwrite Create a backup of existing destination before overwriting. Example: mv texst.txt test.txt mv /etc/lilo.conf.

Common commands Creating links The ln command: ln [options] source link-name Option Definitions -s Create symlinks Example: ln -s /etc/init.d/apache2 S99apache2 ln ~/Documents/file.txt.

Common commands Links Symlinks vs hardlinks n Symlink n To the name/path n Like Windows shortcuts n Use an inode n Hardlinks n Other pointer to the same content n Cannot point outside the filesystem/partition

Common commands Creating directories The mkdir command: mkdir [options] directory Option Definitions -p Create parent directories as needed Example: mkdir tinkering mkdir -p /var/tmp/workspace

Common commands Show files content The cat command: cat [file...] file Argument Definitions A list of files to show/concatenate Example: cat file1.txt cat part1.txt part2.txt

Common commands Output text The echo command: echo [options] text Option Definitions -e Interpret escape sequences Example: echo Test string echo -e There is a newline\nhere

Common commands Stop-and-think Do you have any questions?

Common commands Stop-and-think The ~ symbol expands to the current user home directory. It s a : Relative path Absolute path

Common commands Stop-and-think The ~ symbol expands to the current user home directory. It s a : Relative path Absolute path

Filesystem and common commands Streams and redirections STDOUT and friends.

Streams and redirections I/O Streams Each process (shell incl) works with 3 streams: n STDIN (0) n Read only n Data source n Default: keyboard n STDOUT (1) n Write-only n Default: screen n STDERR (2) n Write-only n Separate errors n Default: screen

Streams and redirections Redirections Unix fundamentals: Connecting programs n Process n 3 Streams Like chip pins n Can be connected n Combine programs n Achieve complex process n Using simple tools n Redirections n Plug pins

Streams and redirections Redirections Redirection operators: > file < file >> file 2>&1 Write the result of a command to a file. If the file exist it ll be overwritten. Read file as standard input Append the result of the command at the end of file. The file content is not overwritten. Rewrite the error output to the standard output n Example : [user@linux ~]$ ls -l >> file

Streams and redirections Pipes n The pipe allows to send the result of a command to another. [user@linux ~]$ command1 command2 n Example : [user@linux ~]$ ps ax grep tty 8853 tty1 Ss+ 0:00 /sbin/agetty 38400 tty1 linux 8856 tty2 Ss+ 0:00 /sbin/agetty 38400 tty2 linux 8857 tty3 Ss+ 0:00 /sbin/agetty 38400 tty3 linux 8858 tty4 Ss+ 0:00 /sbin/agetty 38400 tty4 linux 8859 tty5 Ss+ 0:00 /sbin/agetty 38400 tty5 linux 8860 tty6 Ss+ 0:00 /sbin/agetty 38400 tty6 linux

Streams and redirections Stop-and-think Do you have any questions?

Streams and redirections Stop-and-think You want to feed program2 with program1 output. Which feature will you use? Redirections Pipe

Streams and redirections Stop-and-think You want to feed program2 with program1 output. Which feature will you use? Redirections Pipe

Filesystem and common commands Course summary File attributes Unix filesystem Working with files and directories Mounting concept Streams and plumbing

Filesystem and common commands For more If you want to go into these subjects more deeply, Publications Courses Linux Technologies: Edge Computing Linux in a nutshell Web sites www.supinfo.com www.labo-linux.com www.blackbeltfactory.com Conferences FOSDEM RMLL Solutions Linux

Congratulations You have successfully completed the SUPINFO course module n 02 Filesystem and common commands

Filesystem and common commands The end n The TAB key: Use and abuse autocompletion n Lost? Let pwd be your guide.