This article is inspired by our LinuxCommunity.io forum discussion thread (thanks to users @tmick and @shybry747 for the feedback).
Normal view
Docker Alternative: Podman on Linux
OpenTofu Introduces Ephemeral Support for Safer Secrets Management
![]()
Ubuntu to Explore Rust-Based βuutilsβ as Potential GNU Core Utilities Replacement
In a move that has sparked significant discussion within the Ubuntu Linux fan-base and community, Canonical, the company behind Ubuntu, has announced its intention to explore the potential replacement of GNU Core Utilities with the Rust-based "uutils" project. They plan to introduce new changes in Ubuntu Linux 25.10, eventually changing it to Ubuntu version 26.04 LTS release in 2026 as Ubuntu is testing Rust 'uutils' to overhaul its core utilities potentially. Let us find out the pros and cons and what this means for you as an Ubuntu Linux user, IT pro, or developer.
Love this? sudo share_on: Twitter - Facebook - LinkedIn - Whatsapp - Reddit
The post Ubuntu to Explore Rust-Based βuutilsβ as Potential GNU Core Utilities Replacement appeared first on nixCraft.
lnav β Awesome terminal log file viewer for Linux and Unix
It is no secret that whether you are a developer or sysadmin, you need to use log files to troubleshoot errors on your Linux and Unix systems. You use tools like grep, tail, cat, or journalctl to view log files. However, you may need help with so many log files. These essential Unix tools are suitable for basic text but fall short when dealing with many log files. You can get tired from sifting through endless lines of log files. The lnav utility is here to the rescue! It is a powerful log file viewer that goes beyond the basics. It understands your logs by identifying timestamps, log levels, and other vital details. You can run SQLite SQL queries against your standard log files and build reports for your needs. Let us see how to install and use the lnav tool quickly.
Love this? sudo share_on: Twitter - Facebook - LinkedIn - Whatsapp - Reddit
The post lnav β Awesome terminal log file viewer for Linux and Unix appeared first on nixCraft.
Setting up VSCode for Ansible Lightspeed AI in Ubuntu 22.04 desktop
Red Hat launched the Ansible Lightspeed Code Assistant Generative AI with IBM Watson Code Assistant in May 2023. This preview is now available to all Ansible users, allowing them to explore the technology, provide feedback to Red Hat, and further train the AI model. In this brief blog post, I will share my personal experience with installing and utilizing Ansible Lightspeed AI to create playbooks in VSCode using Ubuntu Linux 20.04 LTS desktop.
Love this? sudo share_on: Twitter - Facebook - LinkedIn - Whatsapp - Reddit
The post Setting up VSCode for Ansible Lightspeed AI in Ubuntu 22.04 desktop appeared first on nixCraft.
How to Install RabbitMQ Server on Linux (Quick Guide)
RabbitMQ is a free and open-source message-broker program used for real-time communication between users in chat applications, supporting protocols such as STOMP, MQTT, AMQP, HTTP, WebSocket, and RabbitMQ Streams.
Its functionality might remind you of Apache Kafka, but the difference is that RabbitMQ prioritizes end-to-end message delivery, while Kafka is a distributed event streaming platform designed for the real-time exchange of continuous big data.
In this tutorial, youβll learn how to install and configure the RabbitMQ server on major Linux distributions, create an administrator account, set up the management dashboard, and access it via a browser.
How to Install RabbitMQ Server on Linux
There are two ways to install RabbitMQ Server on Linux: either through the default package manager (as itβs available in most Linux repositories) or using the Cloudsmith Mirror, a third-party repository that guarantees the latest version.
You can choose the one that is best suited to you and your work environment. For beginners, I suggest starting with the default package manager, as itβs the easiest and most straightforward to follow.
Method 1: Install RabbitMQ Server via Package Manager
The RabbitMQ server package is available for several popular Linux distributions, such as Debian, Ubuntu, Red Hat, and Fedora. Users of these systems can directly install the stable version using the systemβs default package manager.
# On Debian, Ubuntu, Linux Mint, or Kali Linux
$ sudo apt install rabbitmq-server
# On Red Hat, Fedora, CentOS, or AlmaLinux
$ sudo dnf install rabbitmq-server
Method 2: Install RabbitMQ Server via Cloudsmith Mirror
Cloudsmith Mirror is a third-party repository officially provided by RabbitMQ to deliver the latest RabbitMQ server package to users ahead of its availability in the Linux repository.
To add the Cloudsmith Mirror for the RabbitMQ server package on Debian, Ubuntu, Linux Mint, and other related distributions, run:
$ curl -1sLf 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/setup.deb.sh' | sudo -E bash
For Red Hat, Fedora, CentOS, and other related distributions, run:
$ curl -1sLf 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/setup.rpm.sh' | sudo -E bash
After adding the repository, you can proceed to install the latest version of RabbitMQ Server using the default package manager.
# On Debian, Ubuntu, Linux Mint, or Kali Linux
$ sudo apt install rabbitmq-server
# On Red Hat, Fedora, CentOS, or AlmaLinux
$ sudo dnf install rabbitmq-server
Manage RabbitMQ Server Service
Once the RabbitMQ Server installation is complete, make sure to check that the RabbitMQ service created during installation is enabled and active by running the following commands:
$ systemctl is-enabled rabbitmq-server
$ systemctl status rabbitmq-server
Output:

As you can see, itβs enabled and active in my case. If itβs not for you, make sure to enable and start the service in the background using the following command:
$ sudo systemctl enable --now rabbitmq-server
Output:

Troubleshoot
If you encounter a service failure when starting the services, ensure that the default 5672 port used by the RabbitMQ Server is not occupied by another service by using the ss command:
$ sudo ss -tulpn | grep 5672
Output:

In the above output, the βbeam.smpβ process is managed by RabbitMQ Server, so the issue is not with it. However, if another user or service is utilizing the port, make sure to close the service by its port number or service name.
Configure the RabbitMQ Server
To configure the RabbitMQ server with the hostname and network settings. We need to adjust the parameters in the βrabbitmq-env.confβ file. This configuration file is used to set global environment variables for RabbitMQ, like node names, directory locations, runtime flags, etc.
Our main motivation for editing this file is to configure it with our hostname and internal network (DO NOT EXPOSE IT TO PUBLIC IP ADDRESSES). To proceed, first open the file using your preferred text editor (I selected Nano).
$ sudo nano /etc/rabbitmq/rabbitmq-env.conf
Once the file is open, you will see the following parameters commented with a β#β prefix.
#NODENAME=rabbit
#NODE_IP_ADDRESS=127.0.0.1
#NODE_PORT=5672
To configure it with the internal network, find your hostname and internal (or local) IP address, uncomment the NODENAME and NODE_IP_ADDRESS lines by removing the β#β prefix, and replace their parameter values with your chosen ones. After making the necessary changes, your file should appear like this:

If needed, you can adjust the port by uncommenting the NODE_PORT parameter and replacing the port number with your desired one. However, I donβt recommend doing this unless itβs your only option. Beside this, you can now save and close the file, and donβt forget to restart the RabbitMQ Server by running:
$ sudo systemctl restart rabbitmq-server
Create Admin Account for RabbitMQ
To access the RabbitMQ web interface (which will be discussed later), you need an administrator account. For that purpose, you can use the following command to create a new administrator account with full permissions for all vhosts on the RabbitMQ server.
$ sudo rabbitmqctl add_user rabbituser changeme
$ sudo rabbitmqctl set_user_tags rabbituser administrator
$ sudo rabbitmqctl set_permissions -p / rabbituser ".*" ".*" ".*"
Output:

Once the administrator account is created, we can use the following credentials to log in:
- Usename: rabbituser
- Password: changeme
Install RabbitMQ Management Plugin
RabbitMQ offers a set of community-contributed plugins to extend its existing features. We are particularly interested in the βrabbitmq_managementβ plugin, which provides access to a web interface that simplifies the monitoring and configuration of RabbitMQ.
To enable this plugin, run the following command:
$ sudo rabbitmq-plugins enable rabbitmq_management
This will enable the other required plugins, such as βrabbitmq_management,β βrabbitmq_management_agent,β and βrabbitmq_web_dispatchβ that together enable the RabbitMQ management interface.

Access RabbitMQ Management Dashboard
Finally, to access the RabbitMQ web interface, open your preferred browser and navigate to your internal IP address, followed by the 15672 port (like this: http://ip-address:15672). On your first visit, you will be redirected to the login page, where you can use the previously created administrator credentials to login.

Once the authentication is successful, you will be redirected to the RabbitMQ dashboard, which will appear like this:

Thatβs it! You have successfully installed and configured RabbitMQ on your Linux system.
How to Uninstall RabbitMQ on Linux
To remove RabbitMQ from your Linux system, first ensure that you remove the Cloudsmith Mirror repository if it was used for installation. For Debian, Ubuntu, Linux Mint, and other related distributions, use the following command:
$ rm /etc/apt/sources.list.d/rabbitmq-rabbitmq-erlang.list
$ apt-get clean
$ rm -rf /var/lib/apt/lists/*
$ apt update
For Red Hat, Fedora, CentOS, and other related distributions, use this command:
$ rm /etc/yum.repos.d/rabbitmq-rabbitmq-erlang.repo
$ rm /etc/yum.repos.d/rabbitmq-rabbitmq-erlang-source.repo
Once the repository is removed, you can proceed to remove the RabbitMQ Server package using the appropriate command for your Linux distribution:
# On Debian, Ubuntu, Linux Mint, or Kali Linux
$ sudo apt uninstall rabbitmq-server
# On Red Hat, Fedora, CentOS, or AlmaLinux
$ sudo dnf uninstall rabbitmq-server
Wrap Up
In this article, youβve learned how to install and configure the RabbitMQ server on major Linux distributions, create an administrator account, set up the management dashboard, and access the dashboard via a browser.
If you have any questions or queries related to the article, do let us know in the comment section.
Till then, peace!
The post How to Install RabbitMQ Server on Linux (Quick Guide) appeared first on Linux TLDR.
How to Use Chattr Command in Linux (for Beginners)
Chattr is a UNIX command-line program thatβs pre-shipped in most Linux distributions. The role of this command is to allow the admin user to set file attributes that impose restrictions on files.
There are a handful of file attributes for different roles, such as the β+iβ attribute, which prevents a file from being renamed, deleted, or modified, and the β+aβ attribute, which only allows appending new content, as well as a few others that will be discussed later in this tutorial.
The benefit of using this command is that the restriction applies to both the normal user and the root user, making it a good choice for protecting important and sensitive files from accidental or retroactive changes.
In this beginner-friendly tutorial, Iβll explain to you how to use the chattr command with its various options, operators, and file attributes in a real-world scenario.
Tutorial Details
| Description | Chattr command |
| Difficulty Level | Low |
| Root or Sudo Privileges | Yes |
| OS Compatibility | Ubuntu, Manjaro, Fedora, etc. |
| Prerequisites | β |
| Internet Required | No |
Syntax of the Chattr Command
The chattr command takes three arguments: the first is the option, the second is the file attribute, and the third is the file path where you want to apply the selected file attribute.
$ chattr [option] [attribute*] [path/to/file*]
When you specify the file attribute, youβll mainly use the β+β and β-β operators: the β+β operator adds the selected attribute restriction to the file, while the β-β operator removes it. Besides this, you use the β=β operator to remove all the existing attributes and replace them with the selected ones.
The available options for chattr are the β-Rβ option to recursively apply the specified attribute to every file in the selected directory, the β-Vβ option to display the changed files, and the β-fβ option to hide common errors.
Enjoying it, right? Now, letβs learn a bit more about some important file attributes that youβll mainly use for setting restrictions using the chattr command, starting withβ¦
List of File Attributes for Chattr Command
The following is a list of commonly used chattr attributes and their purposes.
a: Only allow appending new content while imposing write, rename, and delete restrictions.A: Access time (or atime) record is frozen.c: Enables the transparent compression of the file on the supported filesystem.S: The changes to the file are updated synchronously, which will ensure the integrity of the critical data.i: Enables immutable mode, which allows the file content to be viewed but prevents writing, renaming, deleting, or appending actions.j: It will ensure that the changes are first applied to the ext3 journal before the file itself.t: Disable the tail-merging.d: It will reject the dump process for the selected file, which is often used for creating backups.u: When a file is accidentally deleted, a copy of the file is generated and can be recovered later.e: Itβs a default attribute applied to all files that indicates the file system uses extents to map the fileβs location on the disk.
The above list contains a few attributes from the complete list. To see the entire list, you can use the βman chattrβ command. However, these are sufficient for a beginner, as your work will mostly revolve around them. Letβs now look at some practical examples of this attribute in use.
Apply Write, Rename, and Delete Restriction to File
The β+iβ attribute makes the file immutable, preventing any modifications, even by root. A real-life scenario would be protecting a critical configuration file from accidental changes.
$ sudo chattr +i myfile.txt
Output:

The content of the file can still be viewed despite the write, rename, and delete restrictions.
Remove Write, Rename, and Delete Restriction to File
To remove the restrictions placed on a file in the previous method, you can use the β-iβ attribute.
$ sudo chattr -i myfile.txt
Output:

Note that this will only remove the restriction for the β+iβ attribute. If the user assigns a different attribute or multiple attributes at the same time, they will still exist.
Apply Append-Only Permission
The β+aβ attribute is very similar to the β+iβ attribute and prevents write, rename, and delete actions but allows appending new content to the file. You can apply this attribute to log files to prevent retroactive changes.
$ sudo chattr +i myfile.txt
Output:

To restore the file to its original state, use the β-aβ attribute to remove the append-only restriction.
Check the Applied Attribute to Selected File
To keep track of existing attributes or verify whether the applied attribute is set, you can use the βlsattrβ command, which lists all the attributes assigned to the selected file.
$ lsattr myfile.txt
Output:

The above output indicates that the file has two attributes: βiβ, which means the file is immutable, and βeβ, which is the default attribute applied to all files.
Replace the Existing Attribute With New Attribute
When a file has multiple attributes applied to it but you want to replace all of them with the selected one, you can specify the attribute with the β=β operator for this task.
$ sudo chattr =u myfile.txt
Output:

Apply the Attribute to All Files Within the Selected Directory
To apply a selected attribute to all files in the target directory, use the β-RVβ option to make changes recursively to all files, and then list the affected files.
$ sudo chattr -RV +u mydir/
Output:

Wrap Up
In this article, you have learned how to use the chattr command with various operators and attributes, as well as its available options. If you have any questions about the topic, feel free to reach out to us via the comment section.
Till then, peace!
The post How to Use Chattr Command in Linux (for Beginners) appeared first on Linux TLDR.
How to Setup SOCKS5 Proxy Server on Linux Using MicroSocks
VPNs are popular these days, but many users still prefer using a SOCKS proxy to tunnel network connections through them, as it offers faster internet connections and is ideal for managing torrent traffic, despite the generic drawback of unencrypted traffic.
You can even access blocked sites in your country using a SOCKS proxy. There are many public SOCKS proxy servers available, but as mentioned earlier, traffic on a SOCKS proxy is not encrypted, so using a public one could be risky.
In this article, Iβll show you how to install and set up a SOCKS5 proxy server on Linux using MicroSocks.
MicroSocks: A Lightweight SOCKS5 Proxy Server
MicroSocks is a lightweight and multi-threaded SOCKS5 proxy server designed to robustly handle requests on servers with low resources by consuming minimal resources and gently denying new connections during heavy loads instead of aborting them.
It supports IPv4, IPv6, DNS, uses TCP (no UDP currently) for network proxy, and allows users to connect with or without a password or by providing a one-time password, all without needing to create or edit any configuration file.
Letβs now see how to install MicroSocks on popular Linux distributions like Debian, Ubuntu, Linux Mint, Red Hat, Fedora, Rocky Linux, Arch, or any others.
Install MicroSocks on Linux
MicroSocks is available in most Linux repositories, such as Debian, Ubuntu-based distributions, and Arch systems, where you can quickly install it using one of the appropriate commands based on your Linux distribution.
# On Debian, Ubuntu, Kali Linux, Linux Mint, Zorin OS, Pop!_OS, etc.
$ sudo apt install microsocks
# On Arch Linux, Manjaro, BlackArch, Garuda, etc.
$ sudo pacman -S microsocks
On Red Hat and Fedora-based distributions, or on older Debian and Ubuntu distributions, you can build and install it from the source, which also provides you with the latest version.
To start, ensure the development tools are installed on your Linux system, then run the following series of commands to install MicroSocks from source.
$ wget http://ftp.barfooze.de/pub/sabotage/tarballs/microsocks-1.0.4.tar.xz
$ tar -xvf microsocks-1.0.4.tar.xz && cd microsocks*/
$ make && sudo make install
Once the installation is complete, the MicroSocks executable file will be added to the β/usr/local/binβ directory.
Start MicroSocks SOCKS5 Proxy Server
Now that the installation is complete, the βmicrosocksβ command is available to use, but before that, letβs look at a few options you can use with it.
| Option | Description |
|---|---|
| β-1β | It allows you to authenticate once, after which your IP address will be included in a whitelist, enabling you to connect to the proxy server later without authentication. |
| β-qβ | Disable logging. |
| β-i ip-addressβ | Specify the IP address to listen on; not providing one means listening on all network interfaces in the server (default is β0.0.0.0β). |
| β-p portβ | Set the port to use for listening (default is β1080β). |
| β-u userβ and β-P passwordβ | Specify the username and password for authentication in plain text, which can be anything regardless of existing users on the server. |
In my case, Iβve set up the MicroSocks proxy server on a DigitalOcean VPS and started it using the following command, which listens on all server IPs with port 8484, the username βproxyuserβ, and the password βsecurepasswordβ.
$ microsocks -1 -p 8484 -u proxyuser -P securepassword
Output:

To connect to the above MicroSocks proxy server from the local machine, run the following command, replacing the green highlighted fields with the correct proxy server information.
$ curl --socks5 user:password@server-ip:port https://www.google.com/
Output:

Once you do that, your local machine will be whitelisted for the MicroSocks proxy server due to the β-1β option, allowing you to configure SOCKS5 with your browser or Linux system without providing credentials.
To connect to your MicroSocks proxy server from Firefox, navigate to βPreferencesβ, then βGeneralβ, scroll down to the βNetwork Settingsβ section, and click on βSettingsβ.

Then, ensure you enable manual proxy configuration, select SOCKS v5, and provide the host and port number of your SOCKS5 proxy server.

Your Firefox is now configured with the MicroSocks proxy server, so all your browsing will go through the proxy server. If you encounter a connection failure error, make sure to re-execute the previous curl command.
To connect your local machine (running on GNOME) with the MicroSocks proxy server, first open βSettingsβ, navigate to βNetworkβ, and then βProxyβ.

Next, toggle the βNetwork Proxyβ and choose the βManualβ configuration.

Finally, enter the host and port of your MicroSocks proxy server in the βSOCKS5 HOSTβ section and save the changes.

You now have your system running on GNOME, connected to your MicroSocks proxy server.
Allow MicroSocks Proxy Server Listening Port on Firewall
If you are running an Ubuntu system with UFW (Uncomplicated Firewall), you need to open the port your proxy server listens on. First, check the firewall status:
$ sudo ufw status
If itβs active and running, then open the port for the MicroSocks proxy server, which by default is 1080; however, since Iβve opted for a custom port of 8484 using the β-pβ option, I need to allow this port with the following command:
$ sudo ufw allow 8484/tcp
Output:

Create MicroSocks Proxy Server Systemd Service
To keep the MicroSocks proxy server running in the background and autostart on boot without any manual intervention, you can create a Systemd service.
To begin, open your terminal and create a Systemd service file using the command below.
$ sudo nano /etc/systemd/system/microsocks.service
Then copy-paste the following snippet.
[Unit]
Description=microsocks SOCKS5 server
Documentation=https://github.com/rofl0r/microsocks
After=network.target auditd.service
[Service]
EnvironmentFile=/etc/microsocks.conf
ExecStart=/usr/bin/microsocks -1 -u ${MICROSOCKS_LOGIN} -P ${MICROSOCKS_PASSW}
[Install]
WantedBy=multi-user.target
Save and close the file, then create a MicroSocks configuration file for the user and password variables used in the above Systemd service file.
$ sudo nano /etc/microsocks.conf
Copy and paste the following snippet, ensure to replace the user and password information with the correct MicroSocks proxy server details. Also, if youβve customized the port or restricted IP in the Systemd service file, set their values accordingly in this configuration file.
# used by the systemd service file
MICROSOCKS_LOGIN="proxy-user"
MICROSOCKS_PASSW="proxy-password"
Save and close the file, then use the following command to enable and start the service:
$ sudo systemctl enable --now microsocks.service
To verify the status of the service, run the βsystemctl status microsocksβ command.

Uninstall MicroSocks from Linux
To uninstall the MicroSocks proxy server from your Linux system installed via the package manager, run:
# On Debian, Ubuntu, Kali Linux, Linux Mint, Zorin OS, Pop!_OS, etc.
$ sudo apt remove microsocks
# On Arch Linux, Manjaro, BlackArch, Garuda, etc.
$ sudo pacman -R microsocks
If you have installed it directly from the source, then run:
$ sudo rm /usr/local/bin/microsocks
To disable and remove the Systemd service, run:
$ sudo systemctl disable --now microsocks.service
$ sudo rm /etc/microsocks.conf
If youβve allowed the MicroSocks listening port on UFW, then execute the following command to locate its index number:
$ sudo ufw status numbered
Then remove the corresponding port using the βsudo ufw delete [no]β command.
The post How to Setup SOCKS5 Proxy Server on Linux Using MicroSocks appeared first on Linux TLDR.
Reset the WordPress Admin Password Using CLI (via 2 Methods)
WordPress is a popular CMS for bloggers and journalists, offering a range of features, including multi-user management, allowing admins to create separate accounts for different users with varying privileges.
The rule of thumb is to hand over the username and password to the user after account creation, but if the user or admin itself forgets the own password, the only option is to reset the user or admin password from the MySQL console or by using external tools.
In this article, Iβll show you how to reset (or change) the WordPress logins using the MySQL command-line client or the βwp-cliβ command.
Method 1: Reset the WordPress Password via MySQL Command
The first step is to log in to your server running WordPress via SSH. Then, make sure to take a backup of your WordPress database. You can either create a snapshot of your server or use the backup option if you are using a hosting provider.
Alternatively, you can use the following command to export a specific MySQL database to an SQL file format by providing the MySQL username, password, and database name.
$ sudo mysqldump -u [user] -p [db_name] > [export_the_db.sql]
Once you have taken the backup, you can reset the WordPress password by first connecting to the MySQL or MariaDB server.
$ mysql -u [user] -p
Output:

Then you need to select the WordPress database; if you forget the database name, you can use the βSHOW DATABASES;β SQL query to list all MySQL databases. Once you locate the correct database, use the following command to select it:
MySQL> use [wordpress_db]
Output:

Then, for confirmation, you can run the following command to list all WordPress users:
MySQL> select user_login from wp_users;
Output:

I have only one user account named βlinuxtldrβ, whose password I want to change. However, in your case, there could be one or more users, so note down the username and execute the following SQL query to update that user password (using the MD5 hashing algorithm):
MySQL> UPDATE `wp_users` SET `user_pass` = MD5('changeme') WHERE `user_login` = 'wordpress-user';
Output:

When you are done, quit the MySQL console using the βexitβ SQL query and return to WordPress to log in with the updated password.
Method 2: Reset the WordPress Password via WP-CLI Command
WP-CLI is a fantastic command-line tool for managing WordPress that you should definitely give a try. Weβve already covered its installation and command-line usage in a separate article, so weβll skip those parts and focus on resetting the WordPress administrator password.
First, ensure you are connected to the system running WordPress, then open your terminal and navigate to the directory where the WordPress files are stored (typically, itβs β/var/www/htmlβ).
Then run the following command to list all the WordPress user accounts:
$ wp user list
Output:

Finally, select the username whose password you want to change, and pass it to the command below, along with the new password for resetting.
$ wp user update wordpress-user --user_pass=changeme
Output:

Thatβs it; you have successfully changed the WordPress password using the βwp-cliβ tool.
Final Word
All the methods mentioned would work for resetting the WordPress password; you can choose one according to your preference. If you have any questions, feel free to ask them in the comments.
Till then, peace!
The post Reset the WordPress Admin Password Using CLI (via 2 Methods) appeared first on Linux TLDR.
How to Check PHP Version in Linux (via 4 Methods)
PHP is a popular scripting language used in the backend during web development to take the client request, process the request and respond to it, or execute MySQL queries.
Many popular CMS (content management systems), such as WordPress, Joomla, Drupal, Laravel, Magento, Symfony, and many more, are based on PHP.
As the popularity of PHP grows, each PHP version undergoes multiple changes, such as performance improvements, functionality updates, and security enhancements.
With this release, knowing the PHP version installed on your system is crucial, especially if you plan to develop a new web app based on PHP; ensure you check the PHP version on your system and strategize your development accordingly.
In this article, Iβll show you how to check the PHP (or PHP-FPM) version on Ubuntu and other Linux distros using the command line.
How to Check PHP Version in Linux (via 4 Methods)
There are multiple ways to find out the PHP version installed on your system: Iβll show you four methodsβ the first three work for any Linux distribution such as Debian, Ubuntu, Red Hat, Fedora, Arch, Manjaro, etc., while the fourth method only works for Ubuntu-based distributions such as Debian, Pop!_OS, Linux Mint, etc.
Method 1: Check PHP Version via PHP Command
The simplest way to find out the PHP version is by using the β-hβ or ββhelpβ flag with the βphpβ command in your command line.
$ php -v
Output:

This method will work for the majority of Linux distributions with PHP installed through a package manager.
Method 2: Check PHP Version via PHP Script
When PHP is installed using a different method, such as source code, the previous method might not work as it relies on passing the help flag to the PHP binary file that resides in the bin folder.
If youβre using the absolute path of the PHP binary file to run your PHP script, you can create a new PHP file named βphpversion.phpβ and include the following content:
<?php
phpinfo();
?>
Then, you have two options: either run the PHP server and access the PHP file in your web browser to check the PHP version, or pass the PHP file to the absolute path of the PHP binary file and use the grep command to find the PHP version.
$ /path/to/php phpversion.php | grep "PHP Version"
Output:

This method would work for all Linux distributions, as well as Windows and macOS.
Method 3: Check PHP Version via System Path
If youβve relocated the PHP directory and canβt locate it, neither of the previous methods will work. In such cases, you can use a few command-line tools to find the PHP directory.
For example, in the given command, βlocateβ will search for a file or directory named PHP, βgrepβ will filter the results for files ending with the name PHP, and the final command is βxargsβ and βlsβ, which are used to follow symbolic links, taking stdin data from the previous piped command.
$ locate php | grep -P "/php$" | xargs ls -L
When you run the above command, it will return all PHP files, sometimes including the PHP version in the output, as shown.

If the PHP version isnβt displayed, you can look for a PHP file in a bin directory or use tools like the file command to identify a binary file. Then, use the absolute path to the PHP binary file along with the help option to determine the PHP version.
$ /usr/bin/php -v
Output:

This method is quite effective but might be a bit trickier for beginners, so if youβre using a Debian or Ubuntu-based distribution, you can follow the next method to verify the PHP version.
Method 4: Check PHP Version via APT Command
When you install a program on a Debian or Ubuntu-based distribution, it adds an entry in the APT list that you can use to check the PHP version installed on your system.
$ apt list --installed | grep php
Output:

This method would only work for Debian or Ubuntu-based distributions; if youβre uncertain about the Linux distribution youβre running, use the command βcat /etc/os-releaseβ to identify it.
Final Word
In this article, youβve learned various methods to check the PHP version running on your Linux system. If you have any questions, feel free to ask them in the comment section.
Till then, peace!
The post How to Check PHP Version in Linux (via 4 Methods) appeared first on Linux TLDR.
Kill a Process Running on a Specific Port in Linux (via 4 Methods)
A newbie user often struggles to identify the process behind a specific listening port. Indeed, itβs not all their fault, as some listening ports are started and managed by the OS. However, they may forget the name or struggle to find the process ID of the service they manually started.
The running (or unresponsive) process must be stopped to free the occupied port and make it available for other processes. Letβs assume you are running an Apache server that uses ports 80 (for HTTP) and 443 (for HTTPS). You wonβt be able to launch an Nginx server that shares these common ports until the Apache server is stopped.
Itβs one of the many scenarios, and listening ports are often overlooked by users until a process fails to launch due to port unavailability. Hence, in this quick guide, Iβll show you how to identify and kill a process running on a specific port in Linux.
How to Kill a Process Running on a Specific Port in Linux
There are many ways to find and terminate processes running on a certain port. However, IT Guy, SysAdmin, or network engineers often favor using the CLI tool for this job. In such cases, you can use the βkillportβ, βfuserβ, βlsofβ, βnetstatβ, and βssβ commands as detailed in the following sections.
Method 1: Kill a Process Running on a Specific Port Using killport
Killport is a fantastic CLI tool for killing a process running on a specific port by using only the port number, without needing a service name or process ID. The only inconvenience is that itβs an external tool, but you can quickly install it on your Linux system by following our installation guide.
Once you have it installed, you can quickly terminate the process running on a certain port. Letβs assume you have an Apache server running on port 80. To stop it, simply execute this command:
$ sudo killport 80
Output:

Well, ignore the last βNo such processβ messageβitβs simply the response to the last kill signal sent to the process. The key point is that the port is now available for use by any other process.
Method 2: Kill a Process Running on a Specific Port Using fuser
Fuser is another great tool used for identifying processes using specific files, file systems, or sockets. Despite using it to identify processes running on specific sockets (or ports), you can use it to troubleshoot issues related to file locking, process management, and system resources.
It comes preinstalled on some popular Linux distributions like Ubuntu, Fedora, and Manjaro, but if itβs not available on your system, you can install the βpsmiscβ package that contains βfuserβ and other command-line utilities.
# On Debian, Ubuntu, Kali Linux, Linux Mint, Zorin OS, Pop!_OS, etc.
$ sudo apt install psmisc
# On Red Hat, Fedora, CentOS, Rocky Linux, AlmaLinux, etc.
$ sudo dnf install psmisc
# On Arch Linux, Manjaro, BlackArch, Garuda, etc.
$ sudo pacman -S psmisc
# On OpenSUSE system
$ sudo zypper install psmisc
To find out the process running on a specific port, you can specify the port number and its TCP or UDP protocol in the βfuserβ command.
$ sudo fuser 80/tcp
The above command will return the process ID in charge of handling the specified port.

Instead of printing the running process ID, you can use the β-kβ option with the above command to terminate the process associated with that process ID.
$ sudo fuser -k 80/tcp
Output:

Once you terminate the process with this method, you may need to wait a 60-second delay before the process fully shuts down. This is implemented as a security measure to avoid potential data corruption or conflicts. If you want to immediately stop the running process, you can specify the process ID in the βsudo kill -9 <PID>β command.
Method 3: Kill a Process Running on a Specific Port Using lsof
Lsof is another powerful tool used to identify the process responsible for managing specific files, directories, network sockets, and other system resources on the active system. It comes pre-installed with nearly all Linux distributions, requiring no additional installation.
To identify the process name and ID associated with a specific port, use the following command, followed by the port number you wish to check:
$ sudo lsof -i :80
The above command will return the output in multiple columns, with your focus areas being solely the βCOMMANDβ and βPIDβ columns.

Once you have the process ID, you can use the βkillβ command to terminate the process.
$ sudo kill -9 36749 36751 36752
Output:

The β-9β option sends the βSIGKILLβ signal to aggressively terminate the process, while you can alternatively use the β-1β option to hang up the process (less secure) and the β-15β option to gently kill the process (default).
Method 4: Kill a Process Running on a Specific Port Using netstat and ss
Netstat and ss are among the most widely used tools for SysAdmins to quickly pinpoint a process name and process ID associated with a specific port. However, netstat is considered depricated, and some major Linux distributions have removed it, requiring the installation of the βnet-toolsβ package for usage.
The ss command can be found in most Linux systems, and itβs basically an improved version of netstat. Both tools use almost identical command syntaxes, with the β-tnlpβ option being the most common to identify the listening portβs process name and process ID, where each option follows.
- β-tβ: Shows the TCP sockets
- β-nβ: Avoid resolving the service names
- β-lβ: Show the listening sockets
- β-pβ: Show the process ID and name
To find out the process name or ID of port 80, you can use either the netstat or ss command with the β-tnlpβ option, along with the grep command, to filter out the data for only the specified port number.
$ sudo netstat -tnlp | grep -i :80
$ sudo ss -tnlp | grep -i :80
Output:

Instead of specifying the port number in the grep command, you can also use the service name to identify its process ID and listening port.
$ sudo netstat -tnlp | grep -i apache
$ sudo ss -tnlp | grep -i apache
Output:

Finally, to kill the corresponding process, you can specify its process ID with the following command:
$ sudo kill -9 41005
Output:

When terminating the process using the βkill -pβ command, ensure that the service is not actively being used by any other process, as forcefully terminating it could lead to data corruption or loss.
Final Word
In this article, you learned different ways to terminate a process running on a specific port that would work for almost all major Linux distributions, such as Debian, Ubuntu, Red Hat, Fedora, Arch, Manjaro, etc. Well, if you have any questions or queries, feel free to tell us in the comment section.
Till then, peace!
The post Kill a Process Running on a Specific Port in Linux (via 4 Methods) appeared first on Linux TLDR.
Hoarder: A Bookmark and Note Taking App (Install via Docker)
Hoarder is a fantastic app for keeping your notes, images, and bookmarks in a single place. Itβs a free, open-source, and self-hostable application for bookmarking that offers AI-based automatic tagging and full-text search, powered by the one and only ChatGPT.

After giving it a try for five minutes, it immediately became my favorite application. To be honest, previously I used Pocket, which was quite annoying because it didnβt allow us to add notes or images; it was only for bookmarking pages.
Also, I donβt understand why they add the β?utm_source=pocket_savesβ slug to every page I bookmark. Donβt they realize that some sites are strict about CSRF? Well, letβs leave them aside, as Iβve already deleted my Pocket account.
Hoarder is a fun tool for quickly creating notes, saving links, and saving images. You can later add tags to your bookmarks and organize them into lists, like one for notes, another for links, or a separate list for images.
Interestingly, it also features a Chrome plugin and a Firefox addon that allow you to quickly bookmark pages, add tags, or add them to a list.

The experience is remarkable, and it also provides an option to delete bookmarks directly from the extension, unlike Pocket, which forces us to remove bookmarks from the dashboard. (Alright, thatβs my final rant.)
Features of the Hoarder
The following is a list of features offered by Hoarder:
- Bookmark links, take simple notes, and store images.
- Automatically retrieve link titles, descriptions, and images (excluding Captcha ones).
- Modify bookmark titles, archive, favorite, or delete them.
- Attach manual or AI-generated tags to bookmarks.
- Organize bookmarks into custom lists.
- Perform a full-text search across all stored content.
- Chrome pluginΒ andΒ Firefox addonΒ for quick bookmarking.
- AnΒ iOS app and an Android app.
- Enjoy dark mode support (for now, only for the Web).
Install Hoarder Using Docker
Make sure your system has Docker and Docker Compose installed for a smooth Hoarder setup. If not, consider referring to our dedicated installation guide. Once you have them, you can quickly set up Hoarder on Linux, Windows, or macOS, whether locally or on cloud servers.
1. Create a new directory for storing the compose file and environment variables.
$ mkdir ~/hoarder/ && cd ~/hoarder/
Output:

2. Download the docker compose file inside the created directory by running this command:
$ wget https://raw.githubusercontent.com/hoarder-app/hoarder/main/docker/docker-compose.yml
Output:

3. (Optional) To change the volume location, you can edit the docker compose file with your choice of text editor. To implement OpenAIβs automatic tagging, acquire an OpenAI API key and set it up in the docker compose file environment section.

4. Create a β.envβ file in the same directory with the following content:
HOARDER_VERSION=latest
NEXTAUTH_SECRET=2fjLEIJKKl016/nJmlZnp2UpvaFCccwMkVan1ufigxqsuOtD
MEILI_MASTER_KEY=tZcjeGqwy8DEu7GqxbBupvLexsSSEit7FchT4WnAmi0ewxPb
NEXTAUTH_URL=http://localhost:3000
If you want to modify the secret keys, use βopenssl rand -base64 36β to generate new random strings for βNEXTAUTH_SECRETβ and βMEILI_MASTER_KEYβ. And when configuring Hoarder on a cloud server, make sure to update the βNEXTAUTH_URLβ variable to match your server address.
5. Finally, you can start the Hoarder server by running this command:
$ docker compose up -d
Output:

Access the Hoarder Dashboard
Once the Hoarder is up and running on your system, you can launch your preferred browser (Chrome or Firefox) and navigate to the βhttp://localhost:3000β URL to access the dashboard.

To begin using Hoarder, you need to first register a new account by providing your name, email, password, and confirming the password. The first account will be designated as the administrator of Hoarder.

Once you successfully create the account, you will be redirected to the Hoarder dashboard, where you can quickly start adding bookmark links, taking simple notes, or saving images, including attaching them with tags or adding them to lists.

The default layout for the bookmarks is set to masonry, but it can be switched to grid or list view.

To check the number of users, bookmarks, server version, and background jobs (crawling, indexing, and inference), navigate to the βAdminβ page.

Changing the current password or generating a new API key can be done from the βSettingsβ page.

You can further explore the Hoarder yourself, as it is very user-friendly. Happy exploring!
Stop Hoarder Using Docker
To stop the Hoarder service, navigate to the directory where the Hoarder docker compose file is stored and run the following command:
$ cd ~/hoarder/
$ docker compose down
Output:

Final Word
Hoarder is a fantastic app that Iβve been using for a while on my Homelab, and honestly, my experience with bookmarking has been great. The Hoarder installation method discussed in this article will seamlessly work on Windows, macOS, or Linux (including Ubuntu, Debian, Linux Mint, Fedora, Red Hat, Arch, Manjaro, and others).
If you have any questions regarding the topic, feel free to ask them in the comment section.
Till then, peace!
The post Hoarder: A Bookmark and Note Taking App (Install via Docker) appeared first on Linux TLDR.