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.

Slides:



Advertisements
Similar presentations
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Advertisements

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.
CSE 303 Lecture 2 Introduction to bash shell
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
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  Currently there.
Linux Commands LINUX COMMANDS.
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.
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”
© Crown copyright Met Office An Introduction to Linux PRECIS Workshop, University of Reading, 23rd – 27th April 2012.
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.
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Dedan Githae, BecA-ILRI Hub Introduction to Linux / UNIX OS MARI eBioKit Workshop; Nov , 2014.
CS 497C – Introduction to UNIX Lecture 7: General-Purpose Utilities Chin-Chih Chang
©NIIT Collaborate Lesson 1C / Slide 1 of 23 Collaborate Knowledge Byte In this section, you will learn to: Use the cal command Determine the file types.
Interacting with a UNIX computer: Navigating through the directory tree.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
Introduction to UNIX Road Map: 1. UNIX Structure 2. Components of UNIX 3. Process Structure 4. Shell & Utility Programs 5. Using Files & Directories 6.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
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.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Linux - Ubuntu LECTURE TWO. Objective: Enable students to understand the practical side of Linux operating system. Understand and implement the following.
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.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
CSCI 330 UNIX and Network Programming Unit II Basic UNIX Usage: File System.
The Unix File sytem. Introduction Tree structure …
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
Learning basic Unix command It 325 operating system.
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.
Learning Unix/Linux Based on slides from: Eric Bishop.
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.
Tutorial of Unix Command & shell scriptS 5027
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.
Prepared by: Eng. Maryam Adel Abdel-Hady
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
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
Eric Shook Department of Geography Kent State University
Command Line Interface for Beginners
CSE 374 Programming Concepts & Tools
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Operating Systems and Using Linux
Tutorial of Unix Command & shell scriptS 5027
The Unix File System.
Getting started with CentOS Linux
Tutorial Unix Command & Makefile CIS 5027
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
Using Linux Command 3 Lab#6.
January 26th, 2004 Class Meeting 2
Presentation transcript:

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 path name starts with the root, /, and follows the branches of the file system, each separated by /, until you reach the desired file. A relative path name specifies the path relative to another, usually the current working directory that you are at. Two special directory entries should be introduced now: . the current directory .. the parent of the current directory % cd /home/hls/notes % cd./notes

3 Working with Folders (Directory) 1- ls ( list directory content) ls This command outputs a list of the files in the current directory ls ~ This command outputs a list of the files that are in your home directory 2- mkdir (make directory) mkdir dir1 mkdir dir1/dir2

Exploring Command Shell 3- cd ( c hange d irectory) – cd / This command navigate you to the root directory – cd dir1 This command moves you to dir1 – cd dir1/dir2 This command moves you to dir2 – cd ~ This command navigate you to your home directory (it is equivalent to cd /home/username/ ) – cd.. To navigate up one directory level – cd - To navigate to the previous directory (or back) 4

Exploring Command Shell 4- rmdir (remove directory) – rmdir dir1/dir2 Removes the directory that is named dir2 in side the sub directory dir1) – rmdir dir1 To Remove any directory it should be empty This command removes the empty directory named dir1 5- pwd (print working directory) – pwd display which directory your are currently located in 5

6 Working with Files 6- touch (create file) – touch file1 7- rm ( r e m ove file) – rm file1

7 Directory Navigation Navigation and directory control command     pwd (print working directory): At any time you can determine where you are in the file system hierarchy with the pwd, print working directory, command, e.g.: % pwd /home/user/Desktop/cs002 % pwd /home/user/Desktop/cs002

8 File Maintenance Commands cp (copy a file): copy the contents of one file to another. mv (move a file): Rename a file. % cp old_file new_file % mv old_name new_name

9 Display the Content of a File cat (concatenate a file): display the content of a file.  Common Options: -n precede each line with a line number. what about this command: $ cat filename This is the content of filename. It contains two line. $ cat filename This is the content of filename. It contains two line. $ cat -n filename 1 This is the content of filename. 2 It contains two line. $ cat -n filename 1 This is the content of filename. 2 It contains two line. $ cat file1 file2 file3

10 head: displays the head, or start, of the file. 40 = head line no tail : displays the tail, or end, of the file. % head -40 filename. % tail -30 filename Display the Content of a File

11 Uniq (remove duplicate lines):  The uniq utility displays a file, skipping adjacent duplicate lines, but does not change the original file.  If a file contains a list of names and has two successive entries for the same person, uniq skips the extra line. %cat file %uniq file %cat file %uniq file Display the Content of a File

12 wc (count words in a file): stands for "word count"; the command can be used to count the number of lines, characters, or words in a file.  Common Options: -c count characters -l count lines -w count words  If no options are specified it defaults to "-lwc". %cat users jdoe John Doe 4/15/96 lsmith Laura Smith 3/12/96 pchen Paul Chen 1/5/96 jhsu Jake Hsu 4/17/96 sphilip Sue Phillip 4/2/96 % wc users users %cat users jdoe John Doe 4/15/96 lsmith Laura Smith 3/12/96 pchen Paul Chen 1/5/96 jhsu Jake Hsu 4/17/96 sphilip Sue Phillip 4/2/96 % wc users users Display the Content of a File

13 sort ( sort file contents): The sort command is used to order the lines of a file. Common Options  -r reverse the sort  -u unique; omit multiple copies of the same line (after the sort) %cat users jdoe John Doe 4/15/96 lsmith Laura Smith 3/12/96 pchen Paul Chen 1/5/96 jhsu Jake Hsu 4/17/96 sphilip Sue Phillip 4/2/96 % sort -r users sphilip Sue Phillip 4/2/96 pchen Paul Chen 1/5/96 lsmith Laura Smith 3/12/96 jhsu Jake Hsu 4/17/96 jdoe John Doe 4/15/96 %cat users jdoe John Doe 4/15/96 lsmith Laura Smith 3/12/96 pchen Paul Chen 1/5/96 jhsu Jake Hsu 4/17/96 sphilip Sue Phillip 4/2/96 % sort -r users sphilip Sue Phillip 4/2/96 pchen Paul Chen 1/5/96 lsmith Laura Smith 3/12/96 jhsu Jake Hsu 4/17/96 jdoe John Doe 4/15/96 Manipulate the Content of the File

14 Displays the Time and Date date [options] [+format] Common Options  -u :use Universal Time (or Greenwich Mean Time)  +format: specify the output format %a weekday abbreviation, Sun to Sat %h month abbreviation, Jan to Dec %D MM/DD/YY date %T HH:MM:SS time %t $ date Thu Jan 20 10:24:00 PST 2008 $date -u Mon Jun 10 13:01:33 GMT 2008 $date +%a%t%D Mon 06/10/96 $ date Thu Jan 20 10:24:00 PST 2008 $date -u Mon Jun 10 13:01:33 GMT 2008 $date +%a%t%D Mon 06/10/96

Calculator ◮ bc: A text based calculator $ bc 2* /2 [Input] 33 [Output] [ctrl+d] [Quit] ◮ xcalc is graphical based calculator

Clear - to clear the terminal window Free - Displays the amount of used and free system memory. Shutdown command examples Shutdown the system and turn the power off immediately. # shutdown -h now Shutdown the system after 10 minutes. # shutdown -h +10

System Admin In Linux uptime command shows since how long your system is running and the numbers of users are currently logged in. inutes intervals