Getting Started with Linux

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

Chapter 6. Linux File System

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

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

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

INTRODUCTION TO LINUX

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

Filesystem Hierarchy and Permissions

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

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

Course 55187B Linux System Administration

Full file at

Filesystem Hierarchy and Permissions

UNIX File Hierarchy: Structure and Commands

Unix Filesystem. January 26 th, 2004 Class Meeting 2

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

At course completion. Overview. Audience profile. Course Outline. : 55187B: Linux System Administration. Course Outline :: 55187B::

"Charting the Course... MOC B: Linux System Administration. Course Summary

Linux Files and the File System

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

commandname flags arguments

Introduction to Linux

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

Unix System Architecture, File System, and Shell Commands

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Exercise Sheet 2. (Classifications of Operating Systems)

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

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

Exam LFCS/Course 55187B Linux System Administration

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

1 Installation (briefly)

Introduction to Linux

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

Disks, Filesystems 1

Working with Ubuntu Linux. Track 2 Workshop June 2010 Pago Pago, American Samoa

Lab #9: Configuring A Linux File Server

Overview of the UNIX File System. Navigating and Viewing Directories

File System Hierarchy Standard (FHS)

This is Worksheet and Assignment 12. Disks, Partitions, and File Systems

Disks, Filesystems Todd Kelley CST8177 Todd Kelley 1

RocketRAID 231x/230x SATA Controller Debian Linux Installation Guide

Chapter-3. Introduction to Unix: Fundamental Commands

Please note that CNE 216 is a brand new course that has never been taught on the George campus; it will be taught for the first time in the fall of

Linux Kung-Fu. James Droste UBNetDef Fall 2016

GNU/Linux: An Essential Guide for Students Undertaking BLOSSOM

Overview of the UNIX File System

CSC209. Software Tools and Systems Programming.

Ubuntu Manually Mount Cdrom Drive Command Line Vmware

Disks, Filesystems, Booting Todd Kelley CST8177 Todd Kelley 1

Introduction. What is Linux? What is the difference between a client and a server?

CSE 265: System and Network Administration

Embedded System Design

Thousands of Linux Installations (and only one administrator)

Caja File Manager. Desktop User Guide

CSC209. Software Tools and Systems Programming.

Lecture 2: The file system

Operating Systems Linux 1-2 Measurements Background material

. Fill in the Blank: A directory named mydir has just been... Points:10. Add Question Success: 64 questions added as a copy.

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

TECH 4272 Operating Systems

Virtual Machine. Linux flavor : Debian. Everything (except slides) preinstalled for you.

CST8207: GNU/Linux Operating Systems I Lab Nine Disks, Partitions, and File Systems Part 2. Disks, Partitions, and File Systems - Part 2 of 2

RocketRAID 2522 SATA Controller Ubuntu Linux Installation Guide

CS/CIS 249 SP18 - Intro to Information Security

Files (review) and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

CS Fundamentals of Programming II Fall Very Basic UNIX

Linux Systems Administration Getting Started with Linux

Introduction to Unix: Fundamental Commands

File System. yihshih

CSE 390a Lecture 4. Persistent shell settings; users/groups; permissions

PiCloud. Building owncloud on a Raspberry PI

1.3 What does Ctrl-D, Ctrl-A, Ctrl-F and Ctrl-T do in terms of command line editing? (6)

The newer versions of Unix also blur the distinction between files and processes, serial ports, ipc channels, and shared memory segments

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Getting your department account

Introduction to Linux Part I: The Filesystem Luca Heltai

Operating Systems Lab

CompTIA Linux+ Guide to Linux Certification Fourth Edition. Chapter 2 Linux Installation and Usage

Linux for Beginners. Windows users should download putty or bitvise:

Lab E2: bypassing authentication and resetting passwords

Permission and Ownership

CREATION OF A MINIMAL STAND ALONE RTAI SYSTEM ================================================

Filesystem Hierarchy Operating systems I800 Edmund Laugasson

Linux+ Guide to Linux Certification, Third Edition. Chapter 2 Linux Installation and Usage

Lecture 2b. Pathnames, files, special characters in filenames, and file permissions. COP 3353 Introduction to UNIX, FALL 2013

Introduction to Linux

Files. Computer Center, CS, NCTU. % ls l. d rwx--x--x 7 liuyh gcs 1024 Sep 22 17:25 public_html. File type. File access mode.

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Software I: Utilities and Internals

System Administration for Beginners

The UNIX File System

Stop all processes and then reboot - same as above startx. Log in as superuser from current login exit

The UNIX File System

CSE 390a Lecture 4. Persistent shell settings; users/groups; permissions

To understand this, let's build a layered model from the bottom up. Layers include: device driver filesystem file

Commands are in black

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

Practical 4. Linux Commands: Working with Directories

RocketRAID 231x/230x SATA Controller Red Hat Enterprise/CentOS Linux Installation Guide

SLES Linux Installation Guide

Transcription:

Getting Started with Linux For those with experience using Microsoft Windows there will be many familiar ways of operating in a Linux environment. There are also a few key differences. The main differences are.. 1) How attached devices, eg/. HDDs, USB & Optical drives are specified 2) Filename Conventions 3) File and Directory (Folder) access permissions 4) How the Linux manages software additions, removals and updates 1) Disk Devices - Where are my disks? With Microsoft Windows, each disk has a separate file tree. With Linux there is only one file tree, regardless of the number of disk drives. Under Linux, disks are "mounted" at convenient points within the file system tree. Conventions have developed about exactly where these mount points are located. A mount point is simply an empty directory. The mount points for disk drives are defined in the file /etc/fstab, which maps the devices to their corresponding mount points, among other things. The details contained in /etc/fstab will often be different for different distributions, and will depend on the number and type of storage devices to be used. Under Microsoft Windows, the mount points are effectively pre defined by the system, although the ability exists to assign the drive letters. 1.1) Disk Devices - Disk Drive Naming Conventions Consider a system with traditional BIOS or equivalent. Typical device names would be something like.. Storage Device Microsoft Windows Linux Floppy Disk A: /dev/fd0 SATA Hard Disk - first controller - C: /dev/sda1 first partition SATA Hard Disk - first controller - E: /dev/sda2 second partiton First USB drive F: /dev/sdb1 First Optical drive E: /dev/sr0

1.2) Disk Devices - Partition Naming Conventions Example Device: /dev/sda Can have up to 4 primary partitions, or a combination of up to 3 primary partitions and a number of logical partitions. If you want to use only Primary partitions /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 First Primary partition Second Primary partition Third Primary partition Fourth Primary partition If you want to use both Primary and Logical partitions /dev/sda1 /dev/sda2 /dev/sda5 /dev/sda6 First Primary partition Second Primary partition First Logical partition Second Logical partition 2) Linux Filenames - Important Conventions Filenames in Linux do not require a three letter extension. For example: MelbpcCalendar is a legitimate filename However, most Linux users usually assign filenames with extensions for their own convenience. File names in Linux are case sensitive. For example: the files with names Melbpc.txt and melbpc.txt are considered two separate files. The separator in the full path name is a /, not a \ as in Windows. For example: Windows filename: Linux filename: C:\Program Files\adobe\acroread.exe /usr/bin/acroread Note that filenames beginning with a dot (.) are not shown by the ls command unless specifically asked for via the -a option. For example, if we copy a few files to a test directory, including a file beginning with a dot, then the ls command gives following results.. $ ls test GS-Linux-on-Pi-2.odp GS-Pi-Linux-2.txt GS-Pi-Linux-Intro.txt GS-Linux-on-Pi.odp GS-Pi-Linux-3.txt $ ls -a test..bashrc GS-Linux-on-Pi.odp GS-Pi-Linux-3.txt.. GS-Linux-on-Pi-2.odp GS-Pi-Linux-2.txt GS-Pi-Linux-Intro.txt Note that the hidden directories. and.. are shown here as well as the file.bashrc.

2.1) - Exploring the Linux Filesystem: The Top Level Directories / The root directory - the top of the directory tree. /bin The directory where the most important executable program files are kept - some of these files are needed to boot the system. /boot The directory where the essential files used at boot time are kept, including the operating system kernel. /dev The directory where Linux keeps its device files. /etc The directory where the global configuration files are kept. Per user configuration files are kept in the users' home directory. /home The directory where all users except the root user have their files stored. There is one directory unique to each user. When a user logs in, the default directory is set to their unique home directory. /lib The directory where shared library files reside. Shared libraries contain common routines needed by many different programs. /media & /mnt These directories are where disk drives with removable media or temporarily installed drives are mounted. /proc The directory where you can find "virtual files" which represent various aspects of your system. These "files" can be read to obtain information about your system. /root /opt The home directory of the root user The directory where optional application software can be installed - see also /usr/local /sbin The directory where most of the system administration programs are stored. /tmp /usr The directory where many programs store temporary working files. The directory where programs not required to be on the root partition are kept. These programs are generally application software available to all users. /usr/local The directory where software not managed by the distributions' package management software is stored. /var The directory where files that change over time are stored. These files may be system log files, printer spool files or database data files.

3) File and Directory Permissions in Linux - The Basics In Linux, everything is a file. One of the properties of a file is a set of permission bits, which determine who has access and what type of access they have. Note that this scheme was originally developed to protect users from each other, and the system from all users. There are three categories of permissions defined for a linux file system. User Group Other The User is the person who created the file, and is often referred to as the owner. The Group is one or more users who have been granted separate access by the User (owner) of the file. Every one else who is able to log in to the computer, and is neither the user nor a member of the associated group, is classified as "Other". There are three distinct types of permission bits for each category read write execute and these permission types define how a user can access a file. There are two types of permissions nomenclature, namely symbolic and absolute. Let's look at the easy one first - symbolic nomenclature. 3.1) - Symbolic Permissions. Symbolic nomenclature uses the symbols r,w and x to show what type of access is permitted, and a hyphen ( -) to show access is denied. An additional character is used to show the type of file. This character is usually displayed as the leftmost character of the permissions bits. The actions allowed by these permissions depend on whether we are considering a file or a directory (folder). for files Read permission (r) means you can look at the files' content. Write permission (w) means that you change or delete the file. Execute permission (x) means that you can run the file as a program. for directories Read permission (r) means you can list the contents of the directory Write permission (w) means you can add or remove files in the directory Execute permission (x) means you can list information about the files in the directory

A few examples using the ls - l command in a Terminal.. -rw-r--r-- 1 nslinux users 21393 Apr 26 13:56 rpms.list -rwxr-x--- 1 nslinux users 735 Apr 30 14:37 hello.py drwxr-xr-x 3 nslinux users 224 May 14 15:15 Documents brw-rw---- 1 nslinux cdrom 22, 0 May 14 17:33 /dev/sr0 crw-rw---- 1 root lp 6, 0 May 15 2006 /dev/lp0 3.2) - Absolute permissions. The Absolute nomenclature scheme uses octal numbers to show the permission bits which are set. The overall permissions of a file are then expressed as a number which is the sum of the numeric values assigned to each category. The numeric values for each permission bit can be expressed as follows.. user group other read write execute read write execute read write execute 400 200 100 40 20 10 4 2 1 The overall permissions are expressed as a number, which is determined by the sum of the numbers representing those permissions which are turned on. Suppose you want to set the permissions of a non executable file that you have created so that you (the user) have read and write permissions, the group "users" has read permissions, and everyone else also has read permissions. This would translate to user = 400 + 200 = 600 group = 40 other = 4 which gives a total = 600 + 40 +4 = 644 (in symbolic nomenclature, -rw-r--r-- ) For a directory, lets assume you want to give yourself full permissions, the group users just read and execute permission, and no permission at all for everyone else. Here we have: user = 400 + 200 +100 = 700 group = 40 + 10 = 50 other = 0 for a total of 750 3.3) - Default Permissions. ( or drwxr-x--- in symbolic nomenclature ) In a virtual console or X Terminal, the default permissions set on file or directory creation are determined by the shell in use. The usual shell is the bash shell, which has the function umask to view and/or set the default permissions. See Apendix A for details.

4) Updating a Linux Installation. Linux distributions almost always have their software, both for the operating system and the applications, stored in repositories. The repositories are kept up to date by the maintainers of each Linux distribution, and are accessible via the internet. The software that uses these repositories to add, remove and update the software on your Linux installation is called a package manager. Simliar systems for commercial software are often called "app stores". The Linux package managers are able to keep a list of software installed on your machine, check the authenticity of each package, download and install new programs together with all their dependencies, and remove outdated or unwanted software. The Raspberry Pi uses the Debian package management software. Using a terminal, you will need apt-cache to get information about packages available for and/or installed on your Pi, and apt-get to update, install or remove items of software. Alternatively, if you are using the X Windows Desktop, you can install the synaptic package manager which gives you a flexible GUI to manage your software. 4.1) - First time update. When you have sucessfully booted your Raspberry Pi for the first time, it is a good idea to get all the updates which have been released since the image file you used to create the software on your SD card was itself created. We will use the standard command line to do this. Two commands are needed.. $ sudo apt-get update This command connects to the repositories, which are specified as part of the installation process, and downloads a list of the software available together with details of the latest upgrades. When the update has finished, use the following command to install all the upgrades relevant to your Linux installation. $ sudo apt-get upgrade When your initial set of updates has been installed, you may need to reboot. In general, a reboot is required only if some critical software packages have been updated, for example a kernel update. If in doubt - reboot. To reboot from the command line use the command $ sudo reboot Note that a kernel update includes relevant updates to the "device drivers" which may be used on your Pi. If you would like to use the synaptic package manager, you can download and install it by using the command.. $ apt-get install synaptic

Now, when you start up your Desktop GUI, you can select synaptic in the application menu. You can now inspect the details of the software you have already installed, and install, remove and update software using a GUI package manager. When you have finished a session with your 'Pi and want to shut down, use the command $ sudo halt Appendix A - Setting default permission for a user. Consider the following command issued in a bash shell... $ umask 0022 Here, we have the umask set to 0022. To determine which file permissions are set as default, we ignore the leading zero, and take the complement of 022, that is we subtract each digit from 7. 777 022 755 Now 755 corresponds to... User: 600 + 200 + 100 = 700 ( r w x ) Group: 40 + 10 = 50 ( r - x ) Other: 4 + 1 = 5 ( r - x ) 755 or in symbolic nomenclature rwxr-xr-x Note that for files the default permissions set at file creation time usually do not set the execute bit, even if the umask implies that this is so. For example: use the touch command to create a blank file.. $ umask 0022 $ touch test3.txt $ ls -l test3.txt -rw-r--r-- 1 nslinux nslinux 0 Apr 26 13:15 test3.txt Note also that application programs may set permissions when they save files which may be different from the defaults. If you want to change the default permissions, you can use the umask command to check that the new defaults are what you want. Then you will need to edit the.bashrc file (note the dot) in your home directory and set the new

value. For example: Set the umask in your current terminal session with (say) $ umask 0027 Check that the new value of umask gives the desired default permissions by creating a blank file with the touch command.. $ touch test2 And using the ls - l command to check the result.. $ ls -lh test2 -rw-r--- 1 nslig users 0 Apr 20 12:07 test2 If all is well, add the line umask 0027 to the end of your.bashrc file.