Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang.

Slides:



Advertisements
Similar presentations
Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
Advertisements

1 Introduction to UNIX Ke Liu
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Linux+ Guide to Linux Certification, Second Edition
CS1020: Intro Workshop. Topics CS1020Intro Workshop Login to UNIX operating system 2. …………………………………… 3. …………………………………… 4. …………………………………… 5. ……………………………………
Unix Basics. Systems Programming: Unix Basics 2 Unix Basics  Unix directories  Important Unix file commands  File and Directory Access Rights through.
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.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Systems Programming Concepts
SoftwareTools CGS 3460, Lecture 7 Jan 25, 2006 Zhen Yang.
Learning basic Unix command IT 325 operating system.
Brief introduction to UNIX A. Emerson CINECA, High Performance Systems.
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.
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”
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
1 Intro to Linux - getting around HPC systems Himanshu Chhetri.
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.
Cmsc 312 Operating Systems. UNIX? DOS – PC? VAX/VMS - mainframe Unix – PC, workstation, mainframe 1970 bell Lab For computer scientist? Why popular? Free.
Linux+ Guide to Linux Certification, Second Edition
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
The UNIX development environment CS 400/600 – Data Structures.
Working with Linux Lab 1 1. Login and logout Account – username & password – Note: Linux is case-sensitive Administrator: username = root Logout: exit,
1 N305 C Programming. 2 Objectives for the Lab ä Learn problem solving strategies ä Achieve intermediate knowledge of C Programming Language ä Gain experience.
Vim Editor and Unix Command gcc compiler Computer Networks.
Carnegie Mellon Linux Boot Camp Jenna MacCarley, Peter Pearson, Shashank Goyal 9/19/2015.
Next Unix Topics Tuesday, 2/11 & 18/2014. Change Password (by 2/14/14) ssh to account on – faclinux.cse.ohio-state.edu – stdlinux.cse.ohio-state.edu passwd.
L&T Infotech1 UNIX – Getting Started - Aneesh Ramani.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
Introduction to Programming Using C An Introduction to Operating Systems.
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.
Object Oriented Programming COP3330 / CGS5409.  Assignment Submission Overview  Compiling with g++  Using Makefiles  Misc. Review.
Intro. To Unix commands For those who’ve never used Unix before Quick tutorial to let you move around your Unix Accounts No discussion of inner workings.
Basic Unix Commands & GCC Saurav Karmakar Spring 2007.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
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.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
ICE UNIX TUTORIAL. File System Commands cd – change directory cd – change directory ls – list contents ls – list contents rm – remove/delete rm – remove/delete.
Learning basic Unix command It 325 operating system.
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.
Object Oriented Programming COP3330 / CGS5409.  Assignment Submission Overview  Compiling with g++  Using Makefiles  Misc. Review.
1 N305 C Programming. 2 Objectives for the Lab ä Learn problem solving strategies ä Achieve intermediate knowledge of C Programming Language ä Gain experience.
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
ENEE150 Discussion 01 Section 0101 Adam Wang.
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
CS1010: Intro Workshop.
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.
Tutorial Six Recap & Linux Basics CompSci Semester Two 2016.
Lecture 2 Working with Files and Directories
Useful Linux Commands.
CS314 – Section 5 Recitation 1
Welcome to CSCI 230! Problem Solving using C
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Welcome to CSCI 230! Problem Solving using C
CS 60 Discussion Review.
Web Programming Essentials:
Tutorial of Unix Command & shell scriptS 5027
Lab 00 Discussion Linux Basics
Introduction Paul Flynn
Tutorial Unix Command & Makefile CIS 5027
Lab 2: Terminal Basics.
Presentation transcript:

Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang

For this class you need to work from your grove account to finish your homework Knowing basic UNIX commands is essential to finish your homework

Overview Files and Directories How to connect to GROVE Basic UNIX commands TAR Permissions UNIX editor pico Compiling C programs

Files and Directories In computers, what is the difference between a file and a directory?  A file is a program or a document  A directory contains files or other directories

Directory Structure Inside directories, you could find files and other directories Inside those “ other ” directories, you might find more files, and more directories

How do I connect to grove? telnet grove.ufl.edu

Telnet Window For login, enter the username on your grove account card For Password, enter the password on the grove account card Grove will ask you to change your password Just follow the on-screen instructions for more information

UNIX Commands mkdir [directory] – create a new directory ls – list files or directories in current directory. ls – l list in long format (including details like permissions, owner, size, etc.)

More UNIX Commands pwd – let you know the absolute pathname of your current working directory (Where your are) cd [dir] – change directory  cd.. – go back to parent directory. “.. ” is the relative pathname to the parent directory.

More UNIX Commands pico [filename] : create a new file  Text editor  ^X to quit and save the file cp  cp [file1 file2] – copy file1 to file2. If there ’ s already a file2, the old one will be overwritten.

More UNIX Commands mv [sourcefile targetfile] – basically mv renames sourcefile to targetfile. If there ’ s a file with the same name as targetfile, it will be overwritten. rm file(s) – delete file(s). rmdir directories – delete one or more empty directories.

TAR Create tape archives and add or extract files. Creating a tar file: tar -cvf file.tar myfile.txt In the above example the system would create a tar named file.tar in the directory you currently are in. tar - cvf file.tar *.txt would compress all txt files in the current directory. tar -cvf home.tar home/ In the above example command the system would create a tar file named home.tar in the directory you currently are in of the home directory.

TAR Extracting the files from a tar file: tar -xvf myfile.tar In the above example command the system would uncompress (untar) the myfile.tar file in the current directory. tar -xvzf myfile.tar.gz In the above example command the system would uncompress (untar) the myfile.tar.gz file in the current directory. Note: There is no "untar" unix command.

Permissions There are three types of file access supported by UNIX.  r – read, view the contents of a file  w – write, edit file/directory contents  x – execute, run executable file

- rwx r-x r-- 1 c3460abc cgs Jan 23 8:28 f1 type owner group sizeModification date/timeFile name User permissions Group permissions Other Permissions links

Permissions read=4;write= 2;execute=1 rwxr-x r

Permissions chmod mode file(or directory) –change the permission of the file or directory. Examples:  Change the permission of file2 to:  rwx r-x --x  chmod 751 file2.

Unix Editor pico Simple and very easy to use text editor on UNIX Open a file using pico pico filename For example: pico hello.c The above example would open the editor with the file hello.c if present. Basic pico command (^ hold ctrl key) ^W where is ^Y previous page ^V next page

Compiling C Programs gcc is the "GNU" C Compiler. It is a free compiler that is available on grove.ufl.edu. Below are several examples that show how to use gcc to compile C programs.

Compiling a simple program Consider the following example: Let "hello.c" be a file that contains the following C code. #include main() { (void) printf("Hello…\n"); return (0); } A standard way to compile this program is with the command gcc hello.c -o hello This command compiles hello.c into an executable program named "hello" that you run by typing './hello' (or possibly just 'hello') at the command line. It does nothing more than print "Hello..." on the screen.

Compiling a simple program Alternatively, the above program could be compiled using the following two commands. gcc -c hello.c gcc hello.o -o hello The end result is the same, but this two-step method first compiles hello.c into a machine code file named "hello.o" and then links hello.o with some system libraries to produce the final program "hello". In fact the first method also does this two-stage process of compiling and linking, but the stages are done transparently, and the intermediate file "hello.o" is deleted in the process.

Compiling a program with multiple source files If the source code is in several files, say "file1.c" and "file2.c", then they can be compiled into an executable program named "myprog" using the following command: gcc file1.c file2.c -o myprog The same result can be achieved using the following three commands: gcc -c file1.c gcc -c file2.c gcc file1.o file2.o -o myprog