OS LAB RECORD
WEEK -1
1. SWITCHING FROM ROOT TO USE AND USER TO ROOT
Commands:
• User to root: sudo su
• Root to user: exit, Ctrl D
Procedure:
• User -> root
• Enter the command in terminal
• Enter the password
• The $ sign is changed to # so user has been changed to # so user has been changed to root
Theory:
• sudo: It is a command in Unix-like systems (like Ubuntu) that allows a permitted user to
execute a command with root (superuser) privileges.
• su: The su command stands for "substitute user" (or sometimes "switch user"). It allows you
to switch from your current user to another user, typically the root user, in a Unix-like
system.
• 2.) CREATING A DIRECTORY
Commands:
• mkdir 23261A3257
Procedure:
• Enter the command in terminal
• Syntax : mkdir directoryname
Theory:
• mkdir: stands for "make directory". It is a command used in Unix-like operating systems to
create new directories (folders) in the file system.
Options:
3.) CREATING A FILE
Commands:
• touch <filename>
• cat <filename>
Procedure:
• Enter the command in terminal
• Press enter
Theory:
• touch: The touch command in Unix-like systems is used to create an empty file or update the
timestamp of an existing file.
• cat: The cat command stands for "concatenate". It is used in Unix-like systems to display the
contents of a file, combine multiple files, or create new files.
Options:
4.) CREATING A GROUP
Commands:
• sudo adduser <username>
Procedure:
• Enter the command in terminal
• Press enter
Theory:
• sudo: It is a command in Unix-like systems (like Ubuntu) that allows a permitted user to
execute a command with root (superuser) privileges
• adduser: The adduser command in Unix-like systems (such as Ubuntu) is used to create a
new user on the system.
Options:
Week - 2
Network communication commands
1. Check Network Configuration
Commands:
• INSTALL PACKAGE BY USING apt install net-tools
Procedure:
• User -> root
• Enter the command in terminal
Theory:
• checking a network involves verifying connectivity between devices using tools like
ping and traceroute.
2. ip a
Commands:
• ip
Procedure:
• User -> root
• Enter the command in terminal
Theory:
• Shows IP addresses of all network interfaces (replacement for ifconfig).
Here are some list of options for ip:-
When used ip a:-
Commands:
• Ip a
Procedure:
• User -> root
• Enter the command in terminal
Theory:
• Displays detailed information about IP addresses and their associated network
interfaces.
3. ip link show
Theory:
• Lists available network interfaces.
4. hostname -I
Theory:
• Displays the IP address of the machine.
2. Check Connectivity
5. ping <hostname/IP>
Theory:
• Sends ICMP echo requests to test connectivity.
Ex: ping [Link]
6. traceroute <hostname/IP>
Commands:
• apt install traceroute
• traceroute <hostname/IP>
–Ex: traceroute [Link]
Procedure:
• install package using apt install traceroute
• run the command
theory:
• Shows the path packets take to reach a destination.
7. mtr <hostname/IP>
Commands:
• apt install mtr
• mtr <hostname/IP>
-Ex: mtr [Link]
Procedure:
• Install package using apt install mtr
• Run command
Theory:
• A real-time combination of ping and traceroute (install required).
3. DNS and Name Resolution
8. nslookup <domain>
Commands:
• apt install bind9-dnsutils
• nslookup <domain>
Ex: nslookup [Link]
Procedure:
• Install the package apt install bind9-dnsutil
• Run the command
Theory:
• Queries DNS servers for domain information.
9. dig <domain>
Commands:
• dig <domain>
Ex: dig [Link]
Procedure:
• run the command
Theory:
• Fetches detailed DNS information (better alternative to nslookup).
10. host <domain>
Commands:
• host <domain>
Ex: host [Link]
Procedure:
• Run the command
Theory:
• Simple DNS lookup for an IP address.
4. Check Open Ports and Services
11. netstat -tulnp – Lists active network connections and open ports (deprecated).
12. ss -tulnp – Replacement for netstat, shows listening sockets.
13. lsof -i :<port> – Displays processes using a specific port.
Ex: lsof -i :80
14. nc -zv <IP> <port> – Checks if a port is open on a remote server.
Ex: nc -zv [Link] 443
5. Network Traffic Monitoring
15. tcpdump -i eth0 – Captures and analyzes network traffic on interface eth0.
Install using apt install tcpdump
16. iftop – Monitors real-time network bandwidth usage (install required).
Install using apt install iftop
17. nload – Displays real-time incoming and outgoing network traffic.
Install using apt install nload
6. Network Diagnostics & Configuration
18. ip route show – Displays the system's routing table.
19. route -n – Shows routing information.
20. nmcli device status – Lists network devices and their states.
21. systemctl restart NetworkManager – Restarts the network service.