
INTRODUCTION TO LINUX Oliver Standford STOR-i, Lancaster University Introduction to Linux | Oliver Standford Virtual Box • Virtual Box - virtualisation software package by Oracle. • Virtualisation is when we use software to create a virtual version of hardware (computer) - HDD, RAM, CPU • Installed on an existing host operating system: • Allows additional guest operating systems to run on top of the host operating system. • Compatible guest OS - Windows, Linux, Solaris, BSD, Mac. • Other Virtualisation software - Hyper-V(Microsoft), VMware, Parallels (Mac). Introduction to Linux | Oliver Standford Virtual Media & Networking • Virtual Hard drives: • VDI - virtual disk image • VMDK - Vmware disk image • VHD - Microsoft disk image • CD/DVDs: • Host Drive • ISO Image file • Empty • Networking: • NAT - takes on the hosts IP address etc. • Bridged - gets its own IP, name etc on the network. • Internal • Host • USB Devices • Shared Folders Introduction to Linux | Oliver Standford Operating a virtual Machine • Create • Start • Pause/Resume • Shutdown Signal • Power off • Snapshots Introduction to Linux | Oliver Standford Ubuntu Exercise • Change your password – open a terminal and use the ‘passwd’ command. • Change the desktop background. • Open Firefox and browse to lancs.ac.uk • Try to install software from the software centre • View a calendar for 2017 in the terminal by typing ‘cal 2017’ • Open the following file: /etc/apt/sources.list using nano Introduction to Linux | Oliver Standford Unix • Unix was developed at AT&T Bell Labs in the 1970s. • Not designed as a commercial Operating System but as a toolset for programmer’s. • Source code was given out for a nominal fee. • The growth and success of Unix was a result of thousands of programmers contributing to the project. • One of the last popular operating systems that do not force you to work behind a Graphical Interface. Introduction to Linux | Oliver Standford Unix Features • Multitasking - processing more than one job at a time. • Multi-User - supporting more than one user at a time. • Networking - inter-machine communication and sharing. • X-windows - a server oriented graphics system and interface. Introduction to Linux | Oliver Standford Linux • An open source version of Unix. • Started from Linus Torvalds in 1991 • Uses tools developed by the Free Software Foundation. • One of the most prominent examples of free software and open source development. • Source code can be modified, used and redistributed. • Available on a variety of platforms - Intel, Alpha, Mac. Introduction to Linux | Oliver Standford Operating Systems • We can think of an operating system as consisting of four components: • Kernel • Utilities • Libraries • File System Introduction to Linux | Oliver Standford Kernel • The core of the operating system. • Manages devices, memory, user and system processes. • Schedules the use of system resources - RAM,CPU,HDD. • Stores information about arrangement of computer system and network. Introduction to Linux | Oliver Standford Shell • The shell is a utility that provides an interface between the user and the operating system. • Shells act as command interpreters of user input. Introduction to Linux | Oliver Standford Filesystem /bin - All executable Binaries /boot - boot loader / Root /etc - Configuration files Directory /home - Contains the home directories /tmp - A place for temporary files. Introduction to Linux | Oliver Standford File Attributes & Permissions Permissions R - Read W - Write X - Execute - - No Permission User Group Others Modified Group Date. -rwxr-xr-x 20 oliver stori 4096 2012-09-22 sum.c Type Owner - - file File Size d - Directory (bytes) l - Link No. of links Filename Introduction to Linux | Oliver Standford User Accounts • A user account consists of three things: • Username - a username associated with a unique identifier (User ID: UID). • Password - your personal key to the account. • Home Directory - disc space allocated to you on the system. Typically /home/username. Introduction to Linux | Oliver Standford Command Syntax • Most UNIX commands can be given options and arguments. • Unix commands are often described with a notation like: command [-options] <arguments> • Square brackets refer to options (none of which are required). • Arguments are given in <>. Introduction to Linux | Oliver Standford Basic Commands • ls - list files. • cp - copy files. • mv - move files. • rm - remove (delete) files. • cd - Change directory. • mkdir - Make (create) directory. • rmdir - Remove (delete) directory. • ln - create a link to file. Introduction to Linux | Oliver Standford ls - Listing files • Used to list files and their attributes in a directory. • To list files in the current directory (relative): • ls • ls ./scripts • To list files in another directory (absolute): • ls /home/oliver/mydirectory. • Useful list options: • -l - reveals much more information about files. • -a - lists all files, including hidden files. • -c - list files in columns • -h - print sizes in human readable format. Introduction to Linux | Oliver Standford cp, mv, rm - Copy, Move, Remove • cp <file1> <file2> Create a copy of file1, called file2. • -r - recursive copying of subdirectories. • -i - interactive, prompt before overwrite. • -u - update, copy only when source file is newer than destination. • mv <file1> <file2> Move/rename file1 to file file2. • rm <file1> <file2> Delete file1 file2. • -i - interactive prompting • -r - recursive subdirectories. • Beware, rm is potentially dangerous. A deleted file cannot be recovered. Introduction to Linux | Oliver Standford cd, mkdir, rmdir - Change, make, remove directories. • cd <directory> - Change directory. Move from current directory to another. • cd .. - goes up a level. • Argument can be relative or absolute. • mkdir <directory> - Create a new directory called directory. • rmdir <directory> - Delete a directory. • This will only work on an empty directory. • Use -r option to delete contents too. Introduction to Linux | Oliver Standford Command Line tips • pwd - present working directory - shows what directory you are currently in. • . - current directory. • tab key - auto completes a file name. • Up arrow - scroll through previous commands. Introduction to Linux | Oliver Standford Getting Help • Linux has an extensive help system, called the manual (Man). This consists of a set of manual pages. • To get the man page for a command we can do: • man <command name> • man ls • man mkdir • Man pages list command options, syntax and some examples of use. • The whatis command gives a brief description of a command. • Whatis ls • Google! Introduction to Linux | Oliver Standford Exercises • List files in your current directory. • List all files in your directory (including hidden) • Display the full path of the current directory • Make a directory called linux01. • move into that directory. • Use the touch command to create the file myFile • Create a copy of myFile called myFile2 • rename myFile2 to oldFile. • delete oldFile • Use the man command to find out what ls -p does. • What are the permissions of myFile. Introduction to Linux | Oliver Standford SHELL USAGE Introduction to Linux | Oliver Standford Bash Shell • The shell is a program that: • Interprets commands, and • Acts as an intermediary between the user and the kernel. • In practice we use a terminal emulator. • We interact with the shell via a command line interface. • A command is either a file, or an instruction internal to the shell. Introduction to Linux | Oliver Standford PATH • The shell retains an internal list of directories to search for executable files, called PATH. • To view the PATH type: • echo $PATH • To execute a command not in the PATH you must type the absolute name: • /home/oliver/bin/ls • Commands for sequential execution can be entered on a single line, separated with a ; (semi-colon). • date;sleep 10;date Introduction to Linux | Oliver Standford Processes • When a command is executed the shell creates a job which executes the specified task. • A process can exist in one of four states: • Foreground: All jobs run in foreground unless otherwise stated. • Background: Append ‘&’ to the command. Job runs but shell remains interactive. • Stopped: A stopped jobs can be resumed in different states. • Terminated: A terminated job cannot be resumed. Introduction to Linux | Oliver Standford Running jobs in the background • Running jobs in the background allows to continue using the parent shell. • The shell returns a job number (1) and a process number (2271). • To obtain a list of jobs currently running use jobs command. Introduction to Linux | Oliver Standford Process Management • You can stop a job by typing CTRL-z while it is running. • This will suspend the job. • The job can then be started running in the background using the following command. • bg %<job number> Introduction to Linux | Oliver Standford Cancelling Jobs • If you want to stop a job that is running in the foreground you can kill it by pressing CTRL-C. • If you want to stop a job that is running in the background you can kill it with the kill command. • The syntax of the kill command is: Kill %<job number> or <PID> • For example: • Kill %1 This would kill/quit/close the program with job number 1. • Kill 3678 This would kill/quit/close the program using its PID. Introduction to Linux | Oliver Standford Process management • The operating system maintains a list (called the process table) of all processes. • Each process has a large amount of information related to it. • PID - unique process
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages47 Page
-
File Size-