MA 511: Computer Programming Lecture 23 Partha Sarathi Mandal

Similar documents
MA 511: Computer Programming Lecture 15: File & command line parameters. Partha Sarathi Mandal

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Student Remote Login Procedure (see picture below): 1. Start SSH Secure Shell 2. Click the computer icon (4 th on the toolbar) 3.

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

Software I: Utilities and Internals

Introduction to Linux. Roman Cheplyaka

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

Filesystem Hierarchy and Permissions

Filesystem Hierarchy and Permissions

Filesystem Hierarchy Operating systems I800 Edmund Laugasson

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Manage Directories and Files in Linux. Objectives. Understand the Filesystem Hierarchy Standard (FHS)

A Brief Introduction to Unix

File System Hierarchy Standard (FHS)

Commands are in black

Introduction Into Linux Lecture 1 Johannes Werner WS 2017

Embedded System Design

Linux Kung-Fu. James Droste UBNetDef Fall 2016

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

The landscape. File hierarchy overview. A tree structure of directories The directory tree is standardized. But varies slightly among distributions

CSC209. Software Tools and Systems Programming.

Getting Started with Linux

CSCI 2132 Software Development. Lecture 4: Files and Directories

MA 511: Computer Programming Lecture 3: Partha Sarathi Mandal

Unix Workshop Aug 2014

You will automatically be in your user (home) directory when you login.

INTRODUCTION TO LINUX

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

UNIX File Hierarchy: Structure and Commands

Introduction to Linux

Linux Systems Administration Getting Started with Linux

Chapter-3. Introduction to Unix: Fundamental Commands

GNU/Linux: An Essential Guide for Students Undertaking BLOSSOM

Introduction to Unix: Fundamental Commands

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

Introduction to Linux Part I: The Filesystem Luca Heltai

5/8/2012. Creating and Changing Directories Chapter 7

Introduction to the Linux Command Line

Introduction to Linux Command-Line for Beginners

PDS Lab Section 16 Autumn Tutorial 1. Unix Commands pwd The pwd command displays the full pathname of the current directory.

Unix System Architecture, File System, and Shell Commands

Files

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

Caja File Manager. Desktop User Guide

commandname flags arguments

Please choose the best answer. More than one answer might be true, but choose the one that is best.

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Introduction to Linux

Programming and Data Structure Laboratory (CS13002)

Outline. File Systems. File System Structure. CSCI 4061 Introduction to Operating Systems

CS 300. Data Structures

CS197U: A Hands on Introduction to Unix

Introduction to Algorithms and Programming I Lab. Exercises #1 Solution

Obtaining and Installing the Updated TSBroadcaster Scripts

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Overview of the UNIX File System

1 Installation (briefly)

Software I: Utilities and Internals. What is UNIX?

COMP s1 Lecture 1

Linux Howtos. Fedora 9 Install (114) CIS Fall Fedora 9 Install (114) Fedora 9 installation with custom partitions.

LiLo Crash Recovery. 1.0 Preparation Tips. 2.0 Quick Steps to recovery

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

Linux/Cygwin Practice Computer Architecture

Overview of the UNIX File System. Navigating and Viewing Directories

Unix Handouts. Shantanu N Kulkarni

Linux basics U3A in Bath. Linux Principles. by Andy Pepperdine

This section reviews UNIX file, directory, and system commands, and is organized as follows:

Linux Files and the File System

CISC 220 fall 2011, set 1: Linux basics

Introduction of Linux

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

EECS2301. Lab 1 Winter 2016

-1- csh cd. cd alias!! ; set prompt=" pwd % " 16 cd. 17 cd.. 18 his /home% set prompt. alias. yasuoka : root :

18-Sep CSCI 2132 Software Development Lecture 6: Links and Inodes. Faculty of Computer Science, Dalhousie University. Lecture 6 p.

Introduction: The Unix shell and C programming

Introduction to Linux Basics

CS246 Spring14 Programming Paradigm Notes on Linux

Lab Working with Linux Command Line

UNIX Concepts COMPSCI 386

LAB 8 (Aug 4/5) Unix Utilities

CSC209. Software Tools and Systems Programming.

An Introduction to Using the Command Line Interface (CLI) to Work with Files and Directories

Unix Basics. UNIX Introduction. Lecture 14

Back Up (And Restore) LVM Partitions With LVM Snapshots

PowerVM Lx86 for x86 Linux Applications Administration Guide

You should see something like this, called the prompt :

The UNIX Operating System. HORT Lecture 2 Instructor: Kranthi Varala

INF322 Operating Systems

Linux for Beginners. Jason Cannon

How to clone a Linux box using netcat

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

LAB 8 (Aug 4/5) Unix Utilities

File System. yihshih

Michael Wrzaczek Dept of Biosciences, Plant Biology Viikki Plant Science Centre (ViPS) University of Helsinki, Finland

Lecture 3: The UNIX Style

Transcription:

MA 511: Computer Programming Lecture 23 http://www.iitg.ernet.in/psm/indexing_ma511/y08/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2008-09 Mon 10:00-10:55 Tue 11:00-11:55 Fri 9:00-9:55 Class: 1G2 MA512 Lab : Wed 14:00-16:55

Macro Definition We have already seen that #define statement can be used to define symbolic constants within a C program. Ex: #define SIZE 100 int Array[SIZE]; It can be used to define macros Single identifiers that are equivalent to expressions, complete statements or groups of statements. It looks like functions in that sense. These are treated differently during the compilation process.

Example: Macro #include <stdio.h> #define area length*width main(){ int length, width; printf("length = "); scanf("%d", &length); printf("width = "); scanf("%d", &width); printf("area = %d", area);

Example: Macro #include <stdio.h> main(){ int c, i, n; printf( number of lines : ); scanf( %d, &n); printf( \n ); for(i =1; i <= n; i++){ for(c=1; c <= n-i; c++) putcar( ); for(c=1; c <=2*i-1; c++) putcar( * ); printf( \n ); #include <stdio.h> #define loop(n) for(i=1; i<= n; i++){ \ for(c=1; c<=n-i; c++) \ putchar(' '); \ for(c=1; c<=2*i-1; c++) \ putchar('*'); \ printf("\n"); \ main(){ int c, i, n; printf("number of lines : "); scanf("%d", &n); printf("\n"); loop(n) n = 6 * *** ***** ******* ********* ***********

File system A file system is a method for storing and organizing computer files. Make it easy to find and access them. Systems may use a data storage device such as a hard disk or CD-ROM.

Understanding the Root File System

Understanding the Root File System bin boot etc initrd.img lost+found opt sbin tmp vmlinuz bkp1 cdrom home lib media proc srv usr bkp2 dev initrd lib64 mnt root sys var devendra.s g.barun k.jatin ranjan.r sandeep.s srikumar diksha husney k.saloni reena.k s.devendra tapash : : jeebkp msc2007 rs btech2006 kalpesh msc2008 santanu btech2007 lost+found psm./ file.c file1.c a.out file2.c output.dat code : :

GNU/Linux Command-Line Tools Execute the command ls -l To view the information on the system password database $ ls -l /etc/passwd The output should look similar to this: $ -rw-r--r-- 1 root sys 41002 Apr 17 12:05 /etc/passwd The first 10 characters describe the access permissions. The first dash indicates the type of file (d for directory, s for special file, - for a regular file). The next three characters ("rw-") describe the permissions of the owner of the file: read and write, but no execute. The next three characters ("r--") describe the permissions for those in the same group as the owner: read, no write, no execute. The next three characters describe the permissions for all others: read, no write, no execute.

Frequent used Unix Commends mandal@mandal-pc ~ $ pwd /home/mandal mandal@mandal-pc ~ $ ls code mandal@mandal-pc ~ $ ls -al total 36 drwxrwxrwx+ 4 mandal None 4096 Sep 11 01:12. drwxrwxrwx+ 3 mandal None 0 Jun 23 16:56.. -rw------- 1 mandal None 2157 Nov 12 20:41.bash_history -rwxr-xr-x 1 mandal None 1150 Jun 23 10:30.bash_profile -rwxr-xr-x 1 mandal None 3116 Jun 23 10:30.bashrc -rwxr-xr-x 1 mandal None 1461 Jun 23 10:30.inputrc drwx------+ 2 mandal None 0 Jul 1 16:07.ssh drwxrwxrwx+ 3 mandal None 16384 Nov 14 14:20 code mandal@mandal-pc ~ $ cd code mandal@mandal-pc ~/code $ pwd /home/mandal/code mandal@mandal-pc ~/code $pwd Show path to current directory $ls Show list of files and folder in the current directory $ls l Show specification of all files and folders with permission. $cd folder Change directory $cd.. Return to previous directory $ mkdir newfolder Create a folder $ rm filename Delete file $ cp file1 file2 Copy file1 to file2 $cp file1 folder\ Copy file1 to the folder