Introduction to Linux Mukesh Pund Scientist, NISCAIR, New Delhi, India.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

Introduction to UNIX CSE 2031 Fall May 2015.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Exploring the UNIX File System and File Security
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.
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
Linux+ Guide to Linux Certification, Second Edition
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
LINUX COMMAND LINE INTERFACE Lab 3 EECS 448 Dr Fengjun Li and Meenakshi Mishra.
Linux Commands LINUX COMMANDS.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
1. This presentation covers :  User Interface Administration  Files System and Services Management 2.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
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”
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 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.
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Introduction to Linux Azzam Mourad COEN 346.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Chapter Two Exploring the UNIX File System and File Security.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
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.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Introduction to Programming Using C An Introduction to Operating Systems.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
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.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Tony Kombol.  man  on-line user manual  man command_you_want_info_on  type q to exit  examples:  for ls (list directory) ▪ man ls  for cp (copy)
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
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.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
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.
Learning Unix/Linux Based on slides from: Eric Bishop.
LINUX Zhengli Zhu, School of Life Sciences. Outline 1. ABC of Linux 2. Basic orers of Linux 3. Bash Programming.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
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
NISCAIR, New Delhi, India
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
The Linux Operating System
CSE 374 Programming Concepts & Tools
Basic UNIX OLC Training.
Unix : Introduction and Commands
Andy Wang Object Oriented Programming in C++ COP 3330
Working with Mac OS and Linux
CSE 303 Concepts and Tools for Software Development
Linux Commands LINUX COMMANDS.
January 26th, 2004 Class Meeting 2
Presentation transcript:

Introduction to Linux Mukesh Pund Scientist, NISCAIR, New Delhi, India

2 History In 1969, a team of developers developed a new operating system called “Unix” which was written using C Linus Torvalds, a young man studying computer science at the university of Helsinki developed academic version of Unix which is named as Linux. Linux is a full UNIX clone.

3 Linux a powerful OS! Today Linux has joined the desktop market. On the server side, Linux is well-known as a stable and reliable platform. Linux provides many applications like: Databases (MySQL,Postgresql), Network services(Web Servers,DNS, Proxy, firewall etc) Software development tools(C, Java, Python,Perl etc.) Office automation tools And many more…

4 Is Linux difficult? There is excellent and free Internet support and documentation available. The graphical user interface (GUI) is similar in design to that on any other system A very powerful command line alternative is also available. Linux is user friendly.

5 Properties of Linux It is Open Source Today, Linux is ready to accept the challenge of a fast-changing world. Linux is free: If you want to spend absolutely nothing, you don't even have to pay the price of a CD. Linux can be downloaded in its entirety from the Internet completely for free.

6 Properties of Linux Linux is portable to any hardware platform. Linux was made to keep on running. As with UNIX, a Linux system expects to run without rebooting all the time. Tasks can be scheduled to run at suitable times.

7 Properties of Linux Linux is secure and versatile. The security model used in Linux is based on the UNIX idea of security which is robust. It is less prone to virus attacks. Linux is scalable

8 Let’s have an overview of frequently used commands in Linux. Note: Some commands can only be executed by super user (example adduser, shutdown etc). Commands..

9 Creating a new user Use the useradd command useradd Use the passwd command to set password passwd Try it… logon as rootroot useradd sdc1 passwd sdc1 Changing password for user sdc1 New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully

10 What is a Shell? Is a program that takes your commands from the keyboard and gives them to the operating system to perform An interface between the Linux system and the user Used to call commands and programs Many available (bsh; csh; bash; etc.)bash

11 You need help? Add more In Linux help can be accessed by command man (manual) man Use man to display help for that command

12 Linux File System Basics Linux files are stored in a single rooted, hierarchical file system Data files are stored in directories (folders) Directories may be nested as deep as needed Directories User home directories Data files root

13 Some Special File Names Some file names are special: / The root directory (not to be confused with the root user). The current directory.. The parent (previous) directory ~ My home directory

14 Special Files /: The root directory where the file system begins. /boot: This is where the Linux kernel is kept. /etc: The /etc directory contains the configuration files for the system. /bin, /usr/bin: These two directories contain most of the programs for the system. The /bin directory has the essential programs that the system requires to operate, while /usr/bin contains applications for the system's users.

15 Special Files /sbin, /usr/sbin: The sbin directories contain programs for system administration, mostly for use by the superuser. /usr: The /usr directory contains a variety of things that support user applications /lib: The shared libraries (similar to DLLs in that other operating system) are kept here. /home: /home is where users keep their personal work. /root: This is the superuser's home directory.

16 Linux Command Basics To execute a command, type its name and arguments at the command line ls -l /etc Command name Options (flags) Arguments

17 Command Options Command options allow you to control a command to a certain degree Conventions: Usually being with a single dash and are a single letter (“ -l ”) Sometimes have double dashes followed by a keyword (“ --help ”)

18 Navigation and Looking Around pwd - print (display) the working directory cd - change the current working directory to dir ls - list the files in the current working directory ls -l - list the files in the current working directory in long format cd..

19 File and Directory Manipulation cp Copy from the to the mv Move/rename the to the rm Remove the file named mkdir Make a new directory called rmdir Remove an (empty) directory cat > Create file

20 Data display from files cat Displays contents of the head -n Displays n lines from top of the tail –n Displays n lines from bottom of

21 Standard Files UNIX concept of “standard files” standard input (where a command gets its input) - default is the terminal standard output (where a command writes it output) - default is the terminal standard error (where a command writes error messages) - default is the terminal

22 Redirecting Output The output of a command may be sent (piped) to a file: lsls -l >output “>” is used to specify the output file ls >>output “>>” is used to append to output

23 Redirecting Input The input of a command may come (be piped) from a file: wcwc <input “<” is used to specify the input file

24 Connecting commands with Pipes The output of one command can become the input of another: psps -aef| grep postgres | wc -lgrepwc The output of the ps command is sent to grep grep takes input and searches for “postgres” passing these lines to wc wc takes this input and counts the lines its output going to the console “|” is used to separate stages

25 More Commands who List who is currently logged on to the system who am iho am i Report what user you are logged on as ps List your processes on the systemprocesses ps -aef ps List all the processes on the system echo “A string to be echoed” echo Echo a string (or list of arguments) to the terminal

26 More Commands grep - Searches files for one or more pattern arguments. It does plain string, basic regular expression, and extended regular expression searching grep Example: ls –l |grep “mukesh” ls command display the listing of files in current directory. And grep command searches for “mukesh” file in that listing.

27 More Commands kill - sends a signal to a process or process group killprocessprocess group You can only kill your own processes unless you are root Example: log]# ps –aef Above command will display result like: log]# UID PID PPID C STIME TTY TIME CMD root :34 ttyp0 00:00:00 sleep 10h root :34 ttyp0 00:00:00 ps -ef And one can kill the process by following command: log]# kill 6715 [1]+ Terminated sleep 10h

28 More Commands tar - manipulates archives tar An archive is a single file that contains the complete contents of a set of other files; an archive preserves the directory hierarchy that contained the original files. tar -zxvf imap-4.7.tar.gz imap-4.7/ imap-4.7/src/ imap-4.7/src/c-client/ imap-4.7/src/c-client/env.h imap-4.7/src/c-client/fs.h

29 Switching Users su switch user accounts. You will be prompted for a password. When this command completes, you will be logged into the new account. Type exit to return to the previous account su Switch to the root user account. Do not do this lightly Note: The root user does not need to enter a password when switching users. It may become any user desired. This is part of the power of the root account.

30 PATH Environment Variable Controls where commands are found PATH is a list of directory pathnames separated by colons. For example:  PATH=/bin:/usr/bin:/usr/X11R6/bin:/u sr/local/bin:/home/scully/bin If a command does not contain a slash, the shell tries finding the command in each directory in PATH. The first match is the command that will run

31 File and Directory Permissions Every file or directory Is owned by someone Belongs to a group Has certain access permissions for owner, group, and others Default permissions determined by umask umask

32 File and Directory Permissions The long version of a listing ( ls -l ) will display the file permissions: -rwxrwxr-x 1 rvdheij rvdheij 5224 Dec 30 03:22 hello -rw-rw-r-- 1 rvdheij rvdheij 221 Dec 30 03:59 hello.c -rw-rw-r-- 1 rvdheij rvdheij 1514 Dec 30 03:59 hello.s drwxrwxr-x 7 rvdheij rvdheij 1024 Dec 31 14:52 posixuft Permissions Owner Group

33 Interpreting Permissions -rwxrwxrwx Other permissions Group permissions Owner permissions Directory flag (d=directory; l=link)

34 Changing Permissions Use the chmod command to change file or directory permissions chmod rwx rwx rwx = = 777 rw- rw- rw- = = 666 rwx = = 700 chmod 755 file # Owner=rwx Group=r-x Other=r-x chmod 500 file2 # Owner=r-x Group=--- Other=--- chmod 644 file3 # Owner=rw- Group=r-- Other=r-- chmod +x file # Add execute permission to file for all chmod o-r file # Remove read permission for others chmod a+w file # Add write permission for everyone

35 Changing ownership chown - change file ownership chown chown name some_file chgrp - change a file's group ownership chgrp chgrp new_group some_file

36 Processes As with any multitasking operating system, Linux executes multiple, simultaneous processes. Processes are created in a hierarchical structure whose depth is limited only by the virtual memory available to the virtual machine A process may control the execution of any of its descendants by suspending or resuming it, altering its relative priority, or even terminating it Termination of a process by default causes termination of all its descendants; termination of the root process causes termination of the session Linux assigns a process ID (PID) to the process

37 Processes Foreground When a command is executed from the prompt and runs to completion at which time the prompt returns is said to run in the foreground Background When a command is executed from the prompt with the token “ & ” at the end of the command line, the prompt immediately returns while the command continues is said to run in the background

38 Process Control Commands ps - list the processes running on the system ps kill - send a signal to one or more processes (usually to "kill" a process) kill

39 Process Control Commands $ ps PID TTY TIME CMD 1280 pts/5 00:00:00 bash 1293 pts/5 00:00:00 xload 1294 pts/5 00:00:00 ps $ kill [2]+ Terminated xload

40 Processes log]# sleep 10h & [1] 6718 log]# ps UID PID PPID C STIME TTY TIME CMD root :49 ttyp0 00:00:00 sleep 10h & causes process to be run in “background” Job Number Process ID (ID) Parent Process ID

41 Editors Several choices available: vi Standard UNIX editor vi xedit X windows text editor xedit emacs Extensible, Customizable Self- Documenting Display Editor emacs pico Simple display-oriented text editor pico

42