Marcio Cunha

Practical Guide to Linux Commands, Network Protocols, Diagnostics and System Administration

Explore essential Linux utilities, core network protocols, HTTP status codes, privilege control, and routine automation tasks with deep technical precision and practical examples.

Marcio Cunha14 min
Also available in:EspañolPortuguês
Summary
  • The groups command identifies all primary and secondary groups associated with a user account for access management.
  • HTTP status code 415 indicates that the server refused the payload because the media format is unsupported by the API.
  • Port 21 handles traditional FTP authentication, transmitting credentials in plain text and requiring operational caution.
  • Load Average reflects the average number of processes actively using or waiting for CPU and disk resources over time.
  • Access Control Lists extend the traditional Unix permission model by enabling granular rules for specific users and groups.

Listing User Groups with the groups Command

In the Linux ecosystem, access control and permissions rely heavily on users and groups. When we need to quickly discover which groups a specific user belongs to, the groups utility stands out as the most direct tool. In practice, running this command without arguments reveals the current user's groups, while passing a username queries the system for another account.

Under the hood, the command reads information from the /etc/passwd and /etc/group files, alongside querying the local authentication subsystem. Knowing how to list and understand these groups is essential for troubleshooting permission failures in applications, web servers, or databases that require restricted access to specific directories.

Understanding the HTTP 415 Unsupported Media Type Status Code

When consuming modern RESTful APIs, encountering unexpected response codes is common. The HTTP status code 415 Unsupported Media Type indicates that the server refused the request because the payload format sent in the message body is not supported by the target resource. In practice, this often happens when sending structured data like JSON without setting the required Content-Type: application/json header.

To resolve this behavior, the HTTP client must align its media type header with what the API expects to receive at that specific endpoint. Ignoring this validation leads to silent failures or immediate rejections, demanding rigorous attention to integration contracts defined in service documentation.

The Fundamental Difference Between su and sudo for Privilege Elevation

Administrative privilege management requires rigor to ensure the security of any infrastructure. The su (Substitute User) command allows switching to another user account, typically the root superuser, requiring the destination account's password. Conversely, the sudo (Superuser DO) command executes a specific command with another user's privileges, usually root, using the current user's own password.

In daily practice, using sudo is heavily preferred in enterprise environments because it maintains a detailed audit log of who executed which command, reducing the risk of sharing the root password among multiple operators and confining risk scope to punctual actions.

Monitoring File Access with the inotifywait Utility

Detecting changes in files and directories in real time is a constant requirement in automation, security, and software development. The inotifywait utility, part of the inotify-tools package, leverages the Linux kernel subsystem to monitor filesystem events without consuming excessive resources through constant polling.

Running commands like inotifywait -m /var/log -e modify,create keeps the system listening and instantly reports any file modification or creation within that directory. This event-driven approach is ideal for triggering backup scripts, dynamically reconfiguring services, or detecting unauthorized access in sensitive areas.

Standard Port 21 and Security Risks of the FTP Protocol

The FTP (File Transfer Protocol) is one of the internet's oldest methods for transferring files between computers. It uses port 21 by default for the control channel, where commands and authentication traffic flow, and port 20 (or ephemeral ports) for the data channel.

The major Achilles' heel of traditional FTP lies in the fact that it encrypts no information. Usernames, passwords, and file contents travel in plain text across the network, allowing any attacker with physical access or network route visibility to easily intercept sensitive credentials. For this reason, modern alternatives like SFTP or FTPS have become the mandatory industry standard.

Checking Negotiated Network Speed with the ethtool Command

Ensuring optimal network infrastructure performance involves validating whether network interface cards are communicating at their maximum supported speed. The ethtool utility allows querying and modifying Ethernet network card settings directly from the Linux command line.

Executing ethtool eth0 displays crucial data such as the negotiated speed (e.g., 1000Mb/s), duplex mode (Full-Duplex), and physical link status. If an interface is stuck at 100Mb/s in a high-capacity environment, the utility helps diagnose hardware failures, damaged cables, or auto-negotiation issues with the switch.

Local and Remote Port Forwarding in SSH Tunnels

SSH (Secure Shell) goes far beyond secure remote command-line access; it is a powerful network tunneling tool. Local port forwarding (parameter -L) allows a port on the client machine to be forwarded to a destination accessible from the remote machine. Conversely, remote forwarding (parameter -R) does the reverse, exposing a local network service through a remote server.

In practice, these capabilities enable access to internal databases restricted by corporate firewalls or expose local applications on development servers for external testing securely and encrypted, without altering permanent perimeter security rules.

Generating Number Sequences and Dates with the seq Utility

Automating repetitive terminal tasks frequently requires creating lists of numbers or sequential ranges. The seq command generates number sequences quickly and efficiently, allowing you to define the starting value, increment, and final value.

A common practical example is building loops in Bash scripts, such as for i in $(seq 1 5); do echo "Step $i"; done. This simplicity eliminates the need to build complex manual counter structures, speeding up the development of testing routines, mass directory creation, or iteration over structured data matrices.

Analyzing the /etc/passwd File and Account Storage

The /etc/passwd file is a core component of user security and structure in a Linux system. Despite its historical name, it no longer stores encrypted user passwords—that responsibility was transferred to the /etc/shadow file for enhanced security.

Each line in the file represents a user account and contains colon-separated fields (:) defining the username, numeric identifier (UID), primary group identifier (GID), full name or description, home directory, and assigned default shell. Understanding this structure is essential for security audits and advanced systems management.

Formatting Terminal Output into Columns with the column Command

The readability of data displayed in the terminal is crucial for efficient systems administration. When executing commands that generate long and disorganized lists, the column utility transforms raw text into clean, aligned tables.

Using the -t option, the command automatically analyzes input text and organizes data into columns based on delimiters such as spaces or commas. Combined with commands like cat /etc/passwd | column -t -s ':', inspecting complex configuration files becomes immediate without suffering from visual misalignment.

Difference Between Lost Packets Due to Collisions and Buffer Saturation

When diagnosing computer network issues, distinguishing the cause of packet loss is vital. Collision loss typically occurs in older hub-based Ethernet networks or incorrect duplex configurations, where two devices transmit data simultaneously, corrupting electrical signals.

On the other hand, packet drops due to buffer saturation happen when incoming traffic rate exceeds the processing capacity or temporary memory (buffer) of the router or network interface. Correctly identifying these scenarios prevents unnecessary hardware replacements and directs effort toward proper traffic queue shaping and link capacity tuning.

Changing System Timezone with the timedatectl Command

Time synchronization and correct timezone configuration are critical pillars for log integrity, financial transactions, and scheduled cron task execution. The modern timedatectl utility allows querying and changing date and time configurations on systemd-based Linux distributions.

Running timedatectl list-timezones lists all available zones, while timedatectl set-timezone Europe/London instantly updates the operating system's timezone. This centralized approach replaces manual symlink manipulation in the /etc/localtime directory, ensuring operational robustness.

The Meaning of HTTP 409 Conflict in Concurrent Operations

In modern web environments where multiple clients interact simultaneously with the same resources, data conflict is a constant challenge. The HTTP status code 409 Conflict indicates that the request could not be processed due to a conflict with the current state of the target resource.

In practice, this frequently occurs during concurrent update operations, such as when two users attempt to modify the same record using outdated data versions. The server rejects the second change to prevent data loss, requiring the client to refresh its local state before trying again.

Exporting Command History for Internal Auditing

Activity auditing on Linux servers requires rigorous traceability of actions executed by administrators. Although the shell maintains history in the HISTFILE variable, configuring export with timestamp logging is essential for incident investigations.

Adding configurations to the global system profile that record the date, time, and user for every executed command turns history into a viable compliance tool. This prevents unauthorized changes from going untracked, ensuring operational transparency in critical production environments.

Differences Between TCP and UDP in Flow Control and Delivery

TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) represent the two fundamental transport philosophies on the internet. TCP is connection-oriented, guaranteeing reliable, ordered, and error-free packet delivery through complex flow control and retransmission mechanisms.

In contrast, UDP is a connectionless protocol with no delivery guarantees. It prioritizes maximum speed and low latency, discarding damaged packets without requesting retransmission. This makes UDP ideal for real-time video streaming, VoIP calls, and online gaming, where dropping a frame is preferable to delaying the entire transmission.

Finding and Deleting Temporary Files Older Than Thirty Days with find

The accumulation of temporary files and old logs consumes precious disk space over time. The find utility is the definitive Linux tool for locating files based on advanced criteria such as name, size, and modification date.

Running a command like find /tmp -type f -mtime +30 -delete immediately locates and removes all files older than thirty days in the temporary directory. Automating this routine through scripts and the task scheduler prevents outages caused by disk space exhaustion without constant manual intervention.

The Load Average indicator displayed by commands like uptime or top represents the average number of processes actively using the CPU or waiting for hardware resources over a specific time interval (1, 5, and 15 minutes).

In practice, a high value does not always indicate real machine overload; it must be compared against the number of available processing cores. If the system has 4 cores and the load average is 3.5, the machine is operating comfortably. However, if it climbs to 12, there is severe resource contention requiring immediate investigation.

Testing Authenticated Emails with the swaks Utility

Validating email server (SMTP) delivery and authentication can be complex without the right tools. The swaks (Swiss Army Knife for SMTP) utility is an extremely versatile command-line tool for testing electronic mail servers.

It allows sending test messages simulating TLS authentication, secure connections, and multiple relay refusal scenarios. With a single command, the administrator can verify if the SMTP server accepts legitimate connections, facilitating troubleshooting for report delivery and system alerts.

Access Control Lists Versus the Traditional Unix Permission Model

The traditional Unix permission model relies on three simple entities: the file owner, the associated group, and other users. While efficient for basic scenarios, it becomes inflexible when granting specific rights to multiple users without sharing the same group.

Access Control Lists (ACLs) resolve this limitation by allowing granular permissions to be associated with additional users and groups independently for each file or directory. This offers unprecedented flexibility in managing access in complex sharing environments.

Checking Kernel Modules and Drivers with lsmod

The Linux kernel operates on a modular architecture, loading device drivers and features only when needed. The lsmod command displays a clean, detailed list of all modules currently loaded into system memory.

Used alongside commands like modprobe and rmmod, lsmod helps diagnose hardware problems, verify whether a network card or storage controller was correctly recognized, and transparently optimize operating system resource consumption.

Conclusion

Unix and Linux system administration requires mastering command-line utilities and deeply understanding fundamental network protocols. Knowing tools like ethtool, inotifywait, and swaks, alongside proper HTTP code analysis and performance metrics, empowers engineers to diagnose and solve complex problems with confidence.

Continuous practice and conscious exploration of underlying concepts ensure more resilient, secure, and efficient infrastructures, prepared to support the operational challenges of daily corporate life and high-demand production environments.