Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

RH030 Linux Computing Essentials
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.
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
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
UNIX By Darcy Tatlock. 1. Successful Log Into Unix To actively manipulate your website you need to be logged in. Without being logged in you cannot enter.
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.
Learning basic Unix command IT 325 operating system.
Notes Assignment #1 is due next Friday by 11:59 pm via Test #1 will be held Thursday February 18 at the start of class (one period long) Format:
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.
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.
Unix Command Project Justin Rogers for LS 560 Spring 2015.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
Agenda Chapter 1: Linux (Unix) Features Commands (Chapters 2 & 3) Command Structure / Command line editing man, passwd, cal, date, whereis, which Working.
Linux+ Guide to Linux Certification, Second Edition
Chapter Two Exploring the UNIX File System and File Security.
UNIX/LINUX Shells Shell is an UNIX/LINUX command interpreter. Shell command can be internal or external. The code to execute an internal command is part.
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.
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.
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.
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:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
The Genome Analysis Centre Building Excellence in Genomics and Computational Bioscience.
Λειτουργικά Συστήματα – 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,
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.
Agenda The Linux File System (chapter 4 in text)
BIF713 File and Directory Management. File System A File System is a structure used to organize programs and data on a computer ’ s storage device Files.
Agenda The Bourne Shell – Part II Special Characters Ambiguous File Reference Variable Names and Values User Created Variables Read-only Variables (Positional.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
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.
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.
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.
Agenda The Linux File System (chapter 4 in text) Directory Structures / Navigation Terminology File Naming Rules Relative vs Absolute pathnames Unix Commands:
CMSC 104, Version 9/011 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
ULI101 Week 02. Week Overview ● Unix file system ● Types of files ● File naming rules ● Hidden files ● Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm.
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
Agenda The Linux File System (chapter 4 in text)
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.
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
Andy Wang Object Oriented Programming in C++ COP 3330
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:
Exploring the UNIX File System and File Security
Operating Systems and Using Linux
Operating Systems and Using Linux
Andy Wang Object Oriented Programming in C++ COP 3330
CSE 303 Concepts and Tools for Software Development
Module 6 Working with Files and Directories
Presentation transcript:

Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less ls, cp, mv, rm, cd, mkdir, rmdir Filename Expansion (*, ?, [] )

Textbook Coverage These slides are based on Chapter 3 of “A Practical Guide to Linux” Read pages 41 to 57

Miscellaneous Commands whereis which whoami finger passwd date cal

whereis / which whereis is a utility that lists all directory paths that contain binary files for a command and directory paths for manuals for a command. For Example: whereis mv which is a utility that lists only one directory path of the command that the shell will run when the user issues the command from the shell prompt. For Example: which cp

whoami / finger whoami is a utility that displays the name of the user currently logged onto the server. finger is a utility that displays information regarding another user on the current server. You can edit the.project file to have messages / art displayed when the finger command is used for your account!

passwd A user can change their account password by issuing passwd command at shell prompt. The user will be prompted for their current password and then be prompted for new password and confirmation. Options: -f changes the user information that is stored in the /etc/passwd file along with user's password

date The date command is used to display the current date and time. Example: date Note: If you have superuser or "root" access, you can change the computer system's date and time.

cal The cal command without options displays only the current month. The cal command with year as an argument displays the entire year's calendar. The cal command with arguments month followed by year displays the specific month for specific year. Examples: cal 2002 (displays all months for year 2002) cal (displays only month of September 1947)

Working with Files cat, more, less ls, cp, mv, rm, cd, mkdir, rmdir

cat The cat command is used to combine the contents of multiple files ( “ catenate ” means to join together). This command can be used to display contents of small files (that will fit on your terminal's display screen). Example: cat hello.c (displays contents of c program "hello.c")

more The more command displays a file, one screenful at a time. Example: more large_file Movement keys (within more command):  Move to next screen b Move to previous screen Move to next line /car Search for pattern "car" q Exit to shell

less The less command is similar to more command, but "less" command contains more movement and search commands than "more" command. Example less large_file Note: You are not required to learn "less" command for this course, but if you are interested in using this command, you can refer to online manual.

ls The ls command is used to display information regarding a file or directory. Example: ls (Displays a compact listing (i.e. filenames only) contained in current directory) Options: -a short display of all files (incl. hidden files) -l detailed display of files (excl. hidden files) -al detailed display of all files -F displays / after directory, * after executable file

Making Directories What are Directories? Directories are “storage locations” that are used to store regular files in an efficient manner. You will need to learn how to navigate throughout existing directories to access files. You will also be required in the future to build directories to copy, move and remove directories!

Where do we want to build directory? We want to build a directory called tmp that branches-off of your home directory Verify which directory you are located (either look at directory from command prompt or issue the command pwd ) Type mkdir tmp at the Unix prompt, followed by ENTER Always verify that directory has been created (e.g. use ls or ls -ld command, or change to that directory and issue pwd)

Removing Directories Removing directories is reverse order of building directories Issue command rmdir directory rmdir cannot remove directories containing files or other subdirectories. rmdir cannot remove directories that are anyone's current directory. Need to step back to at least parent directory to remove an empty directory.

Removing Sub-trees To remove a sub-tree (a directory and all of its contents including sub-directories) use rm -r directory (or rm -R directory). The command rm –rf removes both subdirectories and files contained in a directory-path. Caution! Back-up your files before removing. You can use the ftp application to transfer files to another server or your diskette. Refer to next set of notes to learn how to use command-line ftp. Caution! rm -r can erase large numbers of files very quickly. Use with extreme care!

cp The cp command is used to copy one or more files between directories, or to make backup copies of files within the same directory. Example: cp /public/ipc144/hw.c /home/msaul/ (copies file "hw.c" from “/public/ipc144" directory to msaul's home directory) Options: -R subdirectories & contents are copied -i prompts user to overwrite existing file

mv The mv command is used to move or rename files. Examples: mv hw.c work (moves file "hw.c" from current directory to subdirectory called "work”, assuming directory “work” exists) mv hw.c hello.c (renames file "hw.c" in current directory to "hello.c”) Options: -i prompts user to overwrite existing file

Ambiguous File References (Wildcard Searches) You may need to access or process a file, but forget what is the exact spelling (syntax) of the filename. You may also want to run a command that accesses many files that share a similar characteristic (eg all files with extension "txt"). Files that match a pattern (as opposed to being referenced by exact filenames) are called ambiguous file references

The * character This wildcard character is used to represent any characters. It is useful when searching for file names sharing common characteristics. For Example : ls file*(list all files beginning with "file") ls - a.* (list all hidden files)

The ? character The wildcard character ? will match any single character. ls file? (list all files with only 1 character after "file") ls file?? (list all files with only 2 characters after "file") ls ??45? (list all files containing 5 characters that contain a 4 in 3 rd position and a 5 in the 4 th position)

Character Class [ ] Used to match a particular group or "class" of a single character. Similar to using "?" but the user can determine what "?" is allowed or not allowed to represent. Examples: ls file[abc].txt displays filea.txt, fileb.txt, filec.txt ls file[1-9].txt displays a range file1.txt to file9.txt cat file[!abd].doc displays all files matching file?.doc other than filea.doc, fileb.doc or filed.doc

Globbing Ambiguous filenames are "expanded" to multiple arguments by the shell (called "globbing"). This can cause strange effects with commands that do not expect a file argument or expect only one file argument. e.g., echo *