Question

In: Computer Science

Using Linux in VirtualBox To display your system date: Type date in the command line, and...

Using Linux in VirtualBox

To display your system date:

  1. Type date in the command line, and press Enter. What do you see?                                           

You might see the abbreviation EDT (Eastern Daylight Time) instead of EST (Eastern Standard Time), or another time zone abbreviation, such as MDT (Mountain Daylight Time) or CST (Central Standard Time). Notice also that UNIX/Linux uses a 24-hour clock.

  1. Type Date in the command line, and press Enter. What error do you see?                                   

The system error message appears because you must enter the date command, like most Linux commands, in lower-case letters.

To display your system date in UTC:

  1. Type date –u in the command line, and press Enter. What do you see?                                                                                       

Using the cal command

In this, you use the cal command to display the current calendar, a Julian date calendar, and the historical calendar for July 1776.

To use the cal command:

  1. Type cal in the command line, and press Enter. What calendar do you see?                                                                                                                    
  2. Type cal –j 2018 in the command line, and press Enter. What type of calendar appears?                                                                                     
  3. To determine the day of the week when the Declaration of Independence was signed, type cal 7 1776 in the command line, and press Enter. Record the calendar you see:                                                                                                                         In this case, the month and year are the command arguments. On which day of the week did the Fourth of July fall?                       
  4. If you type cal july 1776, what do you see?                                                       

Using the who command

The who command is valuable for determining who is currently logged in to a system. In this, you try out the who command using several options.

To use the who command to determine who is logged in to the system:

  1. Type who in the command line, and press Enter.
  2. You see a list showing user names, the terminals they are using, and the dates and the times they logged in. Record your observation:                                                                                
  3. To display a line of column headings with the who command’s output, type who –H and press Enter.

In case any current users are logged in from a remote host, the COMMENT column shows the name of the host.

  1. Idle time is the amount of time that has elapsed with no activity in a user’s session. Type who –u and press Enter to see each user’s idle time. Record your output:                                                                                                                                                                                         
  2. If you want to use multiple options on the same command line, type them all after a single hyphen. For example, type who –uH and press Enter to see a list of users with idle times and column headings.
  3. Type who –q and press Enter to see a quick list of current users. Do you see only login names and the total number of users on the system?                                                                                  
  4. To determine which terminal you are using or what time you logged in, type who am i in the command line, and press Enter. What do you see? (Another option is to type whoami as one word, which only displays your account name or user ID, in case you are not certain which account you are currently using; this option is often used by system administrator. Also try entering who mom likes to see what you find out.)                                                                                                                                                                                                                  

Solutions

Expert Solution

Below is the solution:

When type the date command to the terminal seen the date of the current with the time in IST.

When i typed the Date command in terminal the It will work fine as date command in mac os.

Example:


JohnDoe$ date
Tue Sep 3 12:08:39 IST 2019
JohnDoe$ Date
Tue Sep 3 12:09:40 IST 2019

date -u command will show the date in UTC.

JohnDoe$ date -u
Tue Sep 3 06:41:49 UTC 2019

cal command will display the calendar with selected current date

JohnDoe$ cal
   September 2019   
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               

cal -j 2018 command will shoe the calendar of 2018 from january
                    
JohnDoe$ cal -j 2018
                         2018
          January                     February          
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
      1   2   3   4   5   6                   32 33 34
7   8   9 10 11 12 13   35 36 37 38 39 40 41
14 15 16 17 18 19 20   42 43 44 45 46 47 48
21 22 23 24 25 26 27   49 50 51 52 53 54 55
28 29 30 31               56 57 58 59            
                                                        

           March                        April           
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
                 60 61 62   91 92 93 94 95 96 97
63 64 65 66 67 68 69   98 99 100 101 102 103 104
70 71 72 73 74 75 76 105 106 107 108 109 110 111
77 78 79 80 81 82 83 112 113 114 115 116 117 118
84 85 86 87 88 89 90 119 120                    
                                                        

            May                         June            
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
        121 122 123 124 125                      152 153
126 127 128 129 130 131 132 154 155 156 157 158 159 160
133 134 135 136 137 138 139 161 162 163 164 165 166 167
140 141 142 143 144 145 146 168 169 170 171 172 173 174
147 148 149 150 151          175 176 177 178 179 180 181
                                                        

           July                        August           
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
182 183 184 185 186 187 188              213 214 215 216
189 190 191 192 193 194 195 217 218 219 220 221 222 223
196 197 198 199 200 201 202 224 225 226 227 228 229 230
203 204 205 206 207 208 209 231 232 233 234 235 236 237
210 211 212                  238 239 240 241 242 243    
                                                        

         September                     October          
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
                        244      274 275 276 277 278 279
245 246 247 248 249 250 251 280 281 282 283 284 285 286
252 253 254 255 256 257 258 287 288 289 290 291 292 293
259 260 261 262 263 264 265 294 295 296 297 298 299 300
266 267 268 269 270 271 272 301 302 303 304            
273                                                     

         November                     December          
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
                305 306 307                          335
308 309 310 311 312 313 314 336 337 338 339 340 341 342
315 316 317 318 319 320 321 343 344 345 346 347 348 349
322 323 324 325 326 327 328 350 351 352 353 354 355 356
329 330 331 332 333 334      357 358 359 360 361 362 363
                             364 365                    

cal 7 1776 will display the calendar of july 1776

JohnDoe$ cal 7 1776
     July 1776      
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         
                    


cal july 1776 will also display the calendar of july 1776 same as cal 7 1776

JohnDoe$ cal 7 1776
     July 1776      
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

who command will display the currently logged on to the system.

JohnDoe$ who
JohnDoe    console Sep 3 12:07
JohnDoe    ttys000 Sep 3 12:07

who -H will display the logged user with the information where the user logged in and when.

JohnDoe$ who -H
USER         LINE      WHEN       
JohnDoe    console Sep 3 12:07
JohnDoe    ttys000 Sep 3 12:07

who -q will display the number of user logged into the system.

JohnDoe$ who -q
JohnDoe    JohnDoe  
# users = 2

who am i command will display the current using logged in user with date and time.

JohnDoe$ who am i
JohnDoe    ttys000 Sep 3 12:07

whoami command will only display the name of the user who is logged in.

JohnDoe$ whoami
JohnDoe

who mom likes command will also display the currently logged in user with the date and time.

JohnDoe$ who mom likes
JohnDoe    ttys000 Sep 3 12:07


Related Solutions

Using Linux in VirtualBox Do the Following Exercise: Using the clear command At this point, you...
Using Linux in VirtualBox Do the Following Exercise: Using the clear command At this point, you screen might seem filled with commands and their results. Use the clear command anytime you want a clean slate. This exercise enables you to clear the screen now. To clear the screen: Type clear on the command line, and press Enter. The command prompt is now in the upper-left corner of your screen. [No output or questions for this part.] Viewing manual pages You...
LINUX In Linux command line write a shell script ex1.sh that uses IF THEN to Prompt...
LINUX In Linux command line write a shell script ex1.sh that uses IF THEN to Prompt the user to "Enter a number between 1 and 10". (Hint: Use the 'echo' and 'read' commands in the script. See the slide about the 'read' command) If the number is less than 5, print "The number is less than 5" (Hint: You will read input into a variable; e.g. read NUM. In the IF statement, enclose $NUM in quotes; e.g. "$NUM". Also, remember...
Windows XP Command Line questions. a) What is the command to display all of the files...
Windows XP Command Line questions. a) What is the command to display all of the files on the disk in drive A:--do not use the DIR command or the CHKDSK command C:\> b) Display the contents of the PERSONAL.FIL file located in the root directory of drive A: one screenful at a time C) Display the contents of the PERSONAL.FIL file located in the root directory of drive A:, one screenful at a time, beginning with the 25th record, on...
Introduction Write in C++ at the Linux command line a program that is the same as...
Introduction Write in C++ at the Linux command line a program that is the same as the previous collection app project but now uses a class to store the items and also can save the items to a file that can be read back into the array by the user when the program is re-started. You can use your project 1 submission as a starting point or you can do something new as long as it meets the listed requirements....
unix/Linux Create a tar command using the man command and the link referred to in To...
unix/Linux Create a tar command using the man command and the link referred to in To Practice and Explore: Text File Utilities #9. Preliminaries Use the man pages to learn more about tar Review the links referred to in To Practice and Explore: Text File Utilities #9 to see examples of using tar command Perform Use tar "to stuff" three files and then "unstuff" them into a new directory. Include the -v option. Task ll to show the original 3...
In Linux (Ubuntu), write a script to check command arguments (3 arguments maximum). Display the argument...
In Linux (Ubuntu), write a script to check command arguments (3 arguments maximum). Display the argument one by one. If there is no argument provided, remind users about the mistake. If there is an easy way to use a loop to get all arguments, use it? a. Display the source code in an editor (#4-1) b. Execute your script in the terminal, and display the command and the result (#4-2)
Linux Directories, File Properties, and the File System in C Code your version of mv command...
Linux Directories, File Properties, and the File System in C Code your version of mv command in C The mv command is more than just a wrapper around the rename system call. Write a version of mv that accepts two argument. The first argument must be the name of a file, and the second argument may be the name of a file or the name of a directory. If the destination is the name of a directory, then mv moves...
Linux Directories, File Properties, and the File System in C Your version of find command Try...
Linux Directories, File Properties, and the File System in C Your version of find command Try running the find command in the shell and observe the output. Try it in different folders to make sure you understand what it prints out. $ find Write your version of the find command and add comments.
Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++...
Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++ Rules: -Use fork(), exec(), wait(), and exit() _______________________________________________________________________________________________________________________________________________ -A line of input represents a token group. -Each token group will result in the shell forking a new process and then executing the process. e.g. cat –n myfile.txt // a token group -Every token group must begin with a word that is called the command(see example above). The words immediately following a command are calledarguments(e.g....
Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++...
Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++ Rules: -Use fork(), exec(), wait(), and exit() _______________________________________________________________________________________________________________________________________________ -A line of input represents a token group. -Each token group will result in the shell forking a new process and then executing the process. e.g. cat –n myfile.txt // a token group -Every token group must begin with a word that is called the command(see example above). The words immediately following a command are calledarguments(e.g....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT