Presentation is loading. Please wait.

Presentation is loading. Please wait.

©NIIT Collaborate Lesson 1C / Slide 1 of 23 Collaborate Knowledge Byte In this section, you will learn to: Use the cal command Determine the file types.

Similar presentations


Presentation on theme: "©NIIT Collaborate Lesson 1C / Slide 1 of 23 Collaborate Knowledge Byte In this section, you will learn to: Use the cal command Determine the file types."— Presentation transcript:

1 ©NIIT Collaborate Lesson 1C / Slide 1 of 23 Collaborate Knowledge Byte In this section, you will learn to: Use the cal command Determine the file types

2 ©NIIT Collaborate Lesson 1C / Slide 2 of 23 Collaborate Using the cal Command The cal command displays the calendar. The syntax to use the cal command is: cal [-smjy13] [[month] year] To display the calendar of the current month: $ cal August 2004 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

3 ©NIIT Collaborate Lesson 1C / Slide 3 of 23 Collaborate Using the cal Command (Contd.) The following are the options that you can use with cal command: OptionDescription -sDisplays Sunday as the first day of the week. -mDisplays Monday as the first day of the week. -jDisplays Julian dates. -yDisplays the entire calendar for the current year. The year starts from January 1. Displays the calendar of the current month. -3Displays the calendar for the previous, current, and next month as output.

4 ©NIIT Collaborate Lesson 1C / Slide 4 of 23 Collaborate Determining the File Types The file command examines the content of the file and returns the type of file. The syntax for file command is: file [options] file_name The output of the file command categorizes the content of the file under the following categories : Text: If the file contains only printable characters. Executable: If the file is a program that can be interpreted by the UNIX kernel. Data: If the file contains binary or non-printable characters.

5 ©NIIT Collaborate Lesson 1C / Slide 5 of 23 Collaborate Determining the File Types (Contd.) The following table lists the various options that you can use with the file command: OptionDescription -r Skips the translation of non-printable characters to octal representation -F Specifies the separator for the output of the file command -s Identifies the block and character special files

6 ©NIIT Collaborate Lesson 1C / Slide 6 of 23 Collaborate From the Expert’s Desk This section will introduce the following: Tips and tricks on working faster in Linux FAQs

7 ©NIIT Collaborate Lesson 1C / Slide 7 of 23 Collaborate Tips and Tricks Using the who – H Command The who – H command displays the column headings along with the output of the who command. $ who -H NAME LINE TIME COMMENT steve tty1 Aug 17 11:44 steve :0 Aug 17 12:24 root pts/0 Aug 16 09:10 steve pts/27 Aug 17 12:35 (:0.0) root pts/45 Aug 18 09:35 (172.17.66.241) steve pts/56 Aug 18 13:57 (172.17.66.241) john pts/59 Aug 18 17:12 (172.17.66.241)

8 ©NIIT Collaborate Lesson 1C / Slide 8 of 23 Collaborate Tips and Tricks Using Arrow Keys as Shortcuts You can use the arrow keys ( , , , and ) to access previously executed commands. Press the up arrow key, , to access the previously used commands. Press the  arrow key, to navigate down. Press the  and  arrow keys to move cursor to the beginning and the end of the command, respectively, one character at a time.

9 ©NIIT Collaborate Lesson 1C / Slide 9 of 23 Collaborate Tips and Tricks Using PageUp and PageDown Keys You can use the PageUp key to scroll up and the PageDown key to scroll down the screen. You can also use the  and  arrow keys to move up and down the page one line at a time in a screen.

10 ©NIIT Collaborate Lesson 1C / Slide 10 of 23 Collaborate FAQs Is it possible to create multiple empty files using one command? You can create multiple empty files in Linux using touch command. You Can create any number of files in one command. For example, $touch empty1 empty2 empty3 empty4 empty5 The preceding command creates five empty files.

11 ©NIIT Collaborate Lesson 1C / Slide 11 of 23 Collaborate FAQs (Contd.) How do you run the calculator at the shell prompt to do calculations? The bc command is used to start calculator at the shell prompt. bc is the abbreviation of best calculator. The input to the calculator is taken line by line. The calculator gives the output after each line of input, as illustrated in the following example: $ bc  10+10  20 sqrt(100)  10 quit 

12 ©NIIT Collaborate Lesson 1C / Slide 12 of 23 Collaborate FAQs (Contd.) Is it possible to view the list of users who logged on to a Linux system at a specified date and time? To see the list of users who logged on to the Linux system at a particular date and time, give the last command with -t option in the following format: $ last -t YYYYMMDDHHMMSS

13 ©NIIT Collaborate Lesson 1C / Slide 13 of 23 Collaborate FAQs (Contd.) How can I change the default format of date that is displayed by the date command? You can change the default format of the output of date command using the various switches, such as +, %d, and %n. The new format should be enclosed in single quotes and must begin with the + sign. For example, you may want to print the output as follows: Date:20-08-04 Time:11:33:14 You can give the following command: $date '+Date:%d-%m-%y%nTime:%H:%M:%S ‘ The strings, %d, %m, and %y represent day, month, and year, respectively. The strings, %H, %M, and %S represent hour, minute, and second, respectively. The string %n is used to print a line break.

14 ©NIIT Collaborate Lesson 1C / Slide 14 of 23 Collaborate FAQs (Contd.) What is the difference between Linux and Unix? The main difference between Linux and Unix is that Linux is available free of charge and the licensing for Unix is very expensive. Linux is a Unix-clone and provides support for most Unix-based applications. All the shells available for Linux are also based on the Unix shells. However, the shells available with Linux are free and have added features. Linux is becoming increasingly popular, not only for server-side computers but also for desktop use. Does open source and Linux mean the same? No. The open source movement aims at keeping the software source code open and accessible to all. Open source software includes the Linux software.

15 ©NIIT Collaborate Lesson 1C / Slide 15 of 23 Collaborate FAQs (Contd.) Because Linux is free, how do companies selling Linux earn revenue? Traditionally, license fees have been the main source of revenue for the software industry. Companies selling Linux, such as Red Hat, usually earn from the support and training they provide to their clients.

16 ©NIIT Collaborate Lesson 1C / Slide 16 of 23 Collaborate Challenge 1.Match the features with the respective operating system. Remember that the operating system should truly support the feature with which you match the operating system. FeaturesOperating System Multi-userMS-DOS MultiprocessingWindows NT CLILinux

17 ©NIIT Collaborate Lesson 1C / Slide 17 of 23 Collaborate Challenge (Contd.) 2.Create a file called initial with the following content: first file created only 2 line of content Write a single command to create the file, final, and copy the content of the file, initial, to the file, final, using symbolic linking. Display the content of the file, final, to verify the output. Using ls command, notice the difference in the listing of file, final. 3.In a data processing organization, when an employee resigns and leaves the organization, it is the practice to store the data of that employee in the Linux server of the company under the directory containing the name of the employee who has resigned. Further, the data inside the directory is maintained in subdirectories based on the projects in which the employee has worked.

18 ©NIIT Collaborate Lesson 1C / Slide 18 of 23 Collaborate Challenge (Contd.) 3.(Contd.) For example, the employee who has resigned had the following directory structure: /steve : home directory containing following sub directories proj_ABC proj_dishnet proj_wincable proj_citi personal_info Each of the above files are related to the project and personal Information, respectively. You are the system administrator for the organization and need to do the following: Move all the project files of Steve in a directory called steve_backup under the directory, /. Delete the entire directory structure of steve using one single command. ©NIIT Collaborate

19 ©NIIT Collaborate Challenge (Contd.) 4.A user, Angela, has just logged on to her home directory, which is the directory, angela, under the directory, user. She then gives the following commands. The results of these commands have been left blank. Fill in the blanks. $pwd  ______ $ cd../..  $pwd  ______ $ cd /bin  $ pwd  _______ $ After the above sequence of commands, the user, Angela, wants to go back to her home directory. Identify the command that she needs to use using the full path name. Lesson 1C / Slide 19 of 23©NIIT Collaborate

20 ©NIIT Collaborate Challenge (Contd.) 5.Which of the files from the following file list would the command, cat ch, display? match patch choo1.c.ch ch ch.c post-script Lesson 1C / Slide 20 of 23©NIIT Collaborate

21 ©NIIT Collaborate Lesson 1C / Slide 21 of 23 Collaborate Solutions to Challenge 1.Multi-user: Linux Multiprocessing: Windows NT CLI: MS-DOS 2.Create the file, initial, using the following command: $ cat > initial first file created only 2 line of content Copy the content of file, initial, to a new file, final, using the following command: $ cp – s initial final List the information of the file, final, using the following command: $ ls –l final

22 ©NIIT Collaborate Lesson 1C / Slide 22 of 23 Collaborate Solutions to Challenge (Contd.) 3.To perform the task of making a back up of Steve’s directory, you need to log on as the root user as follows: [root@linuxpc1 root]# cd /  [root@linuxpc1 /]# Create the directory, /steve_backup, using the following command: [root@linuxpc1 /]# mkdir /steve_backup  Move the files from directory, /home/steve, to the directory, /steve_backup, using the following command: [root@linuxpc1 /]# mv /home/steve/* /steve_backup  Remove the directory structure of the directory, / steve, using the following command: [root@linuxpc1 /]# rm – r /steve 

23 ©NIIT Collaborate Lesson 1C / Slide 23 of 23©NIIT Collaborate Solutions to Challenge (Contd.) 4.The output of the command will be as follows: $pwd  /user/angela $ cd../..  $pwd  ­­/ $ cd /bin  $ pwd  /bin $ cd /user/angela 5.The command will display the content of the ch file.


Download ppt "©NIIT Collaborate Lesson 1C / Slide 1 of 23 Collaborate Knowledge Byte In this section, you will learn to: Use the cal command Determine the file types."

Similar presentations


Ads by Google