Using UNIX Basic Commands CS465. The Virtual Terminal You log on to Unix via a virtual terminal. –via telnet or secure shell (ssh) Your terminal session.

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

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.
Chapter One The Essence of UNIX.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
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.
Introduction to UNIX CS208.
UNIX Utilities Software Tools. Slide 2 Getting Started on UNIX The machines in CS Lab2 are named csl2wk01 through csl2wk41. csl2wk01 means “CSLab2, workstation#1”
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
UNIX Utilities Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn Input/Output.
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.
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.
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.
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
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.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
Cmsc 312 Operating Systems. UNIX? DOS – PC? VAX/VMS - mainframe Unix – PC, workstation, mainframe 1970 bell Lab For computer scientist? Why popular? Free.
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
Agenda Chapter 1: Linux (Unix) Features Commands (Chapters 2 & 3) Command Structure / Command line editing man, passwd, cal, date, whereis, which Working.
Chapter 2: Getting Started Logon to Logout. In this chapter … Logging on The Shell Superuser Getting Help Logging off.
Linux overview. Architecture Kernel File system Shell: Korn, Bourne, C, Bash X Windows: Motif, Open Look, X.OrgX.Org Desktop: Gnome, KDE,etc.
CS240 Computer Science II Introduction the Unix File System and File Related Utilities Based on “UNIX for Programmers and Users” by G.Class and K. Ables.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Natawut NupairojAssembly Language1 Unix Survival Guide.
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 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #4  Unix software architecture  Correcting mistakes  System setups  Useful commands for the beginner.
Introduction to Unix (CA263) Getting Started By Tariq Ibn Aziz.
De Anza College Instructor: Clare Nguyen
Chapter 0 A “Quick-Start” into the UNIX Operating System.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Λειτουργικά Συστήματα - Lab1 Γιάννης Πετράκης. The Operating System  Unix is a layered operating system  The innermost layer is the hardware that provides.
Introduction to Programming Using C An Introduction to Operating Systems.
Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New.
Λειτουργικά Συστήματα – 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,
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
1 Day 2 Logging in, Passwords, Man, talk, write. 2 Logging in Unix is a multi user system –Many people can be using it at the same time. –Connections.
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.
 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.
June 1, 1999UNIX - Basic Environment1 Introduction to UNIX A. Basic Environment.
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.
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Lecture 2 Working with Files and Directories
Some Linux Commands.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
Using Linux Commands Lab 3.
Web Programming Essentials:
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Presentation transcript:

Using UNIX Basic Commands CS465

The Virtual Terminal You log on to Unix via a virtual terminal. –via telnet or secure shell (ssh) Your terminal session is mediated by: –system-wide scripts –your shell and shell scripts –your kernel –your terminal emulation

Regis Unix Servers The Regis Unix server is: acadunix.regis.edu You can access acadunix with telnet from other computers via the Internet: telnet acadunix.regis.edu You can also use a secure shell ssh program to access acadunix

Logging in/out Log in –Connect to the UNIX system using telnet or ssh –At the log in prompt, type your userid (case sensitive) and press ENTER key. –At the password prompt, type your password (case sensitive) and press ENTER key.

The System Login File System login file is run for every user when they log in Exact location/name depends on your shell –Korn system login usually /etc/profile Maintained by the system administrator

Your Personal Login File Name depends on the shell.profile Bourne/Korn shells.login C shell Runs every time you log in Can use it to set up your environment to your own particular requirements

Your Home Directory. Current working directory.. Parent directory.login login script file (csh).profile login script file (sh/ksh).logout logout script file.plan finger resource file

The Unix Prompt After you log in, and the startup files have been run, the shell will display a prompt $ Different shells and different systems have different prompts. –Two common prompts are $ and #. –Your prompt can be changed. A prompt (plus a cursor) tells you that the system is ready for your commands.

Changing Passwords When? –First time you log on –Frequently (4~6 months) How? $ passwd –old passwd is required What password to choose? –At least 8 character long –Mixed lower/upper case alphabetical, numbers, and special characters –Avoid dictionary words, names and dates

Terminal Emulation Terminal emulation is negotiated between your client machine and the Unix server. Your virtual terminal ID (e.g. pts/0 ) and type (e.g. vt100) are negotiated when you first connect and login.

Terminal Emulation who am i - identifies your terminal ID. $ who am i small000 pts/0 Aug 25 15:31 (xlate.regis.edu) $ echo $TERM - identifies your login terminal type. $ echo $TERM vt100 $

Special Control Keys c interrupt (stop program/command) d halt or EOF g bell h backspace l redraw screen u kill (erase) line w kill word z suspend s stop the screen from scrolling q continue scrolling

The stty Command stty - set terminal type options stty -a - list all terminal settings stty erase ^h –Erase key is now h (backspace) So the the Backspace key now works, but the Delete key no longer works.

Standard Command Format Format: command [options] stuff in brackets is optional boldface words are literals (must be typed as is) <> enclosed words are args (replace appropriately) Commands are case sensitive (mostly lowercase) Spaces must be inserted between commands, options, arguments

Standard Command Format Options (also called flags) modify how the command works (command behavior) –single letters prefixed with a dash “-” –combined or separated (e.g., -al = -a -l ) –come before arguments Arguments define the command scope –Optional for some commands, mandatory for others –Some commands assume a default argument, if none is supplied –Usually files or directories

Basic Commands date - Prints the date and time $ date Mon Aug 25 15:32:35 MDT 2008 $ echo - Displays command line input to screen $ echo Hi, I am Pam, your instructor! Hi, I am Pam, your instructor! $

Commands to Manipulate Files ls lists files in a directory (names, not the contents of files) cat, head, tail, page, more display files rm removes files (and directories) cp copies files (and directories) mv moves (renames) files (and directories)

Displaying Filenames The ls command is used to list files in your directories. Syntax: ls [options] pathname If a pathname is not given, the files in the current working directory are listed. $ ls file1list mystuff file2mailbox yoggle $

Listing Files in a Directory The ls command has several options: -a list all files including the dot files -l long format (show file type, permissions, #links, owner, etc) -R recursive list subdirectories -F list directories with file type (trailing /

Displaying Hidden Files Files that have names beginning with a period (.) are hidden so they do not show up when you use the ls command. You must use the ls –a command to list all files in a directory, including hidden files. $ ls –a..plan contacts house something...profile cprogs mydays subdir $ The hidden file listed above are:....plan.profile

Displaying File Types ls -F displays the file type along with each file name /=directory file *=executable link If no symbol follows the filename, the file is a regular file. $ ls –F contacts house something cprogs/ mydays* subdir/ $ Files cprogs and subdir are directory files, and the file mydays is executable.

Displaying a Long Listing 1 drwxr-xr-x 180 root admin 512 Oct 1../ 2 -rw-r--r-- 1 smith fac 1314 Oct 3 file BLOCK SIZE PERMISSIONS FILE TYPE # DIRECTORIES OWNER GROUP FILE SIZE MODIFY DATE FILE NAME ls -l displays detailed information about a directory.

Displaying Directory Details ls -ld displays detailed information about a directory without listing information about each file. $ ls –ld drwxr-xr-x 6 small000 faculty 4096 Mar 8 11:01. $ ls -ld /bin drwxr-xr-x 2 root root 4096 Feb 3 20:42 /bin $

Displaying Files in Subdirectories ls -R recursively displays the contents of a directory and all of its subdirectories. $ ls –R.: cprogs contacts shoes dfawk mydays subdir./cprogs: palindrome.c reverse.c. /subdir: testfile $

Getting Help Check the manual pages! –For shell command, system programs, and library functions. Format: man man –k Man(ual) page format Name Synopsis Description (options, defaults, detail desc., examples) Files See Also Bugs

man Examples $ man man Displays help on the man command $ man who Displays help on the who command $ man -k mail Checks all man pages for keyword “mail”

man Output Example $ man ls Reformatting page. Wait... done User Commands ls(1) NAME ls - list contents of directory SYNOPSIS /usr/bin/ls [ -aAbcCdfFgilLmnopqrRstux1 ] [ file... ] /usr/xpg4/bin/ls [ -aAbcCdfFgilLmnopqrRstux1 ] [ file... ] --More--(11%) spacebar - moves forward one page b – moves back one page h – displays more commands q – quits

Viewing Files cat concatonate and print to screen (ctrl-s and ctrl-q to stop/start) head display first x lines of file tail display last x lines of file (both default to 10 lines) page page file to the screen more display part of file to screen

Example: cat, head, tail $ cat letter Mr. Jones, It is getting late. Please order some pizza and stop by my office. We’ll tidy up a few more things before calling it a night. Thanks! Ben $ head –2 letter Mr. Jones, It is getting late. Please order some pizza and stop $ tail –1 letter Ben

Copying Files Format: cp [-ir…] file1 file2 cp [-ir…] file-list directory cp [-ir…] directory directory –i for interactive. Prompt whenever a file will be overwritten. –r for recursive. Copy a whole directory tree.

cp Examples $ ls letter1secret $ cp letter1 letter2 $ ls -F letter1letter2secret/ $ cp letter1 letter2 secret $ ls secret letter1letter2

Moving /Renaming Files Format: mv [-i…] file1 file2 - Renames file1 to file2 mv [-i…] file-list directory - Moves files from current location to new directory mv [-i…] directory directory - Renames a directory

mv Examples $ ls lettermemosaved $ mv memo memo1 $ ls -F lettermemo1saved/ $ mv saved trash $ ls -F lettermemo1trash/

Deleting Files Format: rm file-list - Deletes files rm -r directory - Deletes directory and all files and directories within it - Use with CAUTION!

rm Examples $ ls -F letter1letter2secret/ $ rm letter1 $ ls -F letter2secret/ $ ls –F secret memomorestuff/ $ rm –r secret $ ls letter2

Finding User Information who Who is logged on, when & where $ who denni221 pts/1 Aug 25 14:39 ( ) small000 pts/0 Aug 25 15:31 (xlate.regis.edu) finger A bit more login information $ finger Login Name Tty Idle Login Time Office Office Phone small000 Faculty - Pamela Small pts/0 Aug 25 15:31 (xlate.regis.edu)

Finding User Information $ finger small000 Login: small000 Name: Faculty - Pamela Smallwood Directory: /home/small000 Shell: /usr/bin/ksh Office: Regis On since Mon Aug 25 15:31 (MDT) on pts/0 from xlate.regis.edu No mail. Plan: An education is not a thing one gets, but a lifelong process.

Communicating with others write- one way messaging $ write user talk- interactive messaging $ talk user programs mail - simple and old program mailx - newer, improved

write Example write Send one way message to another user $ whoami smith321 $ write jones456 Bill, you’ve been idle for a long time! What are you doing? [hit CTRL-D to end write message] $ $ whoami jones456 Message from smith321 [Fri Mar 29 20:18:47] Bill, you’ve been idle for a long time! What are you doing? $

talk Example (screen 1) talk Instant messaging for UNIX $ whoami smith321 $ talk jones456 [Waiting for your party to respond] [Connection established] Hi Bill, what’s up? Hi! I’m a little busy right now. Is it okay if I call you back latter?

talk Example (screen 2) $ whoami jones456 $ Message from Talk_Daemon at 20:41... talk: connection requested by smith321 talk: respond with: talk smith321 $ talk smith321 [Waiting for your party to respond] [Connection established] Hi! I’m a little busy right now. Is it okay if I call you back latter? Hi Bill, what’s up?

Turning off talk & write mesg - turns on (y) or off (n) the ability to receive write/talk messages Syntax: $ mesg n $ mesg y

Unix Entering mail to read your mail: $ mail or $ mailx If you have any mail in your system mail box, an indexed list of the messages will be displayed on your screen. –To read the current message, just press the Return key

Leaving Unix To exit from Unix and/or your current shell, type exit or -d at the prompt. Make sure you always log completely out. Leaving yourself logged in is a serious security hole.

Questions Advantages/Disadvantages of a command line system (vs. a GUI)? Concerns?