Presentation is loading. Please wait.

Presentation is loading. Please wait.

©NIIT Linux Basics Lesson 1B / Slide 1 of 26 Introduction to Linux Pre-Assessment Questions 1.Identify the service that Windows operating systems use to.

Similar presentations


Presentation on theme: "©NIIT Linux Basics Lesson 1B / Slide 1 of 26 Introduction to Linux Pre-Assessment Questions 1.Identify the service that Windows operating systems use to."— Presentation transcript:

1 ©NIIT Linux Basics Lesson 1B / Slide 1 of 26 Introduction to Linux Pre-Assessment Questions 1.Identify the service that Windows operating systems use to share files and printers. a.Samba b.CRON Scheduler c.Web Server d.Licensing 2.Identify the default shell for most Linux systems. a. Tcsh b. A c. Z d. Bash

2 ©NIIT Linux Basics Lesson 1B / Slide 2 of 26 Introduction to Linux Pre-Assessment Questions 3.The output, Aug, is being displayed on the screen. Identify the command that has generated this output. a.date "+%a" b.date "+%h" c.date "+%y" d.date "+%r" 4.Which columns display the date and time information of the currently logged on users when the who command is executed? a.1, 2, and 3 b.2, 3, and 4 c.3, 4, and 5 d.1, 2, and 5

3 ©NIIT Linux Basics Lesson 1B / Slide 3 of 26 Introduction to Linux Pre-Assessment Questions 5.Consider the following statements: Statement A: Kernel, the operating system program, is the core of the Linux system. Statement B: Shell is a collection of programs that services day-to-day processing requirements. Which of the following is correct with respect to the above statements? a.Statement A is True but Statement B is False. b.Statement A is False but Statement B is True. c.Both, Statement A and Statement B, are True. d.Both, Statement A and Statement B, are False.

4 ©NIIT Linux Basics Introduction to Linux Lesson 1B / Slide 4 of 26 Solutions to Pre-Assessment Questions 1.a. Samba 2.d. Bash 3.b. date "+%h“ 4.c. 3, 4, and 5 5.a. Statement A is True but Statement B is False

5 ©NIIT Linux Basics Lesson 1B / Slide 5 of 26 Introduction to Linux Objectives In this lesson, you will learn to: Identify the Linux file hierarchy structure Specify absolute and relative pathnames Identify types of files and users in Linux Change the current directory and list its content Create and remove a directory Display the content of a file Copy, rename, move, or remove a file Determine and assign file access permissions

6 ©NIIT Linux Basics Lesson 1B / Slide 6 of 26 Introduction to Linux The Linux File System Linux follows the Unix file system which is a hierarchical, inverted-tree like structure. All the files are stored on the disk under / (root) directory. The directory, /, contains following directories: /bin : Stores commands available under the Linux system /dev : Stores all the device-related files for the system /etc : Stores the system-related data that the users and the system need to refer to, such as the passwd file /lib : Contains libraries of data for the compilers installed on the system, such as the C language routines /home : Contains all the home directories of users /usr : Stores the operating systems files not involved in the boot process /var : Stores information specific to different utilities of Linux

7 ©NIIT Linux Basics Introduction to Linux The Linux File System (Contd.) A sample Linux file hierarchy structure Lesson 1B / Slide 7 of 26©NIIT Working with the Shell

8 ©NIIT Linux Basics Lesson 1B / Slide 8 of 26 Introduction to Linux File Naming Conventions The filenames in Linux: Can be up to 256 characters long Can contain special characters, except for ‘/’ Can contain both upper-case and lower-case alphabets Are case-sensitive Should not have a blank or a tab

9 ©NIIT Linux Basics Lesson 1B / Slide 9 of 26 Introduction to Linux Relative Path Names Linux takes the path name as absolute or relative. When the path name starts with a character, it is taken as the relative path name with respect to the current working directory. When the path name starts with ‘/’, it is taken as the absolute path name. To access the file, September 2004, under the /home/steve/baseball directory, Steve can specify the absolute path as /home/steve/baseball/September Alternatively, Steve can specify the relative path, baseball/September Relative path is a more convenient way to specify path names.

10 ©NIIT Linux Basics Lesson 1B / Slide 10 of 26 Introduction to Linux Types of Files in Linux All information, including devices, is treated as a file in Linux. There are three categories of files: Ordinary files: Are created by a user and include all the data files, program files, object files, and executable files. Directory files: Are created automatically as a directory is created and contains information about the files under the directory. Special files: Are associated with input/output devices and are found in the standard Linux directories, such as /dev and /etc. Linux supports the following types of special files: Character device files: Read and write data one character at a time. Block device files: Access a block of data at a time. Hard links: Allow a single file to have multiple names. Symbolic links: Allow a single file to have multiple names across different file systems.

11 ©NIIT Linux Basics Lesson 1B / Slide 11 of 26 Introduction to Linux Types of Users in Linux The following are the user types supported by Linux: System administrator: Is responsible for the smooth operation of the system including tasks, such as create users and groups and make backups. File owner: Is a user who creates a file and can perform any operation on the file, such as copying, deleting, and editing. Group owner: Is a user belonging to a group who can share and access the files. Other users: Are users who do not belong to a particular group.

12 ©NIIT Linux Basics Lesson 1B / Slide 12 of 26 Introduction to Linux Directory Commands in Linux The commonly used directory commands in Linux are: pwd : Displays the full path name of the current directory: steve]$ pwd cd : Changes the current directory to the directory specified: steve]$ cd /usr/bin mkdir : Creates directories under a specified or current directory: steve]$ mkdir prog-files rmdir : Removes the specified directory: steve]$ rmdir prog-files ls : Displays the names of the files and subdirectories in a directory: steve]$ ls /home/steve

13 ©NIIT Linux Basics Lesson 1B / Slide 13 of 26 Introduction to Linux Common File Commands The commonly used file commands in Linux are: cat : Displays the content of the specified file. steve]$ cat data1 cp : Duplicates the content of the source file into a target file. The syntax of the cp command is: steve]$ cp [options] rm : Deletes files. The syntax of the rm command is: steve]$ rm [options] file/s mv : Moves a file from one location to another. It can also be used for renaming a file. The syntax of the mv command is: steve]$ mv [option] source destination

14 ©NIIT Linux Basics Lesson 1B / Slide 14 of 26 Introduction to Linux Common File Commands (Contd.) more : Displays data one screen-full at a time. The syntax of the more command is: steve]$ more [options] less : Displays data one screen-full at a time and allows you to scroll up while viewing the content of a file. The syntax of the less command is: steve]$ less [options]

15 ©NIIT Linux Basics Lesson 1B / Slide 15 of 26 Introduction to Linux Wildcard Characters Using the wildcard characters, you can perform an operation on multiple files without specifying names of all the files. The following table lists the wildcards available in Linux: CharacterPurpose * Matches none or one character or a string of more than one character ? Matches exactly one character [ ] Matches exactly one of a specified set of characters

16 ©NIIT Linux Basics Lesson 1B / Slide 16 of 26 Introduction to Linux Demonstration-Creating File Hierarchy Problem Statement Deez Inc. call center maintains the call-related data in a file hierarchy structure. The file hierarchy needs to be changed. According to the new requirements, the data related to the incoming calls needs to be stored in a centralized directory, ALLCALLS. This directory will contain two subdirectories, T01 and T02, to store the data related to two teams. Each of these two team directories will contain three subdirectories corresponding to the three team members in each team. Team members store their files only in their respective directories.

17 ©NIIT Linux Basics Lesson 1B / Slide 17 of 26 Introduction to Linux Demonstration-Creating File Hierarchy (Contd.) Problem Statement (Contd.) The following figure depicts the hierarchy of the files: Angela has been assigned the task of creating the preceding file hierarchy structure. The file hierarchy needs to be created under the home directory on Angela’ s computer.

18 ©NIIT Linux Basics Lesson 1B / Slide 18 of 26 Introduction to Linux Demonstration-Creating File Hierarchy (Contd.) Solution To create the file hierarchy structure, Angela needs to perform the following tasks: 1.Identify the levels in the file hierarchy. 2.Identify the order in which the directories need to be created. 3.Identify the commands used for creating the file hierarchy. 4.Verify the directory structure after creating it.

19 ©NIIT Linux Basics Lesson 1B / Slide 19 of 26 Introduction to Linux File Access Permissions File access permissions refer to the permissions associated with a file and directory with respect to the file owner, group owner, and other users. The following table lists various file access permissions: Access Type Denoted by Action Permitted on a File Action Permitted on a Directory Read r Allows you to display, copy, and compile the file Allows you to list the contents of the directory Write w Allows you to edit, rename or move the file to another location Allows you to create new files and sub-directories within this directory Execute x Allows you to execute the file provided the file also has the read permission Allows you to move to that directory using the cd command

20 ©NIIT Linux Basics Lesson 1B / Slide 20 of 26 Introduction to Linux File Access Permissions (Contd.) The access permissions associated with a file or directory can be changed using the chmod command. $ chmod mode file/s The file access permissions for a file can be changed using: Symbolic mode: Uses the following symbols to represent the permission and the type of users: ‘u’ is used for owner of file ‘g’ is used for group users ‘o’ is used for other users ‘a’ is used for all users Absolute mode: Uses a series of digits to represent the actual permissions. For example, digits 4, 2, and 1 represent the read, write and execute permissions, respectively.

21 ©NIIT Linux Basics Lesson 1B / Slide 21 of 26 Introduction to Linux Demonstration-Assigning File Access Permissions Problem Statement Steve is working as a team leader with the Allmart account of Deez Telecommunications Inc. He has created a file, Pricelist, in his home directory. The file, Pricelist, is a highly confidential file. There is always a risk of an unauthorized access to the file because various other people use Steve’s computer across the shifts. Though Steve has his login password secured, he wants to be sure regarding the confidentiality of the file. Steve does not want anybody other than himself to have an access to the file. Help Steve by suggesting him an appropriate solution.

22 ©NIIT Linux Basics Lesson 1B / Slide 22 of 26 Introduction to Linux Demonstration-Assigning File Access Permissions (Contd.) Solution To provide an appropriate solution for restricting unauthorized access to the file, pricelist, Steve needs to perform the following steps: 1.Identify the security measure that should be used in the given situation. 2.Identify the type of user for whom the permission needs to be changed. 3.Identify the type of permission that needs to be changed. 4.Identify and implement the command to be used in the situation. 5.Verify the file access permission of the file.

23 ©NIIT Linux Basics Lesson 1B / Slide 23 of 26 Introduction to Linux Summary In this lesson, you learned: Linux uses a hierarchical file system to enable rapid access to files. A file name in Linux: Can be up to 256 characters long Can contain special characters, except for ‘/’ Can contain both upper-case and lower-case letters Is case-sensitive Should not have a blank or a tab A file has to be referred to by its path name, which can be either of the following: Full/Absolute path name Relative path name

24 ©NIIT Linux Basics Lesson 1B / Slide 24 of 26 Introduction to Linux Summary (Contd.) Every user has a home directory, which is used to maintain files and directories. There are different type of files in Linux, such as: Ordinary files Directory files Special files The types of users for files are: File owner Group owner Other users

25 ©NIIT Linux Basics Lesson 1B / Slide 25 of 26 Introduction to Linux Summary (Contd.) Some of the commonly used directory commands are: pwd : Prints the current working directory cd : Changes the current working directory mkdir : Creates a new directory rmdir : Removes an empty directory ls : Displays the contents of a directory Some common file-handling commands are: cat : Displays the content of files cp : Makes copies of files rm : Removes a file or directory mv : Moves or renames files and directories more, less : Displays the content of a file, one screen-full at a time

26 ©NIIT Linux Basics Lesson 1B / Slide 26 of 26 Introduction to Linux Summary (Contd.) Wildcard characters are used to work on a set of files rather than a single file. The following are the wildcard characters available in Linux: * : Matches none, one, or more characters ? : Matches exactly one character [] : Matches exactly one of a specified set of characters File access permissions refer to the permissions for a file with respect to users. File access permissions can be changed using the chmod command. The chmod command specifies the file permissions in the following ways: Symbolic: The permission and the user type are specified as symbols. Absolute: The permission is specified as a number.


Download ppt "©NIIT Linux Basics Lesson 1B / Slide 1 of 26 Introduction to Linux Pre-Assessment Questions 1.Identify the service that Windows operating systems use to."

Similar presentations


Ads by Google