Working with linux
This presentation is the property of its rightful owner.
Sponsored Links
1 / 22

Working with Linux PowerPoint PPT Presentation


  • 70 Views
  • Uploaded on
  • Presentation posted in: General

Working with Linux. Lab 1. Login and logout. Account username & password Note : Linux is case-sensitive Administrator: username = root Logout: exit, Ctrl+D. (D). (C). WINDOWS. Program Files. Data. Music. …. OS. Fonts. System32. …. …. Linux File System. (/). home. boot.

Download Presentation

Working with Linux

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Working with linux

Working with Linux

Lab 1


Login and logout

Login and logout

  • Account

    • username & password

    • Note:

      • Linux is case-sensitive

      • Administrator: username = root

  • Logout: exit, Ctrl+D


Linux file system

(D)

(C)

WINDOWS

Program Files

Data

Music

….

OS

Fonts

System32

….

….

Linux File System

(/)

home

boot

etc

root

khoa

student1

….

….

Linux File System

Windows File System


Directory file commands

Directory/file commands

  • List contents of directory :

    ls [-a] [-l] [directory_name]

  • Print working directory: pwd

  • Change working directory :

    cd directory_name

    E.g. cd /home

  • Create new directory :

    mkdir directory_name

  • Remove a directory:

    rm -r directory_name

  • Some special symbols :

    ~ : home directory

    .. : parent directory


Directory file commands1

Directory/file commands

  • Display file content :

    cat filenameor more filename

    head filenameor tail filename

  • Copy file(s) or directory:

    cp [-r] source_file destination_file

  • Remove file or directory

    rm –r file_name

  • Move (rename) file(s)/directory

    mv old_pathnew_path


File system and permissions

File system and permissions

  • Each user may owns one or more directories/files

  • Each user has different access rights in different directories/files

    • users can share their data together

    • users also can protect their private data


File system and permissions1

File system and permissions

  • Access right on directory/file

    • read (r)

    • write (w)

    • execute (x)

  • Each directory/file has 9 access-right bits, divide into 3 groups as follow :

    • owner

    • group (e.g. people the same project team)

    • others (people in public domain)


File system and permissions2

File system and permissions


Changing access rights 1

Changing access rights (1)

  • Symbolic

    chmod whoopmode [-R] file(s)

  • Who:u : owner

    g : group

    o : others

    a : all

  • Mode: r : read

    w : write

    x : execute

  • Op+ : grant more rights

    - : revoke rights

    = : reset rights


Changing access rights 2

Changing access rights (2)

  • Example

    $ touch temp

    $ ls –l temp

    -rw-r--r-- 1 user1 staff 0 Jun 11 11:44 temp

    $ chmod o-r temp

    $ ls -l temp

    -rw-r----- 1 user1 staff 0 Jun 11 11:44 temp

    $ chmod u+x, o+r temp

    $ ls -l temp

    -rwxr--r-- 1 user1 staff 0 Jun 11 11:44 temp


Changing access rights 3

Changing access rights (3)

  • Numeric: chmod xyz [-R] file(s)

    read = 4 write = 2 execute = 1


Changing access rights 4

Changing access rights (4)

  • Example: some common access rights of directory/file(s)


Changing access rights 5

Changing access rights (5)

  • Example

    $ touch abc

    $ ls –l abc

    -rw-r--r-- 1 user1 staff 0 Jun 11 11:44 abc

    $ chmod 555 abc

    $ ls -l abc

    -r-xr-xr-x 1 user1 staff 0 Jun 11 11:44 abc

    $ chmod 775 abc

    $ ls -l abc

    -rwxrwxr-x 1 user1 staff 0 Jun 11 11:44 abc


Advanced utilities 1

Advanced utilities (1)

  • Who is who?

    who [option]

  • Print current host name

    hostname

  • Where do they come from?

    which [filename]

  • How much disk usage?

    df [option]

  • Clear screen

    clearOR Ctrl + L


Advanced utilities 2

Advanced utilities (2)

  • Find a specified file :

    find path –name filename

  • Find lines in file matching a pattern

    grep patternfile_name

  • Mount and unmount file system

    mount -t filesystemdevice_filemount_point

    umount mount_point


Vi editor

vi editor

  • Interactive simple editor

  • Can not use mouse

  • Text editing on a buffer

  • Appears on most Unix or Unix-like system


Vi usage

vi usage


Cursor movement in vi

Cursor movement in vi


Text manipulation commands

Text manipulation commands


Text manipulation commands1

Text manipulation commands


Text manipulation commands2

Text manipulation commands


Text manipulation commands3

Text manipulation commands


  • Login