Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views4 pages

Assignment Week1

linux

Uploaded by

ntisameh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Assignment Week1

linux

Uploaded by

ntisameh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

-Assignment 1

Linux is the foundation of many DevOps tools and cloud infrastructure.


Understanding Linux commands, networking concepts, and configuration is crucial.

Theory Questions (10 points)


a) Linux Commands
• Describe the following commands and give practical scenarios for their
usage:
o ls, chmod, ps, grep, df, ip addr, ping, netstat.
(Example: How would you use ps to find all processes owned by a
specific user?)
ls: it lists all the file & directories on the current working directory
Example for ls (ls -ltr) : ls -ltr is used for viewing files in a directory sorted by
when they were last changed, could also find the oldest or most recent files easily.
Chmod: it Changes file permissions.
Example for chmod (chmod+x): chmod+x add execution for the given file for the
current user & groups and others; for example rwx,r-x,--x
ps: Displays active processes.
Example for ps: ps -u sameh lists all processes owned by user sameh.
grep: Searches for patterns in files or output.
Example for grep: grep -i “sameh”
searches case-insensitively for the word "sameh" in the access log
file.
df: Shows disk space usage.
Example for df: df -h gives human-readable disk usage info.
Ip addr: Shows IP addresses and interface details.
Example for ip addr: ip addr show eth0 displays info about
the eth0 interface (network using wire).
ping: Sends a number of packets to check network connectivity.
Example for ping : ping google.com checks if the system can
reach the internet.
netstat: Displays network connections and routing tables.
Example for netstat: netstat -tuln shows all listening
TCP/UDP ports.

b) File System and Permissions


• Explain the Linux file system hierarchy. What is the purpose of directories
like /etc, /usr, /var, and /dev?

Linux File System Hierarchy

/etc: Configuration files for the system (e.g., /etc/passwd,


/etc/ssh/ssh_config).
/usr: User-installed software and shared libraries (e.g., /usr/bin,
/usr/lib).
/var: Variable files like logs, mail, print spoolers (e.g., /var/log/syslog).
/dev: Device files representing hardware (e.g., /dev/sda for a disk).

• How do file permissions work in Linux? Describe the permission types and
what the output rwxr-xr-- means for a file.

Linux file permissions follow the format:


rwxr-xr-- (10 characters: 1 file type + 9 permission bits)

• First character: File type (e.g., - = file, d = directory)


• Next 9 characters: Permissions for:
o User (owner): rwx → read, write, execute
o Group: r-x → read, no write, execute
o Others: r-- → read only

Example: rwxr-xr--

• Owner can read, write, execute


• Group can read and execute
• Others can only read

c) Linux Networking Concepts


• Compare TCP and UDP. When would each protocol be more appropriate?
Feature TCP UDP
Connection Connection-oriented Connectionless
Reliable (ensures delivery, Unreliable (no guarantee of delivery or
Reliability
order) order)

Slower due to overhead


Speed Faster, minimal overhead
(Handshaking)

Web (HTTP/HTTPS), Email


Use Cases Video streaming, VoIP, DNS, gaming
(SMTP), SSH

When to Use:

Use TCP for applications where data integrity and order are critical.
Use UDP for speed-critical apps where occasional data loss is acceptable.

• What is the role of DNS in networking? Explain how DNS resolution works in
Linux (e.g., with the dig command).
DNS and DNS Resolution

Role of DNS: Translates human-readable domain names (like google.com)


into IP addresses.
DNS Resolution in Linux:
User runs dig google.com.
Linux queries /etc/resolv.conf for DNS server IP.
The DNS server resolves the domain and returns the IP address.

Example with dig:

dig google.com

Returns DNS query result including:


• ANSWER SECTION: shows resolved IP address.
• QUERY TIME: time taken for resolution.

You might also like