Linux Terminal Commands

This exercise complements material in the CompTIA Security+: Get Certified Get Ahead: SY0-501 Study Guide.

You can use this lab to familiarize yourself with some common Linux terminal commands.

Prerequisites. Launch a terminal within a Linux operating system. If you’re not sure how, follow the steps in the study guide to do so.

Note: The purpose of this lab is to give you some experience playing around with the terminal. I strongly encourage you to go beyond these steps though. After entering any of the commands, look at the help and see what else you can do.

1. Enter the following command to observe the output.

ping

Note that when you enter ping without any arguments (such as a hostname or IP address), it is an error and ping displays an error message. Error messages are often helpful, but don’t necessarily give you the same help that you can get by querying with the best switch for help.

2. Enter the following commands and observe the different outputs.

ping –help 

ping -h

ping -?

Note that many Linux commands support at least –help, -h, or -?  to get help.

3. Enter the following command to observe the man page for ping.

man ping

When done, press Q to exit the manual page.

4. Enter the following commands to observe how most terminal commands are case sensitive and will not run if you don’t use the proper case.

ping -6 localhost

PiNg -6 localHOST

PING -6 LocalHost

5. Enter the following command to identify the IP address of your system.

ifconfig eth0

For example, here’s part of the output showing the IP address after inet.

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.190.128 netmask 255.255.255.0 broadcast 192.168.190.255

6. Use the following command to ping your IP address. Use a different IP address if your IP address is different.

ping 192.168.190.128

Press CTRL+C to stop the pings.

7. Use the following command to ping your IP address only four times. Use a different IP address if your IP address is different.

ping -c 4 192.168.190.128

With this command, you don’t need to press CTRL+C to stop the pings. They will automatically stop after sending four pings.

8. Use the following command to see how ping performs name resolution.

ping getcertifiedgetahead.com

Notice that the first line after this command shows the IP address of the domain name.

9. Enter the following command to enable promiscuous mode on your network interface card (NIC).

ifconfig eth0 promisc

ifconfig eth0

Note that the second command shows the status of the NIC. The first line shows flags and it should include PROMISC similar to this:

eth0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500

10. Enter the following command to disable promiscuous mode on your network interface card.

ifconfig eth0 -promisc

ifconfig eth0

Note that the second command shows the status of the NIC. You should see that PROMISC is no longer listed in the flags section.

11. Use the following command to see a listing of all open TCP connections.

netstat

12. Use the following command to see a listing of all open TCP connections in numerical order.

netstat -np tcp

13. Use the following command to observe the ARP cache

arp -a

14. Use the following command to close the terminal.

exit

15. Open another instance of the terminal. Enter the following command to reboot the Linux system.

shutdown -r

Notice that the shutdown is scheduled to occur in one minute.

Back to SY0-501 Security+ labs.

 

error: