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.

Slides:



Advertisements
Similar presentations
Pre-Assessment Questions
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Chapter One The Essence of UNIX.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
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.
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
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.
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.
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
Guide To UNIX Using Linux Fourth Edition
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
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.
Unix Basics Chapter 4.
© 2012 The McGraw-Hill Companies, Inc. All rights reserved. 1 Third Edition Chapter 8 Linux on the Desktop McGraw-Hill.
Linux+ Guide to Linux Certification, Third Edition
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.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Introduction to UNIX Road Map: 1. UNIX Structure 2. Components of UNIX 3. Process Structure 4. Shell & Utility Programs 5. Using Files & Directories 6.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
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.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
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.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
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)
Linux Commands C151 Multi-User Operating Systems.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
A gentle introduction to LINUX at the command prompt.
© 2015 by McGraw-Hill Education. This proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
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.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
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.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
Learning Unix/Linux Based on slides from: Eric Bishop.
1 Linux Commands. 2 Path You specify a file or directory by its path name:  the full, or absolute, path name or the one relative to a location. The full.
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.
Getting started with CentOS Linux
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Some Linux Commands.
C151 Multi-User Operating Systems
The Command Prompt Commands are the way to “do things” in Unix
9 Linux on the Desktop.
Exploring the UNIX File System and File Security
Unix : Introduction and Commands
Getting started with CentOS Linux
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
January 26th, 2004 Class Meeting 2
Presentation transcript:

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 be shown only if the authentication information is correct. The Linux prompt includes the user name, followed by name. ( ) The Linux command syntax is very basic, and starts with a Linux command separated by spaces, and followed by optional parameters and switches. –A switch changes the way a command runs.

Basic Linux Skills and Concepts Comparing DOS and Linux –DOS is single user, single tasking –Linux is multi-user, multitasking –Many differences & Similarities in command-line interface The Shell –Character-mode user interface component –Processes commands –Issues error messages and other feedback –Called COMMAND.COM in DOS –Called BASH in Linux

Case Sensitivity –DOS is case insensitive –Linux is case sensitive –Designation of Switches –A switch changes the way a command runs –Switches in DOS begin with a slash (/) –Switches in Linux begin with a dash (-) Use of Spaces –DOS allows a space to be omitted between a command and a switch –Each part of a Linux command must be separated by a space –These commands will not work in Linux –shutdown-h now Basic Linux Skills and Concepts

Paths –DOS and Windows Paths begin with a drive designator (C:) A backslash (\) after the drive designator indicates the root of that logical drive Portions of path separated with backslashes –Linux No drive letter designation Path begins with a slash (/) indicating the root Portions of path separated with slashes Example: /etc/gtk Everything (devices, services, etc.) is a file –/dev/sda0 (the first hard drive on a SCSI interface) –/dev/hda1 (the first hard drive on an IDE interface) Basic Linux Skills and Concepts

Linux Feedback –DOS and Linux similar in providing cryptic feedback –No feedback when command is successful –Both provide error messages –Linux provides minimum output DOS dir command lists more information on files Linux ls command (without switches) only shows file names Basic Linux Skills and Concepts

The Command Syntax –command option option… –Options preceded by a - hyphen are switches –Multiple switches can be combined behind one hyphen –Another type of option is a parameter File name, directory, device name, or other. Parameter at end of command –Syntax: command –switch parameter –Example: ls –a /etc Basic Linux Skills and Concepts

Command-Line History –Shell commands are saved during a session –Scroll through the commands at the $ prompt Up Arrow and Down Arrow –Move within a command to edit it Left Arrow and Right Arrow –Press Enter to run command –Command history saved in the bash_history file Command Completion –A feature that completes a command line –Enter portion of a command and press the Tab key –Linux will try to guess the remaining portion Basic Linux Skills and Concepts

Shells, Terminals, and the Kernel Terminal –Channel that allows a certain user to log in and communicate with the kernel via a user interface

Shells, Terminals, and the Kernel Shell –User interface that accepts input from the user and passes the input to the kernel for processing –Shell used by default in Linux is the BASH Shell

The Linux Directory Structure Is arranged hierarchically using a series of directories to store files, and the location of these directories and files can be described using absolute or relative pathnames Figure 4-2: The Linux filesystem structure Linux Windows

DOS versus Linux Case sensitivity – Linux is case-sensitive, DOS is Not. Switches – Linux switches start with a hyphen (-) while DOS switches start with a slash (/). Spaces – Linux command line must be separated by a space. DOS commands can work with or without a space Path - Linux uses the forward slash (/) to indicate a path to a folder, while DOS uses the backslash (\) character to indicate a path to a folder. Output – Linux provides only the minimum output while DOS provides a very descriptive output.

Shell Metacharacters Metacharacters: characters that help define other characters Key combinations that have special meaning in the Linux

Command Sampler

Command Line The pwd command Print Working Directory - The default action is to show the current folder as an absolute path. The cd command Change Directory - change the current working directory to a specific Folder. # cd /usr/local/sybase move to sybase folder # pwd print current folder /usr/local/sybase # cd.. move up one folder # pwd print current folder /usr/local/

File Permissions Anatomy of ls –l output

Listing the Contents of a Folder The ls command is used to list the contents of a folder and information about files, by default the current directory. By default, the ls command only provides the names of visible files in the current folder. Some frequently used swicthes: -l, -a, -F # ls –al total 109 drwxr-xr-x 18 root root 4096 Jun 9 21:12./ drwxr-xr-x 18 root root 4096 Jun 9 21:12../ drwxr-xr-x 2 root root 4096 Jun 9 21:14 bin/ drwxr-xr-x 3 root root 1024 Jun 9 20:32 boot/ drwxr-xr-x 6 root root Jul 12 10:26 dev/ drwxr-xr-x 34 root root 4096 Jul 12 10:25 etc/ drwxr-xr-x 5 root root 4096 Jun 9 21:28 home/ File type, permissions, hard link count, file owner, group owner, size, mod date, directory name, filename or pointer.

Creating folders and Deleting in Linux The mkdir command Create new folder(s), if they do not already exist. Create labdir directory underneath the current directory # mkdir labdir The rmdir command Remove folder(s), if they are empty. # rmdir labdir The ‘rm’ command is used for deleting files & folders The command requires at least one parameter – the name of the file to be deleted. Defaults to –i or interactive prompt # rm filename

Renaming or Moving Files in Linux The mv command is used to rename a file or to move a file from one folder to another. Defaults to –i or interactive prompt The command required two parameters – the name of the original file and the new name or location of the file. Rename hosts file to hosts2, if hosts2 exists, you are prompted # mv hosts hosts2 Force rename without prompting # mv –f hosts hosts2

Copying Files in Linux The cp command is used to copy one or more files to another location. Can be used to do backups. Defaults to –i or interactive prompt The command requires two parameters – the source file and the destination where the file has to be copied. Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY copy home directory to floppy -f switch means remove existing destinations, never prompt # cp -f /mnt/floppy/* /home/simon Copy file hosts from directory /etc to this directory “.” # cp /etc/hosts.

Displaying the Contents of a File The cat command displays the entire contents of a file. # cat filename The more and less commands display the contents of a file one page at a time, ironically less provides more emulation and extensive enhancements, (moving, jumping, searching, line edit)less The head command displays the first ten lines of a file. The tail command displays the last ten lines of a file.

Logoff and Shutdown in Linux The exit command or the CTRL-D key combination can be used to log out Linux The shutdown –h now command is used to shut down the Linux machine immediately, and halt after shutting down. Normally root can shut down Linux from command line –A Linux GUI will allow ordinary user to shutdownSelect Log Out | Shutdown –Root can enable/disable this feature in the GUI –shutdown –h now Linux shuts down and turns off the computer –shutdown –r now Linux shuts down and reboots the computer

Basic Linux Skills and Concepts The Help Manual –Online manual accessed with man command –Syntax: man command Where command is the name of the command you wish to view Enter man man to see documentation for the man Page Down & Page Up to scroll one screen at a time Up Arrow and Down Arrow to scroll one line at a time –man shutdown The man command will display the complete list of switches for the shutdown command

The Filesystem Hierarchy Standard (FHS) Table 5-1: Linux directories defined by FHS