By: Tony Andrews.  Linux directory ordering system  Navigating and creating directories ◦ Listing directories and files ◦ Creating directories ◦ Changing.

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
©Colin Jamison 2004 Introduction to Linux Colin Jamison.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
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 Basics. Systems Programming: Unix Basics 2 Unix Basics  Unix directories  Important Unix file commands  File and Directory Access Rights through.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
UNIX Command-line Introduction Terence Parr. Navigating  cd  pwd  ls  pushd/pod  cd  pwd  ls  pushd/pod.
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.
Linux Installation and Administration Lesson 2 Tutor: George Papamarkos.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Learning basic Unix command IT 325 operating system.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
The file structure and related utilities CS240 Computer Science II.
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.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
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:
Dedan Githae, BecA-ILRI Hub Introduction to Linux / UNIX OS MARI eBioKit Workshop; Nov , 2014.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
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.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter Two Exploring the UNIX File System and File Security.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
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:
Introduction to Programming Using C An Introduction to Operating Systems.
The Genome Analysis Centre Building Excellence in Genomics and Computational Bioscience.
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.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
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.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
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 Unix File sytem. Introduction Tree structure …
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
EMT 2390L Lecture 3 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
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.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
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.
A Basic Introduction to the Linux Commandline
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.
Lecture 2 Working with Files and Directories
Some Linux Commands.
C151 Multi-User Operating Systems
The Command Prompt Commands are the way to “do things” in Unix
Useful Linux Commands.
Command Line Interface for Beginners
CSE 374 Programming Concepts & Tools
Basic UNIX OLC Training.
Web Programming Essentials:
Getting started with CentOS Linux
Tutorial Unix Command & Makefile CIS 5027
Lab 2: Terminal Basics.
January 26th, 2004 Class Meeting 2
Presentation transcript:

By: Tony Andrews

 Linux directory ordering system  Navigating and creating directories ◦ Listing directories and files ◦ Creating directories ◦ Changing directories ◦ Removing directories  Managing files ◦ Displaying content of a file ◦ Copying files ◦ Moving files ◦ Removing files ◦ Searching the content of a file

 Wildcards and general searches ◦ Wildcard “*” and “?” ◦ Find  Access rights to files  Processes ◦ Listing processes ◦ Killing processes  Finding more help with commands in command window. ◦ Manual ◦ Whatis ◦ Apropos

 The linux operating system is built like a tree. ◦ Top directory is the root directory “/” ◦ Followed by other ones like home etc. ◦ Music is located at: /Home/Tony/Music (Stonebank)

 Command “ls” lists all of the files and directories in the current directory. ◦ Ie.)  The command “ls –a” lists all of the files and some hidden files that start with “.” or “..”  Command “ls –l” is a long list which shows all of the files and directories as well as how large they are and when they were created. ◦ Ie.) (stonebank)

 The command “mkdir name” creates a directory within the current directory. ◦ Ex.) “mkdir oldmusic” creates the directory called “oldmusic” within the current directory.  The command “cd.” stays in the current directory.  The command “cd dirname” changes to a new directory within the current one. ◦ Ex.) ◦ To move back up from the “oldmusic” directory to the directory before it enter the command “cd..” (Stonebank)

 To list the current pathway in the directory tree use the command “pwd”. ◦ Ex.) ◦ To navigate to any directory in the tree enter the command: “cd ~/name(1)/name(2)/…/name(n)”  Ex.) (Stonebank)

 Once a directory is created, it can be removed by using “rmdir”, however the directory has to be empty first. ◦ Multiple directories can be removed by using spaces between each directory.  Ex.) “rmdir directory1 directory2” removes both directory 1 and 2. (Stonebank)

 Displaying content of a file in the command window can be done a few different ways. ◦ To display the entire file type: “cat filename”  For example, “cat science.txt” would display the whole science.txt document.  Kind of hard to read. ◦ To have the file display better on the command window type: “less filename”  “less science.txt” would display science.txt in a way that is easier to see in the window.  Instead of using the arrow keys or a scroll on a mouse you press the space bar and get out of the document view by pressing the Q key. (Stonebank)

◦ The “head file” command shows the first ten lines of a file and the “tail file” command shows the last ten lines of a file.  The number of lines shown for both commands can be specified by using “head –n file” or “tail –n file” where n is any number less than or equal to the number of lines in the file.  Multiple files can be seen at the same time.  Ex.) Want to display the first 16 lines of 2 separate documents “science.txt” and “zebras.txt”. Type in:  “head -16 science.txt zebras.txt”. Both documents with 16 lines in the beginning of each will be the output. ◦ All of these displaying commands only work if the files are in the same directory.  Copying files ◦ To copy a file use the “cp” command

◦ When a file is copied within the same directory, it is saved under a different file name but has the same content, and the original is still in the directory with it.  Ex.) “cp file1 file2” copies the content of file1 into a new file2. ◦ To copy a file to a new directory type:  “cp file1 directory/”  Moving files ◦ To move a file use: “mv” command. ◦ Moving a file within the same directory is another way of renaming a file. ◦ To move a file to another directory type:  “mv file1 directory/” (Stonebank)

 Removing files ◦ Use the command “rm”.  Ex.) “rm file1” removes file1 from the system.  Searching files ◦ To search a given file for any keyword type: “grep ‘keyword’ file”  Ex.) Typing “grep science science.txt” outputs all of the lines of the document which contain the word science with s in a lowercase.  “grep” can be combined with –i, -v, -n, or –c to narrow the search.  Typing “grep –i ‘keyword’ file” ignores whether keyword is uppercase or not and outputs all the lines which contain the word. (Stonebank)

 Typing “grep –v ‘keyword’ file” ignores the keyword and outputs all lines without it.  “grep –n ‘keyword’ file” gives the line number and the line with the keyword.  Finally “grep –c ‘keyword’ file” gives the total number of lines with the keyword. ◦ “grep” can be combined with some or all of the letters to narrow the search more.  Ex.) “grep –ivc science science.txt” ignores all instances of the word science with any case and produces the total number of lines in the document without the word science. (Stonebank)

 Wildcards are used with list commands to search for specific files in a directory. ◦ Wildcard “*” is used before or after a filename.  Ex.) “ls *ide” lists all of the instances of files ending with ide, and “ls ide*” lists all files beginning with ide. ◦ Wildcard “?” is used in a keyword to represent one letter out of that word.  Ex.) “ls ?one” lists all files that have 4 letters ending in “one” like bone but not drone or stone.  The command “find” is a general search of the directories. ◦ Ex.) find. -name "*.txt" –print  starts with the current directory (. ) and then moves through the lower directories to find any file than ends in.txt and lists them in the command window. (Stonebank)

 A file is made with certain access rights, which means that one can either read, write, or execute it. However, some files are programed in such a way that they can’t be tampered with.  The access rights are shown by using the command: “ls –l” ◦ The output code describing the access rights is given on the far left of the output  Ex.) The output for a file called “biglist.txt” is  -rw-rw-rw-. 1 tony tony 68 Jan 31 21:57 biglist.txt  -rw-rw-rw- is the access rights for the file, the left most space indicates whether or not it is a file, directory, or something else. The 9 spaces after that indicate access rights for the user, group, or any others that have access to the file. (Stonebank)

 The “chmod” command allows you to customize access rights for a file. ◦ Ex.) “chmod go-rwx biglist.txt” means that groups or others can’t read or write the file biglist.txt. ◦ The negative sign before rwx removed the read, write, and execute access rights for groups and others. But left the user rights unchanged. ◦ Putting a positive sign before rwx would add those rights for groups and others. (Stonebank)

 The command “ps” lists all the processes that are running either in the foreground or background. ◦ It lists things like the process identification number (PID) on the far left side and the commands on the far right hand side for each process  Ex.) (Stonebank)

 To kill a process determine the PID by entering the command “ps”, then “kill PID” ◦ Ex.)

 The command “man ‘commandname’” gives a manual for any command. It gives a couple paragraphs on what the command is and common uses. ◦ Ex.) “man cp” gives the manual for the copy command.  The command “whatis ‘command’” gives a couple uses for the command and short descriptions for each command. ◦ Ex.)

 The command “apropos ‘keyword’” can be used if you forget a command. ◦ Ex.) “apropos move” gives all commands involving the word move in a description. (Stonebank)

 Stonebank, Michael. "UNIX Tutorial for Beginners" UNIX Tutorial for Beginners, 19 Oct Web. 2 Feb  riehemann, susanne. "Basic UNIX commands." Basic UNIX commands. Computing Information for Stanford Linguists, 07 Nov Web. 3 Feb