Cisco Networking Academy Lab - Linux Review PDF

Document Details

TopnotchDubnium

Uploaded by TopnotchDubnium

Tags

Linux commands command-line interface file management system administration

Summary

This document is a Cisco Networking Academy lab focusing on Linux review. It covers basic Linux skills, including command navigation, file management, and system administration. The document includes instructions and practical examples for readers to practice various Linux commands.

Full Transcript

Lab - Linux Review Objectives Part 1: Launch the DEVASC VM Part 2: Review Command Syntax Navigation Part 3: Review File Management Part 4: Review Regular Expressions Part 5: Review System Administration Background / Scenario In this lab, you review basic Linux skills i...

Lab - Linux Review Objectives Part 1: Launch the DEVASC VM Part 2: Review Command Syntax Navigation Part 3: Review File Management Part 4: Review Regular Expressions Part 5: Review System Administration Background / Scenario In this lab, you review basic Linux skills including command navigation, file management, regular expressions, and system administration. This lab is not meant as a substitute for prior Linux experience and does not necessarily cover all the Linux skills you need for this course. However, this lab should serve as a good measure of your Linux skills and help direct you to where you may need more review. Required Resources 1 PC with operating system of your choice Virtual Box or VMWare DEVASC Virtual Machine Instructions Part 1: Launch the DEVASC VM If you have not already completed the Lab - Install the Virtual Machine Lab Environment, do so now. If you have already completed that lab, launch the DEVASC VM now. Part 2: Review Command Syntax Navigation In this part, you will use the ls, pwd, cd, and sudo commands to review basic command syntax navigation. Step 1: Open a terminal in the DEVASC-LABVM. a. Double-click the Terminal Emulator icon on the desktop to open a terminal window. Step 2: Navigate directories. a. Use the ls command to display a listing of the current directory. Remember that commands are case- sensitive. devasc@labvm:~$ ls Desktop Downloads Music Public Templates Documents labs Pictures snap Videos devasc@labvm:~$ b. Use the ls command with the labs argument to display the contents of the labs folder. devasc@labvm:~$ ls labs © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 1 of 15 www.netacad.com Lab - Linux Review devnet-src devasc@labvm:~$ c. Use the ls command with the -l option to display a "long display" of the contents of the current directory. devasc@labvm:~$ ls -l total 40 drwxr-xr-x 2 devasc devasc 4096 Mar 30 21:25 Desktop drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Documents drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Downloads drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:21 labs drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Music drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Pictures drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Public drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:24 snap drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Templates drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Videos devasc@labvm:~$ d. Use the ls command with the -r option to display the contents of the current directory in reverse alphabetical order. devasc@labvm:~$ ls -r Videos snap Pictures labs Documents Templates Public Music Downloads Desktop devasc@labvm:~$ e. Multiple options can be used at the same time. Use the ls command with both the -l and -r options to display the contents of the current directory both in long and reverse order. devasc@labvm:~$ ls -lr total 40 drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Videos drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Templates drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:24 snap drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Public drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Pictures drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Music drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:21 labs drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Downloads drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Documents drwxr-xr-x 2 devasc devasc 4096 Mar 30 21:25 Desktop devasc@labvm:~$ f. There are many more options that can be used with the ls command. Use the man command with the argument ls to see all of the possibilities in the manual. The man command can be used to look up any command within the system. Use the space bar to advance to subsequent screens. Press q to quit. devasc@labvm:~$ man ls (The command line disappears and the manual page for ls opens.) LS(1) User Commands LS(1) NAME ls - list directory contents © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 2 of 15 www.netacad.com Lab - Linux Review SYNOPSIS ls [OPTION]... [FILE]... DESCRIPTION List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐ fied. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with. -A, --almost-all do not list implied. and.. --author Manual page ls(1) line 1 (press h for help or q to quit) g. You can also use --help argument after most commands to see a shorter summary of all the available command options. devasc@labvm:~$ ls --help Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with. -A, --almost-all do not list implied. and.. (Output Omitted) devasc@labvm:~$ h. Use the pwd command to display the current working directory. devasc@labvm:~$ pwd /home/devasc devasc@labvm:~$ i. Use the cd command to change the directory to /home/devasc/Documents. devasc@labvm:~$ cd Documents devasc@labvm:~/Documents$ j. Use the cd command with the / symbol to change directories to the root directory. Use pwd again to see that you are now in the root directory. devasc@labvm:~/Documents$ cd / devasc@labvm:/$ pwd / devasc@labvm:/$ k. Return to the /home/devasc/Documents directory. Tip: You can move one directory at a time or all the way to a destination. To quickly enter the command, type the first few letters of the directory name and © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 3 of 15 www.netacad.com Lab - Linux Review press Tab for the system to automatically enter the rest of the name. Remember that names are case- sensitive. devasc@labvm:/$ cd /home/devasc/Documents/ devasc@labvm:~/Documents$ l. Use the.. characters to move up a single directory. Use pwd again to see you are back in the user’s home directory. devasc@labvm:~/Documents$ cd.. devasc@labvm:~$ pwd /home/devasc devasc@labvm:~$ Step 3: Use super user commands for administrative access. a. Use the sudo command to issue a single command as the root user. A new terminal will not be created. Use the sudo apt-get update command to update to refresh the list of available packages installed on the VM. This command will not work without using the sudo command. Note: Your output will most likely be different. devasc@labvm:~$ sudo apt-get update Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [97.9 kB] Get:2 http://us.archive.ubuntu.com/ubuntu focal InRelease [265 kB] Get:3 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease [89.1 kB] Get:4 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease [89.2 kB] Get:5 http://us.archive.ubuntu.com/ubuntu focal/main i386 Packages [723 kB] Get:6 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages [981 kB] (Output Omitted) Fetched 677 kB in 2s (346 kB/s) Reading package lists... Done devasc@labvm:~$ Part 3: Review File Management In this part, you will review file permissions, change file permissions and ownership, move files, copy files, remove files, and view files. Step 1: Review file permissions. a. Use the ls Desktop -l to display the contents of the Desktop folder. devasc@labvm:~$ ls Desktop -l total 28 -rwxr-xr-x 1 devasc devasc 1095 Mar 30 21:24 chromium_chromium.desktop -rwxr-xr-x 1 devasc devasc 401 Mar 30 21:25 cisco-packet-tracer_cisco-pacet- tracer.desktop -rwxr-xr-x 1 devasc devasc 776 Mar 30 21:23 code.desktop -rwxr-xr-x 1 devasc devasc 373 Mar 30 21:25 drawio_drawio.desktop -rwxr-xr-x 1 devasc devasc 250 Mar 30 21:21 exo-terminal-emulator.desktop -rwxr-xr-x 1 devasc devasc 99 Mar 30 21:21 labs.desktop -rwxr-xr-x 1 devasc devasc 334 Mar 30 21:24 postman_postman.desktop devasc@labvm:~$ b. Answer the following questions about the output above. If necessary, search the internet for information of Linux file permission shown in the output of the ls command. © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 4 of 15 www.netacad.com Lab - Linux Review Questions What does the initial dash represent in the permission information? Type your answers here. What would be in the place of the dash if the item was a directory? Type your answers here. What do the next three letters or dashes represent in the permission information? Type your answers here. What do the middle three letters or dashes represent in the permission information? Type your answers here. What do the last three letters or dashes represent in the permission information? Type your answers here. What does the first instance of "devasc" in the permission information indicate? Type your answers here. What does the second instance of "devasc" in the permission information indicate? Type your answers here. What does a permission type of "r" mean? Type your answers here. What does a permission type of "w" mean? Type your answers here. What does a permission type of "x" mean? Type your answers here. Step 2: Change file permissions and ownership. a. Use the command cd to change to the Documents directory. devasc@labvm:~$ cd Documents/ devasc@labvm:~/Documents$ b. Use the command echo to create a shell script file, that will have the command ls../Desktop inside the file. Remember that the greater than (>) character redirects command output to a file. devasc@labvm:~/Documents$ echo "ls../Desktop" > myfile.sh devasc@labvm:~/Documents$ c. The myfile.sh script is stored in the /Documents directory. Use the cat command to view the only command in the script. This file will be used as an example to modify permissions and ownership. devasc@labvm:~/Documents$ cat myfile.sh ls../Desktop devasc@labvm:~/Documents$ d. Use the command./myfile.sh to run the script. Access is denied because you must set the permission of executable on the file. devasc@labvm:~/Documents$./myfile.sh bash:./myfile.sh: Permission denied e. Use the command ls -l myfile.sh to view the current file permissions. devasc@labvm:~/Documents$ ls -l myfile.sh © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 5 of 15 www.netacad.com Lab - Linux Review -rw-rw-r-- 1 devasc devasc 14 Apr 16 12:46 myfile.sh f. Use the command chmod +x myfile.sh to allow you to execute the file. devasc@labvm:~/Documents$ chmod +x myfile.sh devasc@labvm:~/Documents$ g. Use the command./myfile.sh to run the script. devasc@labvm:~/Documents$./myfile.sh chromium_chromium.desktop exo-terminal-emulator.desktop cisco-packet-tracer_cisco-pacet-tracer.desktop labs.desktop code.desktop postman_postman.desktop drawio_drawio.desktop devasc@labvm:~/Documents$ h. Use the command sudo chown root myfile.sh to change the ownership of the file to "root". devasc@labvm:~/Documents$ sudo chown root myfile.sh devasc@labvm:~/Documents$ i. Display the permissions of the myfile.sh file. devasc@labvm:~/Documents$ ls -l total 4 -rwxrwxr-x 1 root devasc 14 Apr 16 21:28 myfile.sh devasc@labvm:~/Documents$ Step 3: Use the move files command. a. Use the command mv to move the myfile.sh file to the desktop. devasc@labvm:~/Documents$ mv myfile.sh /home/devasc/Desktop/ devasc@labvm:~/Documents$ b. Display the contents of the Desktop folder. devasc@labvm:~/Documents$ ls../Desktop/ chromium_chromium.desktop exo-terminal-emulator.desktop cisco-packet-tracer_cisco-pacet-tracer.desktop labs.desktop code.desktop myfile.sh drawio_drawio.desktop postman_postman.desktop devasc@labvm:~/Documents$ c. Return the file to the Documents folder. devasc@labvm:~/Documents$ mv../Desktop/myfile.sh myfile.sh devasc@labvm:~/Documents$ d. Use the command mv to rename myfile.sh to myfile_renamed.sh. devasc@labvm:~/Documents$ mv myfile.sh myfile_renamed.sh devasc@labvm:~/Documents$ ls myfile_renamed.sh devasc@labvm:~/Documents$ Step 4: Use the copy files command. a. Use the command cp to make a copy of the myfile_renamed.sh file. devasc@labvm:~/Documents$ cp myfile_renamed.sh myfile_renamed_and_copied.sh © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 6 of 15 www.netacad.com Lab - Linux Review devasc@labvm:~/Documents$ ls myfile_renamed_and_copied.sh myfile_renamed.sh devasc@labvm:~/Documents$ Step 5: Use the remove files command. Use the rm command to remove the myfile_renamed_and_copied.sh file. devasc@labvm:~/Documents$ rm myfile_renamed_and_copied.sh devasc@labvm:~/Documents$ ls mbr.img myfile_renamed.sh devasc@labvm:~/Documents$ Step 6: Use the standard output redirect. a. Use the redirect (>) to place text into a new file called linux.txt. devasc@labvm:~$ echo "Linux is AWESOME!" > linux.txt devasc@labvm:~$ b. Use the command cat to redirect the contents of linux.txt to another file. devasc@labvm:~$ cat linux.txt > linux2.txt devasc@labvm:~$ c. Use the command cat to view the contents of linux2.txt. devasc@labvm:~$ cat linux2.txt Linux is AWESOME! devasc@labvm:~$ d. Use the echo command to append text to the linux2.txt file. devasc@labvm:~$ echo "I LOVE Linux!" >> linux2.txt devasc@labvm:~$ e. Use the cat command to view the contents of the linux2.txt file. devasc@labvm:~$ cat linux2.txt Linux is AWESOME! I LOVE Linux! devasc@labvm:~$ f. Use the echo command to overwrite the contents of a file using the single angle bracket. devasc@labvm:~$ echo "Linux is POWERFUL!" > linux.txt devasc@labvm:~$ g. Use the cat command to view the contents of the linux.txt file. Notice that the previous state “Linux is AWESOME!” was overwritten. devasc@labvm:~$ cat linux.txt Linux is POWERFUL! devasc@labvm:~$ Step 7: Use the vi text editor. a. Use the following command to start the vi text editor and open a text file. devasc@labvm:~$ vi linux2.txt © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 7 of 15 www.netacad.com Lab - Linux Review The following content is shown in the editor window: Linux is AWESOME! I LOVE Linux! b. Use the text editor to change the content to the following: Linux is Linux I am AWESOME! The a key will allow you to enter edit mode, appending after the cursor’s position, while the i key will allow you to enter edit mode, inserting at the cursor’s position. You will need to use the Esc key to enter command mode to move around. Remember that d will delete (cut), y will yank (copy), and p will put (paste) the current line with the cursor. c. Save the text to a new file called "linux3.txt". Remember that you will need to be in the command mode and type a colon ( : ) to enter ex mode so that you can write (save) the document ( :w linux3.txt). You can then use the quit (exit) command ( :q) to exit the vi editor. d. Use the cat command to view the contents of the linux3.txt file. devasc@labvm:~$ cat linux3.txt Linux is Linux I am AWESOME! devasc@labvm:~$ Part 4: Review Regular Expressions In this part, you use the grep command to review how you can use regular expressions for filtering. Note: Your output may differ than the output shown below as the state of the VM is based on the most recent iteration that you downloaded as well as any changes you may have made. However, you should get some output from the passwd file but your highlighted output will differ. a. Use the grep command to filter the contents of the passwd file to display the line from the passwd file containing devasc. Notice that the two instances of devasc are highlighted. Also notice that the grep command is case-sensitive. The instance of DEVASC is not highlighted. devasc@labvm:~$ grep devasc /etc/passwd devasc:x:900:900:DEVASC,,,:/home/devasc:/bin/bash devasc@labvm:~$ b. Use the grep command to show how many times root appears in the passwd file. Notice that all three instances of root are highlighted. devasc@labvm:~$ grep root /etc/passwd root:x:0:0:root:/root:/bin/bash devasc@labvm:~$ c. Use the grep command with the anchor character ^ to find the word, but only at the beginning of the line. Notice that only the word at the beginning of the line is highlighted. devasc@labvm:~$ grep '^root' /etc/passwd root:x:0:0:root:/root:/bin/bash devasc@labvm:~$ d. Use the grep command with the anchor character $ to find a word at the end of a line. devasc@labvm:~$ grep 'false$' /etc/passwd tss:x:106:114:TPM software stack,,,:/var/lib/tpm:/bin/false lightdm:x:107:117:Light Display Manager:/var/lib/lightdm:/bin/false hplip:x:115:7:HPLIP system user,,,:/run/hplip:/bin/false © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 8 of 15 www.netacad.com Lab - Linux Review devasc@labvm:~$ e. Use the grep command with the anchor character. to match specific length words with different letters in them. Notice that not only is daem highlighted, but also dnsm is highlighted. devasc@labvm:~$ grep 'd..m' /etc/passwd daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin dnsmasq:x:109:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin avahi-autoipd:x:110:121:Avahi autoip daemon,,,:/var/lib/avahi- autoipd:/usr/sbin/nologin usbmux:x:111:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin avahi:x:113:122:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/usr/sbin/nologin colord:x:116:125:colord colour management daemon,,,:/var/lib/colord:/usr/sbin/nologin pulse:x:117:126:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin devasc@labvm:~$ f. Use the grep command to find lines where only the numbers 8 or 9 are present. Notice that only the lines containing an 8, a 9, or both are returned. devasc@labvm:~$ grep '[8-9]' /etc/passwd mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin uuidd:x:103:109::/run/uuidd:/usr/sbin/nologin devasc:x:900:900:DEVASC,,,:/home/devasc:/bin/bash systemd-network:x:999:999:systemd Network Management:/:/usr/sbin/nologin systemd-resolve:x:998:998:systemd Resolver:/:/usr/sbin/nologin systemd-timesync:x:997:997:systemd Time Synchronization:/:/usr/sbin/nologin systemd-coredump:x:996:996:systemd Core Dumper:/:/usr/sbin/nologin rtkit:x:108:119:RealtimeKit,,,:/proc:/usr/sbin/nologin dnsmasq:x:109:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin devasc@labvm:~$ g. Use the grep command to find literal characters. Notice that only the lines containing a comma are returned. devasc@labvm:~$ grep '[,]' /etc/passwd devasc:x:900:900:DEVASC,,,:/home/devasc:/bin/bash tss:x:106:114:TPM software stack,,,:/var/lib/tpm:/bin/false rtkit:x:108:119:RealtimeKit,,,:/proc:/usr/sbin/nologin dnsmasq:x:109:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin avahi-autoipd:x:110:121:Avahi autoip daemon,,,:/var/lib/avahi- autoipd:/usr/sbin/nologin usbmux:x:111:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin kernoops:x:112:65534:Kernel Oops Tracking Daemon,,,:/:/usr/sbin/nologin avahi:x:113:122:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/usr/sbin/nologin hplip:x:115:7:HPLIP system user,,,:/run/hplip:/bin/false colord:x:116:125:colord colour management daemon,,,:/var/lib/colord:/usr/sbin/nologin pulse:x:117:126:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin devasc@labvm:~$ h. Use the grep command to find occurrences of zero or more of the pattern preceding it. Notice that only the lines with either new and ne are returned. © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 9 of 15 www.netacad.com Lab - Linux Review devasc@labvm:~$ grep 'new*' /etc/passwd news:x:9:9:news:/var/spool/news:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin messagebus:x:100:103::/nonexistent:/usr/sbin/nologin _apt:x:102:65534::/nonexistent:/usr/sbin/nologin tcpdump:x:104:110::/nonexistent:/usr/sbin/nologin systemd-network:x:999:999:systemd Network Management:/:/usr/sbin/nologin kernoops:x:112:65534:Kernel Oops Tracking Daemon,,,:/:/usr/sbin/nologin saned:x:114:124::/var/lib/saned:/usr/sbin/nologin devasc@labvm:~$ Part 5: Review System Administration In this part, you will review basic Linux system administration tasks including shutting down the computer, viewing and testing the network configuration, viewing processes, managing installation packages, updating user passwords, adding content to files, and using text editors. Step 1: Shut down the computer. a. Use the command shutdown now to initiate a shutdown of the OS (and the VM) immediately. You do not have to perform this action as the VM will shut down and you will need to restart it manually. Formats of this time argument can be the word now, a time of day in the format hh:mm or the number of minutes to delay in the format +minutes. devasc@labvm:~$ shutdown now b. Use the command date to check set date of the OS. devasc@labvm:~$ date Fri 17 Apr 2020 08:53:20 PM UTC devasc@labvm:~$ c. Use the command shutdown +1 "Come back soon!" to shut down the OS in 1 minute and display the message "Come back soon!". Be sure to cancel or your VM will shut down. devasc@labvm:~$ shutdown +1 "Come back soon!" Shutdown scheduled for Fri 2020-04-17 20:57:13 UTC, use 'shutdown -c' to cancel. devasc@labvm:~$ shutdown -c devasc@labvm:~$ Step 2: View and test the network configuration. a. Use the ip address command to display the network configuration. The output is a bit more detailed. For example, notice that five IPv4 addresses are shown for the dummy0 interface. devasc@labvm:~$ ip address 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp0s3: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:ce:2b:8b brd ff:ff:ff:ff:ff:ff © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 10 of 15 www.netacad.com Lab - Linux Review inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3 valid_lft 75746sec preferred_lft 75746sec inet6 fe80::a00:27ff:fece:2b8b/64 scope link valid_lft forever preferred_lft forever 3: dummy0: mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 link/ether 46:8b:41:b5:de:aa brd ff:ff:ff:ff:ff:ff inet 192.0.2.1/32 scope global dummy0 valid_lft forever preferred_lft forever inet 192.0.2.2/32 scope global dummy0 valid_lft forever preferred_lft forever inet 192.0.2.3/32 scope global dummy0 valid_lft forever preferred_lft forever inet 192.0.2.4/32 scope global dummy0 valid_lft forever preferred_lft forever inet 192.0.2.5/32 scope global dummy0 valid_lft forever preferred_lft forever inet6 fe80::448b:41ff:feb5:deaa/64 scope link valid_lft forever preferred_lft forever devasc@labvm:~$ b. Use the command ping with the options -c 4 to ping a computer on your local network four times. You must use a valid IP address of a device on your local network. The following example is using 192.168.1.1, but your network will most likely have different IPv4 addresses. devasc@labvm:~$ ping -c 4 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=63 time=1.13 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=63 time=2.30 ms 64 bytes from 192.168.1.1: icmp_seq=3 ttl=63 time=1.31 ms 64 bytes from 192.168.1.1: icmp_seq=4 ttl=63 time=2.49 ms --- 192.168.1.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3005ms rtt min/avg/max/mdev = 1.130/1.809/2.492/0.594 ms devasc@labvm:~$ c. You can also ping a name and Domain Name System (DNS) will resolve the name to an IP address. For example, ping Cisco’s website. Your VM will send out a DNS request first to get the IP address and then send the ping packets. The DNS process is not shown in the ping output. devasc@labvm:~$ ping -c 4 www.cisco.com PING e2867.dsca.akamaiedge.net (23.204.11.200) 56(84) bytes of data. 64 bytes from a23-204-11-200.deploy.static.akamaitechnologies.com (23.204.11.200): icmp_seq=1 ttl=58 time=185 ms 64 bytes from a23-204-11-200.deploy.static.akamaitechnologies.com (23.204.11.200): icmp_seq=2 ttl=58 time=28.8 ms 64 bytes from a23-204-11-200.deploy.static.akamaitechnologies.com (23.204.11.200): icmp_seq=3 ttl=58 time=28.8 ms 64 bytes from a23-204-11-200.deploy.static.akamaitechnologies.com (23.204.11.200): icmp_seq=4 ttl=58 time=26.4 ms --- e2867.dsca.akamaiedge.net ping statistics --- © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 11 of 15 www.netacad.com Lab - Linux Review 4 packets transmitted, 4 received, 0% packet loss, time 3007ms rtt min/avg/max/mdev = 26.443/67.339/185.363/68.147 ms devasc@labvm:~$ Step 3: View Processes a. Use the ps command to display the processes that are running in the current terminal. devasc@labvm:~$ ps PID TTY TIME CMD 1416 pts/0 00:00:00 bash 1453 pts/0 00:00:00 ps devasc@labvm:~$ b. Use the ps with the -e option to display all the processes that are running on the computer. devasc@labvm:~$ ps -e PID TTY TIME CMD 1 ? 00:00:01 systemd 2 ? 00:00:00 kthreadd 3 ? 00:00:00 rcu_gp 4 ? 00:00:00 rcu_par_gp 6 ? 00:00:00 kworker/0:0H-kblockd 7 ? 00:00:00 kworker/0:1-events 9 ? 00:00:00 mm_percpu_wq (output omitted) c. You can pipe any command output to one screen at a time by adding | more. One screen of output displays with the --more-- shown at the bottom. You can now use the Enter key to display one line at a time, the space bar to display one screen at a time, or Ctrl+C to exit and return to the command prompt. devasc@labvm:~$ ps -e | more PID TTY TIME CMD 1 ? 00:00:01 systemd 2 ? 00:00:00 kthreadd 3 ? 00:00:00 rcu_gp 4 ? 00:00:00 rcu_par_gp 6 ? 00:00:00 kworker/0:0H-kblockd 9 ? 00:00:00 mm_percpu_wq 10 ? 00:00:00 ksoftirqd/0 --More-- d. Use the ps with the -ef option to display all the processes that are running on the computer with more detail. devasc@labvm:~$ ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 20:57 ? 00:00:01 /sbin/init root 2 0 0 20:57 ? 00:00:00 [kthreadd] root 3 2 0 20:57 ? 00:00:00 [rcu_gp] root 4 2 0 20:57 ? 00:00:00 [rcu_par_gp] root 6 2 0 20:57 ? 00:00:00 [kworker/0:0H-kblockd] root 9 2 0 20:57 ? 00:00:00 [mm_percpu_wq] root 10 2 0 20:57 ? 00:00:00 [ksoftirqd/0] root 11 2 0 20:57 ? 00:00:01 [rcu_sched] © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 12 of 15 www.netacad.com Lab - Linux Review (output omitted) Step 4: Manage packages. a. Use the command apt-get update to refresh the list of available packages in the OS, as shown previously in Part 1 of this lab. You must use administrative level permissions to use this command. devasc@labvm:~$ sudo apt-get update Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease Get:2 http://us.archive.ubuntu.com/ubuntu focal InRelease [265 kB] Hit:3 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease Hit:4 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease Get:5 http://us.archive.ubuntu.com/ubuntu focal/main i386 Packages [721 kB] Get:6 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages [974 kB] Get:7 http://us.archive.ubuntu.com/ubuntu focal/main Translation-en [506 kB] (output omitted) b. Use the command apt-cache search to find a specific package. devasc@labvm:~$ apt-cache search speed test (output omitted) smalt-examples - Sequence Mapping and Alignment Tool (examples) speedtest-cli - Command line interface for testing internet bandwidth using speedtest.net sup - Software Upgrade Protocol implementation sysbench - multi-threaded benchmark tool for database systems tcpreplay - Tool to replay saved tcpdump files at arbitrary speeds (output omitted) c. Use the command apt-get install to install a package. devasc@labvm:~$ sudo apt-get install speedtest-cli Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: speedtest-cli 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 23.9 kB of archives. After this operation, 106 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 speedtest-cli all 2.1.2-2 [23.9 kB] Fetched 23.9 kB in 1s (43.9 kB/s) Selecting previously unselected package speedtest-cli. (output omitted) d. Now you can use the speedtest-cli command to test your current Internet connection speed. devasc@labvm:~$ speedtest-cli Retrieving speedtest.net configuration... Testing from Cable Company (192.168.100.21)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by Comcast (Albuquerque, NM) [494.76 km]: 48.636 ms Testing download speed................................................................................ © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 13 of 15 www.netacad.com Lab - Linux Review Download: 90.87 Mbit/s Testing upload speed...................................................................................................... Upload: 17.87 Mbit/s devasc@labvm:~$ e. Use the command apt-get upgrade to update all packages and dependencies on the computer. devasc@labvm:~$ sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages have been kept back: libnss-systemd libpam-systemd libsystemd0 libyelp0 linux-generic linux-headers- generic (output omitted) f. Use the command apt-get purge to completely remove a package from the computer. devasc@labvm:~$ sudo apt-get purge speedtest-cli Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: speedtest-cli* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 106 kB disk space will be freed. Do you want to continue? [Y/n] (Reading database... 211937 files and directories currently installed.) Removing speedtest-cli (2.1.2-2)... (output omitted) Step 5: Update Passwords a. Use the command passwd to update your password. Note: If you actually change the password for your devasc user, make sure you remember it. devasc@labvm:~$ passwd Changing password for devasc. Current password: New password: Retype new password: passwd: password updated successfully devasc@labvm:~$ b. Use the command passwd with the option -S to view the status of your password. devasc@labvm:~$ passwd -S devasc P 04/17/2020 0 99999 7 -1 devasc@labvm:~$ c. Use the manual pages for the passwd command (man passwd) to research the -S option and find the answer the following questions. © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 14 of 15 www.netacad.com Lab - Linux Review Questions What is the current status of the password? Type your answers here. What is the minimum number of days that must pass before the password can be changed? Type your answers here. What is the number of days after password expiration that the account remains active? Type your answers here. End of document © 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 15 of 15 www.netacad.com

Use Quizgecko on...
Browser
Browser