btop is a highly customizable, real-time system
monitor tool that provides users with an intuitive and visually
appealing interface to monitor system resources.
Developed by Aristocratos, btop is written in C++ and aims to provide a more modern alternative to traditional resource monitors like htop, glances, or bashtop (its predecessor).
It offers a comprehensive overview (insights) of your system’s
performance that includes CPU usage, memory consumption, disk activity,
network bandwidth, and processes running on your system.
Key Features of btop
It displays live updates of various system metrics such as CPU load,
memory usage, disk I/O, and network traffic, which makes it ideal for
diagnosing performance bottlenecks or keeping track of resource
utilization during intensive tasks.
The interface is fully interactive and customizable, where users can
rearrange panels, change color schemes, and configure what information
is displayed based on their preferences.
In addition to monitoring, btop allows users to
manage processes directly from its interface, where you can kill, renice
(change priority), or inspect individual processes without needing to
switch to another terminal window.
One of btop’s standout features is its graphical representation of
data trends over time. For example, CPU usage, memory allocation, and
network throughput are shown using dynamic graphs, making it easier to
spot patterns or anomalies.
Users can choose from multiple built-in themes or create their own
custom color schemes to personalize the appearance of the dashboard.
git clone https://github.com/aristocratos/btop.git
cd btop
make
sudo make install
How to Use btop in Linux
Once installed, simply run the following command in your terminal to launch btop.
btop
Upon starting, you’ll see a clean, tabbed interface divided into
sections for CPU, memory, disks, networks, and processes. Navigation is
done using arrow keys, and actions like killing processes or changing
settings can be performed interactively within the UI.
btop – System Monitoring Tool
When you press Esc or q, instead of quitting immediately, btop brings up an exit menu with three options:
Options : Opens the settings menu where you can customize the interface, adjust colors, and configure other preferences.
Help : Displays the help section, which includes keybindings and additional information about how to use btop effectively.
Quit : Exits btop entirely.
Quit btop Toolbtop Settings Menubtop Help Section
Comparison with Other Tools
While there are many system monitoring tools available, btop stands out due to its balance of aesthetics, efficiency, and ease of use.
Here’s how it compares to similar tools:
btop – Comparison with Other Tools
Conclusion
btop is a versatile and efficient system monitoring tool that combines functionality with a user-friendly design.
Its ability to present complex system data in an easy-to-understand
format, coupled with its lightweight nature, makes it an excellent
choice for developers, system administrators, and power users alike.
With active development and community contributions, btop continues to evolve and improve, solidifying its position as one of the top system monitoring solutions available today.
Top Linux Networking Commands and Troubleshooting Tips
When
I first started working with Linux networking, I was amazed by its
powerful command-line tools. With just a few commands, I could
configure, manage, and troubleshoot network connections effortlessly.
This allows me to easily maintain system stability, monitor traffic, and
ensure seamless communication. In this article, I’ll explore some of
the most important Linux networking commands every administrator should
know.
Basic Network Connectivity Commands
When dealing with computer networks, it’s important to diagnose
connectivity problems and understand how data moves through the network.
Luckily, a few simple commands can help us troubleshoot and gather key
information quickly.
1. Ping command
If you want to check if a website or server is accessible, just use the ping command in your terminal. It sends ICMP echo request packets to the destination and shows response times if it’s reachable.
For example, use the command:
ping google.com
to check the network connectivity to Google’s servers:
It’s a quick way to check network connectivity, but keep in mind that
some servers block ICMP requests, so no response doesn’t always mean
the server is down.
2. Traceroute command
The traceroute command in Linux
shows the path a packet takes to reach its destination. It lists each
hop along the way. By default, it traces up to 30 hops with a packet
size of 60 bytes for IPv4 and 80 bytes for IPv6. The traceroute command is often used to identify slow or failing links in the path:
3. Tracepath command
The tracepath command works like traceroute but is
simpler and doesn’t need superuser privileges. It auto-detects the
Maximum Transmission Unit (MTU) and spots packet size issues that could
lead to fragmentation or transmission failures.
For example, the command tracepath google.com traces packet routes, shows each hop, and detects network issues like latency, packet loss, and MTU size problems:
4. Nslookup command
The nslookup command is a network utility for querying
Domain Name System (DNS) servers. It retrieves information about domain
names, IP addresses, and other DNS records. It checks if a website’s
address is correct and finds issues with DNS settings.
For example, the nslookup google.com command queries the
DNS server to find the IP address of google.com. It checks if the
domain resolves correctly and can be useful for troubleshooting DNS
issues:
Network Configuration and Interface Management Commands
Managing network interfaces and settings is a key task for anyone
working with Linux. There are plenty of commands to help, from modern
tools like ip, nmcli, and ethtool to the older, now-deprecated ifconfig for legacy systems. These commands make it easy to configure and troubleshoot network connections.
5. ip command
The ip command is a common unified networking tool for
managing network interfaces in modern Linux distributions. It replaces
the older ifconfig and route commands and provides a unified way to manage IP addresses, routes, and interfaces.
For example, we can run the ip a or ip addr show command to get all network interfaces along with assigned IP addresses:
Similarly, we can use the ip command
to assign or remove an IP address from an interface, enable or disable a
network interface, display a routing table, and add or remove a route.
6. Ifconfig command
The ifconfig command was once used to manage network interfaces but is now mostly replaced by ip. However, some older Linux versions still support it. With ifconfig
command, you can check active network interfaces, assign an IP address,
bring an interface up or down, and change the MAC address of an
interface.
For example, running ifconfig without any flag returns the active network interfaces along with their configurations:
7. Nmcli command
The nmcli command manages network connections using
NetworkManager. It’s especially useful for Linux systems with a
graphical interface that depends on NetworkManager. Using this command,
we can list available network connections, display network interfaces,
connect to a Wi-Fi network, assign a static IP address, and restart the
NetworkManager service.
For example, the nmcli device status command returns the list of available network connections:
8. Ethtool command
Need to check or modify your network card settings? That’s where ethtool comes in. It lets you view and adjust settings like speed, duplex mode, and driver details.
For example, the ethtool enp0s3 command shows the Ethernet device information:
9. Checking Network Routes and ARP Tables
Ever wondered how your system knows where to send network traffic?
That’s where network routes and ARP tables come in. They help
troubleshoot connectivity issues, optimize performance, and manage
routing.
In Linux, we can check routes with route and ip route commands. The route command was traditionally used to display and manipulate the kernel’s IP routing table. However, it has been replaced by ip route command:
Also, we can view connected devices using arp or ip neigh command. The arp command shows the system’s ARP table, which maps IP addresses to MAC addresses on the local network. The ip neigh
command provides similar details but is a modern alternative. It
supports both IPv4 and IPv6 and lists neighbor entries used for address
resolution and communication:
Monitoring Network Traffic and Performance
Monitoring network traffic helps fix connection issues, track
bandwidth use, and keep the network secure. For this purpose, Linux
offers tools like netstat, ss, tcpdump, and iftop. Some check open connections, while others capture live network data.
10. Netstat command
The netstat command shows network connections, open ports, and routing details. While ss has replaced it, some older systems still use netstat.
You can simply type netstat to get details about network connections, listening ports, and routing information:
Additionally, we can use options like -tulnp to show listening ports with process names, or -r to display routing tables.
11. SS command
The ss (socket statistics) command provides detailed information about sockets (connections). It is faster than netstat
command. It is used to show active TCP connections, listening ports,
processes using network connections, UDP connections, and connections to
a specific port.
For example, ss -ant command returns active TCP connections:
12. Tcpdump command
The tcpdump command captures and analyzes network packets in real time. It is useful for diagnosing network issues and security monitoring.
For example, the sudo tcpdump -i enp0s3 command captures all packets on the enp0s3 interface:
Secure Network Configurations
To secure your Linux network, disable unused interfaces and services, set up strong firewall rules with iptables or nftables, and use SELinux or AppArmor for extra protection. Encrypt traffic with VPNs, SSH, or TLS, and keep your system updated. Control access with hosts.allow and hosts.deny, secure SSH by disabling root login and using key-based authentication, and monitor activity with netstat, ss, or tcpdump. Finally, enforce strong passwords and use Fail2Ban to prevent unauthorized access.
You can also monitor suspicious network activity in Linux using ss or netstat for unusual connections, and tcpdump
for packet analysis. Enable firewall logging, check system logs
(/var/log/syslog and /var/log/auth.log), and use fail2ban to block
unauthorized access. Deploy IDS tools like Snort or Suricata for
real-time threat detection.
Don’t hesitate to experiment and troubleshoot issues. That’s the best way to learn and improve your skills.
How to Expose Localhost to the Internet Using Bore
Bore is a free and open-source command-line utility written in Rust that aims to allow users to expose a local port to the internet without needing port forwarding.
The default bore.pub
address will be given with a dynamic port number referring to your
local port, but you can request a specific static port number only if
it's available.
The best way I find to use Bore is to use the same
command-line tool to self-host your own Bore instance on a VPS or
server, and then assign a domain to that system. Later, you can use that
domain to expose a local port to the internet with any port number you
desire without worrying about port availability.
In
this article, I'll show you how to use and expose localhost to the
internet using Bore with a public instance of the Bore server running at
bore.pub and later learn to setup your own Bore instance in one line of command.
How to Expose Localhost to the Internet Using Bore
1.
The first step is to install the Bore on your system; it's written in
Rust, which allows installation via Cargo (a Rust package manager) or Brew on Linux and macOS.
📝 Note
When you try to install it with Cargo, if a version error occurs, try the same command with the --locked parameter.
Install Bore using Cargo
cargo install bore-cli
Install Bore using Brew
brew install bore-cli
2. Once the installation is complete, you can export a local port to the internet with a bore.pub address. For example, the following command will port forward an 80 Apache port to the internet.
📝 Note
In the following command, the local <port-number> is the local port you want to expose and --to bore.pub is the Bore public instance you want to use.
bore local 80 --to bore.pub
Output:
3. In the previous command, the address with a dynamic port allocated to me is bore.pub:37702, which can be accessed anywhere using any browser as long as the bore command is running.
4. As you've seen, you're assigned to a random port number on the bore.pub instance. However, you can use the -p <port-number> flag to request a desired port number, but only if it's available.
📝 Note
The specified port number should be between 1024-65535.
bore local 80 --to bore.pub -p 8820
Output:
How to Setup Bore Instance on VPS or Server
If
the lack of port availability is annoying you while using the Bore
public instance, you can set up a single self-instance for Bore on your
VPS or server with a single command.
All it takes to install the Bore using the previously mentioned command and then executing the following command:
📝 Note
The -s <secret-key>
is an optional parameter but is recommended to prevent unauthorized
access to your Bore instance via simple secret key authentication.
bore server -s my-secret-key
Output:
Once
the instance is ready, you can use the same system, another system on
the network, or access it from elsewhere to expose your localhost to the
internet by assigning your Bore instance a local IP or global IP (or
domain), depending on the use case.
bore local 80 –-to <local-IP/global-IP/domain> -s my-secret-key
How to Remove Bore
To remove Bore from your system, execute one of the following commands based on the installation method you followed: