Linux command line basics I: files and folders Yanbin Yin Fall 2014 1

Slides:



Advertisements
Similar presentations
LIS651 lecture 5 direct use of wotan Thomas Krichel
Advertisements

Linux commands exercise 1. What do you need, if you try to these at home? You need to download and install Ubuntu Linux from the Internet – DVD is need.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Exploring the UNIX File System and File Security
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Guide To UNIX Using Linux Third Edition
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
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.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
1 Day 3 Directories Files Moving & Copying. 2 Case Sensitive First thing to learn about UNIX is that everything is case sensitive. Thus the files: –enda.
Brief introduction to UNIX A. Emerson CINECA, High Performance Systems.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
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.
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”
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.
Introducing UNIX EMBnet slide 1 Introducing the UNIX Operating System.
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.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Unix Basics Chapter 4.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
Chapter Two Exploring the UNIX File System and File Security.
Operating Systems and Using Linux CMSC 104, Lecture 3 John Y. Park 1.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
A Genomics View of Unix. General Unix Tips To use the command line start X11 and type commands into the “xterm” window A few things about unix commands:
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Introduction to Programming Using C An Introduction to Operating Systems.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
Linux Commands C151 Multi-User Operating Systems.
File and Folder CLI Commands 12/24/ Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
FTP COMMANDS OBJECTIVES. General overview. Introduction to FTP server. Types of FTP users. FTP commands examples. FTP commands in action (example of use).
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.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
 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.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
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.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
+ Introduction to Unix Joey Azofeifa Dowell Lab Short Read Class Day 2 (Slides inspired by David Knox)
Learning Unix/Linux Based on slides from: Eric Bishop.
Overview of Linux Fall 2016 Dr. Donghyun Kim
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.
Introducing the UNIX Operating System.
Chapter 11 Command-Line Master Class
Install external command line softwares
Prepared by: Eng. Maryam Adel Abdel-Hady
Some Linux Commands.
The Command Prompt Commands are the way to “do things” in Unix
The Linux Operating System
Intro to UNIX System and Homework 1
Exploring the UNIX File System and File Security
Web Programming Essentials:
Introduction Paul Flynn
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Presentation transcript:

Linux command line basics I: files and folders Yanbin Yin Fall

2 Access server from outside of NIU:

3 Understand Linux/Unix and shell File system Basic shell commands Commands for text processing Pipe: chain multiple commands to get text processing pipeline Shell one-liner There's always more than one way to do it

4 Putty, ssh secure shell client, both are installed on computers of MO444

5 Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote command-line login, remote command execution, and other secure network services between two networked computers What is ssh?

6 go to the left bottom, search “putty” Put the IP address: Hit Open

7 Hit Yes Put your student ID here and hit enter Wait until you see the following, then put your password (the same as your student ID) Your password will be invisible while you are typing it in. Hit enter after you are done Your user name and password are both your student ID

8 If you have put your password correctly, you will see this, meaning you are logged in now: If you did NOT put your password correctly, you will see this: Just do it again A plain text world Everything is text, no images Good: lowest consumption from graphics, all resources (CPU, RAM, hard drive) saved for computation Bad: User unfriendly

9 User nameMachine name Your home (colon, tilde) Prompt sign Cursor sits right after prompt What you see after you successfully logged in

10 MAC has its built-in terminal. Search terminal application Type in this part, hit enter and then yes, put password, and then you are connected

11 Ubuntu has its GUI and terminal and if you want to connect to another Linux server After the terminal is opened, type: ssh

12 To summarize: how to log in WINDOWS Linux Ser server MAC putty Terminal: ssh Terminal: ssh Terminal: ssh ssh … To logout, type logout, exit or Ctrl+d

13

14 In the graphical interface of Windows, Linux and MAC, you click your mouse to make something happen. However, under command line terminal (or console) interface, you always type in a command using the keyboard and hit Enter to let something happen. The command you typed in is interpreted and executed by the Shell, the Linux software and interface to connect the users and the OS. The output of the command is printed on the screen by default or written to a file. (together with error msg if any) Interactive command line terminal

15 The operating system Terminal is the interface/Shell where user talks (by typing a command) to the kernel to operate hardware What is shell?

16 Commands Commands can be a single word/letter or a few words separated by space; always hit Enter after you finished typing The first word/letter is often a Shell command or an external program or your own script name Other words can be command options, files, folders etc. Examples: pwd /home/yyin ls /disk4/z examples.desktop For all of you, your home is at /disk?/yourid ? could be 1, 2, 3, 4 e.g. /disk4/z

Commands you must learn

18 s s: command not found ' > > ^C If you type some not-existing command If you mistakenly type in a quote and hit enter, you get stucked Ctrl+c will get you out of there Ctrl+d will log you out For people who have no experience in terminal: you are like in a dark room alone. Where am I, what is that sound, what did I just bump into? You can’t see, you have to get used to using your other senses … No shortcuts, just learn by using

19 Everything is a file or a folder/directory in Linux A folder contains files or/and other folders (subdirectories) A subdirectory can contain other files or folders So the file system is a tree-like structure (multi-furcation) / /home /bin /media /usr /etc /media/DATAPART1 /media/DATAPART2 /media/DATAPART3 … /home/nmcginn /home/hscao /home/yyin … … … /home/yyin/book … root 2 nd level 3 rd level 4 th level

20

21 Since you are in a file system, knowing where you are is very important Remember pwd is the command to find where you are (working directory) If you issue a command which expect a file/folder name, you need to tell Shell the location of the file/folder, which is called path Without specifying the path, Shell will think the file/folder is in the current folder. If it can’t find the file, it reports an error pwd /home/yyin ls /disk4/z examples.desktop

22 File/folder/program names Case sensitive!!! File and file are two different files Allow to contain letters, numbers, underscore (_), dot (.), dash (-), plus (+) but not to use other special characters and spaces Example: fungal]$ ls all.hmmlib_1.75.fungal-dockerin.domain.fa.nobac.n2+.fa.id.source.nrgi.ps.col.lab For programs, better use the correct file extension (.sh,.pl,.c,.py), e.g. run-blast.sh

23 Home folder (dir) After you login a remote Linux machine or you opened a terminal in your Ubuntu or MAC computer, you are at your home You can create or download folders, files, bioinformatics softwares Make it organized and clean by creating folders that have meaningful names, such as tools, data, work, project, scripts etc. You can also create subfolders, e.g. blast under tools, or project1 under project Don’t put everything in your home directory; you will easily accumulate too many files/folders/programs/scripts that you will have a headache to find or remember

24 Directory (folder) commands pwdfind out where you are (your current directory or working directory) cdchange directory Remember? Save you from some typing Don’ need to type everything in Always use TAB key to auto-complete a word!!!!!!!!!! Up arrow key to bring your previous commands

25 Relative path and absolute path Find out where you are: cd /home/yyin pwd /home/yyin If I want to change directory to /home/ cd.. If I want to go back to my home cd yyin I can also use the absolute path to go back cd /home/yyin Absolute path or full path Relative path, relative to your current dir: /home

26 Special denotations: ~ or ~/ your home. or./ your current directory.. or../ the dir one level above../.. ? Try: cd ~ cd.. pwd cd../.. pwd If you think you are lost in the file system and don’t know where you are, always run pwd From anywhere to go back to you home cd cd ~ tilde

27 More directory commands mkdircreate a directory rmdirdelete an empty directory (have no subdirectories or files) At your home, try mkdir bioinfo Remember case sensitive and no special characters and space!!!

28 List command ls list what files and directories are there in a folder Try ls ls –llist in long listing format ls –lalist all including hidden files/folders ls –ltlist according to modification time ls –ltrlist according to time in reverse order ls..list one level up ls –l /home/yyinlist things under a given folder ls –l | lessif there are too many files to display in one page, use pipe and less to show page by page (will explain shortly) have to type q to exit less These are options, used to enrich the functionalities of a command

29 The manual command man ls If the manual is more than one page, hit space or PgDn key to page down, PgUp key or u to page up To exit the man page, hit q Man followed by any Linux command to display the manual of that command man pwd man cd …

30 Permission User and Group size Modification time d means folder ls –lt /

31 File and folder permission can be changed Let’s look at one of the files under my home: The first one “-“ means it is a file; it will be “d” if it is a folder (directory). The following nine columns indicate the permission of read (r), write (w) and execute (x) granted for the user (first three columns), the group (middle three) and others (last three). “-“ means no permission -rwxrwxrwxthe file could be read, write, and execute by anybody -r can only be read by the owner chmod go-r /home/yyin/Unix_and_Perl_course/Data/GenBank/E.coli.genbank ls -l /home/yyin/Unix_and_Perl_course/Data/GenBank/E.coli.genbank -rw-r--r-- 1 yyin yanbin Oct /home/yyin/Unix_and_Perl_course/Data/GenBank/E.coli.genbank Now you can not read that file in my home -rw-r--r--

32 How to view files In order for you to read my file: chmod go+r /home/yyin/Unix_and_Perl_course/Data/GenBank/E.coli.genbank ls -l /home/yyin/Unix_and_Perl_course/Data/GenBank/E.coli.genbank -rw-r--r-- 1 yyin yanbin Oct /home/yyin/Unix_and_Perl_course/Data/GenBank/E.coli.genbank At your home, try head /home/yyin/Unix_and_Perl_course/Data/GenBank/E.coli.genbank Similar commands: more less tail cat Unlike in Windows, text files of any size can be viewed Only text files can be viewed There are also binary files, zipped files and tarred files that can not be viewed. For example, - Executables (e.g., blast, samtools, bwa, bowtie) - Data in binary format (e.g, BAM files, index files for BWA or Bowtie, formatted BLAST databases) - Compressed files (usually *.gz, *.zip, *.bz2,…, but extensions not necessary)

33 How to copy and move files/folders At you home, try cp /home/yyin/Unix_and_Perl_course/Data/GenBank/E.coli.genbank. Remember what dot (.) means? Now try, ls mv E.coli.genbank bioinfo ls mv bioinfo/E.coli.genbank. ls What about? mv E.coli.genbank bioinf What if you want to copy a folder? cp –r bioinfo bioinfo2 You created this folder in your home moments ago Difference? mv file folder mv file file

34 How to delete files/folders? rm fileremove file rm folderremove empty folder rm –rf folderremove not empty folder For example, rm –rf bioinfo2 WARNING: deleted things can not be recovered in Linux!!! To be asked before deletion, rm -i bioinf rm: remove regular file `bioinf'? y

Homework #6 Create a folder under your home called hw6; pwd to find out where you are Change directory to hw6; pwd to find out where you are Copy the entire folder Unix_and_Perl_course from my home to your working folder (the folder where you currently are) Change directory back to your home Use ls to explore the folder Unix_and_Perl_course and the sub-folders in there to locate the At_genes.gff file and the unix_and_perl_v3.1.1.pdf file. Tell me what is the size and creation date of these files. Change the permission of the At_genes.gff file so that every user can edit this file. 35 Write a report (in word or ppt) to include all the operations/commands and screen shots. Due on 10/30 (send by ) Office hour: Tue, Thu and Fri 2-4pm, MO325A Or

Next class: commands for controlling files 36