1 / 22

Working with Linux

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.

reid
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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Working with Linux Lab 1

  2. Login and logout • Account • username & password • Note: • Linux is case-sensitive • Administrator: username = root • Logout: exit, Ctrl+D

  3. (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

  4. 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

  5. Directory/file commands • Display file content : cat filename or more filename head filename or 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_path new_path

  6. 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

  7. 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)

  8. File system and permissions

  9. 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

  10. 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

  11. Changing access rights (3) • Numeric: chmod xyz [-R] file(s) read = 4 write = 2 execute = 1

  12. Changing access rights (4) • Example: some common access rights of directory/file(s)

  13. 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

  14. 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 clear OR Ctrl + L

  15. 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

  16. vi editor • Interactive simple editor • Can not use mouse • Text editing on a buffer • Appears on most Unix or Unix-like system

  17. vi usage

  18. Cursor movement in vi

  19. Text manipulation commands

  20. Text manipulation commands

  21. Text manipulation commands

  22. Text manipulation commands

More Related