Jump to content

Welcome to CodeNameJessica

Welcome to CodeNameJessica!

💻 Where tech meets community.

Hello, Guest! 👋
You're just a few clicks away from joining an exclusive space for tech enthusiasts, problem-solvers, and lifelong learners like you.

🔐 Why Join?
By becoming a member of CodeNameJessica, you’ll get access to:
In-depth discussions on Linux, Security, Server Administration, Programming, and more
Exclusive resources, tools, and scripts for IT professionals
A supportive community of like-minded individuals to share ideas, solve problems, and learn together
Project showcases, guides, and tutorials from our members
Personalized profiles and direct messaging to collaborate with other techies

🌐 Sign Up Now and Unlock Full Access!
As a guest, you're seeing just a glimpse of what we offer. Don't miss out on the complete experience! Create a free account today and start exploring everything CodeNameJessica has to offer.

  • Entries

    91
  • Comments

    0
  • Views

    4237

Entries in this blog

The full form of IOMMU is Input Output Memory Management Unit. IOMMU maps the virtual addresses of a device to physical addresses which allows the device to be passed to a virtual machine (VM).

VT-D does the same thing as IOMMU. The main difference is that IOMMU is developed by AMD while VT-D is developed by Intel.

In this article, we will show you how to enable the IOMMU/VT-d CPU feature from the BIOS/UEFI firmware of some of the most popular desktop motherboards (i.e. ASUS, ASRock, MSI, and Gigabyte).

 

Table of Contents

  1. How to Enable IOMMU/VT-d from the BIOS/UEFI Firmware of ASUS Motherboards
  2. How to Enable IOMMU/VT-d from the BIOS/UEFI Firmware of ASRock Motherboards
  3. How to Enable IOMMU/VT-d from the BIOS/UEFI Firmware of MSI Motherboards
  4. How to Enable IOMMU/VT-d from the BIOS/UEFI Firmware of Gigabyte Motherboards
  5. Conclusion
  6. References

 

How to Enable IOMMU/VT-d from the BIOS/UEFI Firmware of ASUS Motherboards

To enter the BIOS/UEFI Firmware of your ASUS motherboard, press <Delete> right after pressing the power button of your computer.

The BIOS/UEFI Firmware of ASUS motherboards has two modes: “EZ Mode” and “Advanced Mode”.

Once you’ve entered the BIOS/UEFI Firmware of your ASUS motherboard, you will be in “EZ Mode” by default. To enable IOMMU/VT-d on your ASUS motherboard, you have to enter the “Advanced Mode”.

To enter “Advanced Mode”, press <F7> while you’re in “EZ Mode”.

If you have an AMD processor, navigate to the “Advanced” tab (by pressing the arrow keys), navigate to “AMD CBS”, and set “IOMMU” to “Enabled” from the BIOS/UEFI Firmware of your ASUS motherboard.

If you have an Intel processor, navigate to the “Advanced” tab (by pressing the arrow keys), navigate to “System Agent (SA) Configuration”, set “VT-d” to “Enabled”, and set “Control Iommu Pre-boot Behavior” to “Enable IOMMU during boot” from the BIOS/UEFI Firmware of your ASUS motherboard.

To save the changes, press <F10>, select OK, and press <Enter>.

The IOMMU/VT-d feature should be enabled. For more information on enabling the IOMMU/VT-d feature from the BIOS/UEFI Firmware of your ASUS motherboard, check the BIOS Manual of your ASUS motherboard.

 

How to Enable IOMMU/VT-d from the BIOS/UEFI Firmware of ASRock Motherboards

To enter the BIOS/UEFI Firmware of your ASRock motherboard, press <F2> or <Delete> right after pressing the power button of your computer.

If you’re using a high-end ASRock motherboard, you may find yourself in “Easy Mode” once you enter the BIOS/UEFI Firmware of your ASRock motherboard. In that case, press <F6> to switch to “Advanced Mode”.

If you’re using a cheap/mid-range ASRock motherboard, you may not have an “Easy Mode”. You will be taken to “Advanced Mode” directly. In that case, you won’t have to press <F6> to switch to “Advanced Mode”.

You will be in the “Main” tab by default. Press the <Right> arrow key to navigate to the “Advanced” tab of the BIOS/UEFI Firmware of your ASRock motherboard.

If you have an AMD processor, navigate to “AMD CBS” > “NBIO Common Options” and set “IOMMU” to “Enabled” from the BIOS/UEFI Firmware of your ASRock motherboard.

If you have an Intel processor, navigate to “Chipset Configuration” and set “VT-d” to “Enabled” from the BIOS/UEFI Firmware of your ASRock motherboard.

To save the changes, press <F10>, select Yes, and press <Enter>.

The IOMMU/VT-d feature should be enabled. For more information on enabling the IOMMU/VT-d feature from the BIOS/UEFI Firmware of your AsRock motherboard, check the BIOS Manual of your ASUS motherboard.

 

How to Enable IOMMU/VT-d from the BIOS/UEFI Firmware of MSI Motherboards

To enter the BIOS/UEFI Firmware of your MSI motherboard, press <Delete> right after pressing the power button of your computer.

The BIOS/UEFI Firmware of MSI motherboards has two modes: “EZ Mode” and “Advanced Mode”.

Once you’ve entered the BIOS/UEFI Firmware of your MSI motherboard, you will be in “EZ Mode” by default. To enable the IOMMU/VT-d on your MSI motherboard, you have to enter the “Advanced Mode”.

To enter the “Advanced Mode”, press <F7> while you’re in “EZ Mode”.

Navigate to “OC settings”, scroll down to “CPU Features”, and press <Enter>.

If you have an AMD processor, set “IOMMU” to “Enabled”.

If you have an Intel processor, set “Intel VT-D Tech” to “Enabled”.

To save the changes, press <F10>, select Yes, and press <Enter>.

The IOMMU/VT-d feature should be enabled. For more information on enabling the IOMMU/VT-d feature from the BIOS/UEFI Firmware of your MSI motherboard, check the BIOS Manual of your MSI motherboard.

 

How to Enable IOMMU/VT-d from the BIOS/UEFI Firmware of Gigabyte Motherboards

To enter the BIOS/UEFI Firmware of your Gigabyte motherboard, press <Delete> right after pressing the power button of your computer.

The BIOS/UEFI Firmware of Gigabyte motherboards has two modes: “Easy Mode” and “Advanced Mode”.

To enable IOMMU/VT-d, you have to switch to the “Advanced Mode” of the BIOS/UEFI Firmware of your Gigabyte motherboard. If you’re in “Easy Mode”, you can press <F2> to switch to “Advanced Mode” on the BIOS/UEFI Firmware of your Gigabyte motherboard.

Use the arrow keys to navigate to the “Settings” tab.

If you have an AMD processor, navigate to “Miscellaneous” and set “IOMMU” to “Enabled” from the BIOS/UEFI Firmware of your Gigabyte motherboard.

If you have an Intel processor, navigate to “Miscellaneous” and set “VT-d” to “Enabled” from the BIOS/UEFI Firmware of your Gigabyte motherboard.

To save the changes, press <F10>, select Yes, and press <Enter>.

IOMMU/VT-d should be enabled for your processor. For more information on enabling IOMMU/VT-d on your Gigabyte motherboard, we recommend you to read the “User Manual” or “BIOS Setup Manual” of your Gigabyte motherboard.

 

Conclusion

We showed you how to enable the IOMMU/VT-d CPU feature from the BIOS/UEFI firmware of some of the most popular desktop motherboards (i.e. ASUS, ASRock, MSI, and Gigabyte).

 

References

  1. ROG STRIX Z690 series BIOS Manual ( English Edition )
  2. ASUS ROG Maximus Z690 Hero BIOS Overview
  3. ROG STRIX X670E Series BIOS Manual ( English Edition )
  4. ASRock Bios Optimization! [AMD 7800X3D | X670E Taichi Carrara | XMP PC 5600 CL28 G.Skill | 4090HOF]
  5. ASRock Z690 Taichi BIOS Overview
  6. MSI MEG Z690 ACE BIOS Overview
  7. Pomoc techniczna cz. 1 – Ustawianie optymalne biosu i OC w płycie głównej MSI B450 Gaming Plus Max
  8. Bios Settings 7950x3D 7800x3D [Gigabyte Aorus Elite Ax x670]
  9. GIGABYTE Z690 Aorus Elite DDR4 Motherboard BIOS Overview

 

Proxmox VE 8 is the latest version of the Proxmox Virtual Environment. Proxmox VE is an open-source enterprise Type-I virtualization and containerization platform.

In this article, I am going to show you how to download the ISO image of Proxmox VE 8 and create a bootable USB thumb drive of Proxmox VE 8 on Windows 10/11 and Linux so that you can use it to install Proxmox VE 8 on your server and run virtual machines (VMs) and LXC containers.

 

Table of Contents

  1. Downloading the Proxmox VE 8 ISO Image
  2. Creating a Bootable USB Thumb Drive of Proxmox VE 8 on Windows 10/11
  3. Creating a Bootable USB Thumb Drive of Proxmox VE 8 on Linux
  4. Conclusion

 

Downloading the Proxmox VE 8 ISO Image

To download the ISO image of Proxmox VE 8, visit the official downloads page of Proxmox VE from your favorite web browser.

Once the page loads, click on Download from the Proxmox VE ISO Installer section.

 

Your browser should start downloading the Proxmox VE 8 ISO image. It will take a while to complete.

 

At this point, the Proxmox VE 8 ISO image should be downloaded.

 

Creating a Bootable USB Thumb Drive of Proxmox VE 8 on Windows 10/11

On Windows 10/11, you can use Rufus to create bootable USB thumb drives of different operating systems.

To download Rufus, visit the official website of Rufus from your favorite web browser.

Once the page loads, click on the Rufus download link as marked in the screenshot below.

 

Rufus should be downloaded.

 

Insert a USB thumb drive in your computer and double-click on the Rufus app file from the Downloads folder of your Windows 10/11 system to start Rufus.

 

Click on Yes.

 

Click on No.

 

Rufus should start.

First, select your USB thumb drive from the Device dropdown menu[1].

Then, click on SELECT to select the Proxmox VE 8 ISO image[2].

 

Select the Proxmox VE 8 ISO image from the Downloads folder of your Windows 10/11 system using the file picker[1] and click on Open[2].

 

Click on OK.

 

Click on START.

 

Click on OK.

 

Click on OK.

NOTE: The contents of the USB thumb drive will be removed. So, make sure to move important files before you click on OK.

 

The Proxmox VE 8 ISO image is being written to the USB thumb drive. It will take a while to complete.

 

Once the Proxmox VE ISO image is written to the USB thumb drive, click on CLOSE.

Your USB thumb drive should be ready for installing Proxmox VE 8 on your server.

 

Creating a Bootable USB Thumb Drive of Proxmox VE 8 on Linux

On Linux, you can use the dd tool to create a bootable USB thumb drive of different operating systems from ISO image.

First, insert a USB thumb drive in your computer and run the following command to find the device name of your USB thumb drive.

$ sudo lsblk -e7

 

In my case, the device name of my 32GB USB thumb drive is sda as you can see in the screenshot below.

 

Navigate to the Downloads directory of your Linux system and you should find the Proxmox VE 8 ISO image there.

$ cd ~/Downloads

$ ls -lh

 

To write the Proxmox VE 8 ISO image proxmox-ve_8.1-2.iso to the USB thumb drive sda, run the following command:

$ sudo dd if=proxmox-ve_8.1-2.iso of=/dev/sda bs=1M status=progress conv=noerror,sync

NOTE: The contents of the USB thumb drive will be erased. So, make sure to move important files before you run the command above.

 

The Proxmox VE 8 ISO image is being written to the USB thumb drive sda. It will take a while to complete.

 

At this point, the Proxmox VE 8 ISO image should be written to the USB thumb drive.

 

To safely remove the USB thumb drive from your computer, run the following command:

$ sudo eject /dev/sda

 

Your USB thumb drive should be ready for installing Proxmox VE 8 on any server.

 

Conclusion

In this article, I have shown you how to download the ISO image of Proxmox VE 8. I have also shown you how download Rufus and use it to create a bootable USB thumb drive of Proxmox VE 8 on Windows 10/11. I have shown you how to create a bootable USB thumb drive of Proxmox VE 8 on Linux using the dd command as well.

In a lab environment, lots of new users will be using JupyterHub. The default Authenticator of JupyterHub allows only the Linux system users to log in to JupyterHub. So, if you want to create a new JupyterHub user, you will have to create a new Linux user. Creating new Linux users manually might be a lot of hassle for you. Instead, you can configure JupyterHub to use FirstUseAuthenticator. FirstUseAuthenticator as the name says, automatically creates a new user while logging in to JupyterHub for the first time. After the user is created, the same username and password can be used to log in to JupyterHub.

In this article, I am going to show you how to install the JupyterHub FirstUseAuthenticator on the JupyterHub Python virtual environment. I am also going to show you how to configure JupyterHub to use the FirstUseAuthenticator.

NOTE: If you don’t have JupyterHub installed on your computer, you can read one of the articles depending on the Linux distribution you’re using:

  1. How to Install the Latest Version of JupyterHub on Ubuntu 22.04 LTS/ Debian 12/Linux Mint 21
  2. How to Install the Latest Version of JupyterHub on Fedora 38+/RHEL 9/Rocky Linux 9

 

Table of Contents:

  1. Creating a Group for JupyterHub Users
  2. Installing JupyterHub FirstUseAuthenticator on the JupyterHub Virtual Environment
  3. Configuring JupyterHub FirstUseAuthenticator
  4. Restarting the JupyterHub Service
  5. Verifying if JupyterHub FirstUseAuthenticator is Working
  6. Creating New JupyterHub Users using JupyterHub FirstUseAuthenticator
  7. Conclusion
  8. References

 

Creating a Group for JupyterHub Users:

I want to keep all the new JupyterHub users in a Linux group jupyterhub-users for easier management.

You can create a new Linux group jupyterhub-users with the following command:

$ sudo groupadd jupyterhub-users

 

Installing JupyterHub FirstUseAuthenticator on the JupyterHub Virtual Environment:

If you’ve followed my JupyterHub Installation Guide to install JupyterHub on your favorite Linux distributions (Debian-based and RPM-based), you can install the JupyterHub FirstUseAuthenticator on the JupyterHub Python virtual environment with the following command:

$ sudo /opt/jupyterhub/bin/python3 -m pip install jupyterhub-firstuseauthenticator

 

The JupyterHub FirstUseAuthenticator should be installed on the JupyterHub virtual environment.

 

Configuring JupyterHub FirstUseAuthenticator:

To configure the JupyterHub FirstUseAuthenticator, open the JupyterHub configuration file jupyterhub_config.py with the nano text editor as follows:

$ sudo nano /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py

 

Type in the following lines in the jupyterhub_config.py configuration file.

# Configure FirstUseAuthenticator for Jupyter Hub

from jupyterhub.auth import LocalAuthenticator

from firstuseauthenticator import FirstUseAuthenticator

 

LocalAuthenticator.create_system_users = True

LocalAuthenticator.add_user_cmd = ['useradd', '--create-home', '--gid', 'jupyterhub_users' , '--shell', '/bin/bash']

FirstUseAuthenticator.dbm_path = '/opt/jupyterhub/etc/jupyterhub/passwords.dbm'

FirstUseAuthenticator.create_users = True

 

class LocalNativeAuthenticator(FirstUseAuthenticator, LocalAuthenticator):

pass

 

c.JupyterHub.authenticator_class = LocalNativeAuthenticator

 

Once you’re done, press <Ctrl> + X followed by Y and <Enter> to save the jupyterhub_config.py file.

 

Restarting the JupyterHub Service:

For the changes to take effect, restart the JupyterHub systemd service with the following command:

$ sudo systemctl restart jupyterhub.service

 

If the JupyterHub configuration file has no errors, the JupyterHub systemd service should run just fine.

 

Verifying if JupyterHub FirstUseAuthenticator is Working:

To verify whether the JupyterHub FirstUseAuthenticator is working, visit JupyterHub from your favorite web browser and try to log in as a random user with a short and easy password like 123, abc, etc.

You should see the marked error message that the password is too short and the password should be at least 7 characters long. It means that the JupyterHub FirstUseAuthenticator is working just fine.

 

Creating New JupyterHub Users using JupyterHub FirstUseAuthenticator:

To create a new JupyterHub user using the FirstUseAuthenticator, visit the JupyterHub login page from a web browser, type in your desired login username and the password that you want to set for the new user, and click on Sign in.

 

A new JupyterHub user should be created and your desired password should be set for the new user.

Once the new user is created, the newly created user should be logged into his/her JupyterHub account.

 

The next time you try to log in as the same user with a different password, you will see the error Invalid username or password. So, once a user is created using the FirstUseAuthenticator, only that user can log in with the same username and password combination. No one else can replace this user account.

 

Conclusion:

In this article, I have shown you how to install the JupyterHub FirstUseAuthenticator on the JupyterHub Python virtual environment. I have also shown you how to configure JupyterHub to use the FirstUseAuthenticator.

 

References:

 

MySQL is a reliable and widely used DBMS that utilizes SQL and a relational model to manage data. MySQL is installed as part of LAMP in Linux, but you can install it separately.Even in Ubuntu 24.04, installing MySQL is straightforward. This guide outlines the steps to follow. Read on!

Step-By-Step Guide to Install MySQL on Ubuntu 24.04

If you have a user account on your Ubuntu 24.04 and have sudo privileges, installing MySQL requires you to follow the procedure below.

Step 1: Update the System’s Repository
When installing packages on Ubuntu, you should update the system’s repository to refresh the sources list. Doing so ensures the MySQL package you install is the latest stable version.

$ sudo apt update

Step 2: Install MySQL Server
Once the package index updates, the next step is to install the MySQL server package using the below command.

$ sudo apt install mysql-server

After the installation, start the MySQL service on your Ubuntu 24.04.

$ sudo systemctl start mysql.service

Step 3: Configure MySQL
Before we can start working with MySQL, we need to make a couple of configurations. First, access the MySQL shell using the command below.

$ sudo mysql

Once the shell opens up, set a password for your ’root’ using the below syntax.

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘your_password’;

We’ve also specified to use the mysql_native_password authentication method.

Exit the MySQL shell.

Step 4: Run the MySQL Script
One interesting feature of MySQL is that it offers a script that you should run to quickly set it up. The script prompts you to specify different settings based on your preference. For example, you will be prompted to set a password for the root user. Go through each prompt and respond accordingly.

$ sudo mysql_secure_installation

Step 5: Modify the Authentication Method
After successfully running the MySQL installation script, you should change the authentication method and set it to use the auth_socket plugin.

Start by accessing your MySQL shell using the root account.

$ mysql -u root -p

Once logged in, run the below command to modify the authentication plugin.

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH auth_socket;

Step 6: Create a MySQL User
So far, we have only access to MySQL using the root account. We should create a new user and specify what privileges they should have. When creating a new user, you must add their username and the login password using the syntax below.

create user ‘username’@’localhost’ IDENTIFIED BY ‘password’;

Now that the user is created, we need to specify what privileges the user has when using MySQL. For instance, you can give them privileges, such as CREATE, ALTER, etc., on a specific or all the databases.

Here’s an example where we’ve specified a few privileges to the added user on all available databases. Feel free to specify whichever privileges are ideal for your user.

GRANT CREATE, ALTER, INSERT, UPDATE, SELECT on *.* TO ‘username’@’localhost’ WITH GRANT OPTION;

For the new user and the privileges to apply, flush the privileges and exit MySQL.

flush privileges;

Step 7: Confirm the Created User
As the last step, we should verify that our user can access the database and has the specified privileges. Start by checking the MySQL service to ensure it is running.

$ sudo systemctl status mysql

Next, access MySQL using the credentials of the user you added in the previous step.

$ mysql -u username -p

A successful login confirms that you’ve successfully installed MySQL, configured it, and added a new user.

Conclusion

MySQL is a relational DBMS widely used for various purposes. It supports SQL in managing data, and this post discusses all the steps you should follow to install it on Ubuntu 24.04. Hopefully, you’ve installed MySQL on your Ubuntu 24.04 with the help of the covered steps.

Task Manager is an app on the Windows 10/11 operating system that is used to monitor the running apps and services of your Windows 10/11 operating system. The Task Manager app is also used for monitoring the CPU, memory, disk, network, GPU, and other hardware usage information.

A few screenshots of the Windows Task Manager app are shown below:

In this article, I am going to show you 6 different ways of opening the Task Manager app on Windows 10/11.

 

Table of Contents:

  1. Opening the Task Manager App from the Start Menu
  2. Opening the Task Manager App from the Windows Taskbar
  3. Opening the Task Manager App from Run Window
  4. Opening the Task Manager App from the Command Prompt/Terminal
  5. Opening the Task Manager App from the Windows Logon Menu
  6. Opening the Task Manager app Using the Keyboard Shortcut

 

1. Opening the Task Manager App from the Start Menu

Search for the term app:task in the Start Menu and click on the Task Manager app from the search result as marked in the screenshot below.

The Task Manager app should be opened.

 

2. Opening the Task Manager App from the Windows Taskbar

Right-click (RMB) on an empty location of the Windows taskbar and click on Task Manager.

The Task Manager app should be opened.

 

3. Opening the Task Manager App from Run Window

To open the Run window, press <Windows> + Run.

In the Run window, type in taskmgr in the Open section[1] and click on OK[2].

The Task Manager app should be opened.

 

4. Opening the Task Manager App from the Command Prompt/Terminal

To open the Terminal app, right-click (RMB) on the Start Menu and click on Terminal.

 

The Terminal app should be opened.

Type in the command taskmgr and press <Enter>. The Task Manager app should be opened.

 

5. Opening the Task Manager App from the Windows Logon Menu

To open the Windows logon menu, press <Ctrl> + <Alt> + <Delete>.

From the Windows logon menu, click on Task Manager. The Task Manager app should be opened.

 

6. Opening the Task Manager app Using the Keyboard Shortcut

To Windows 10/11 Task Manager app can be opened with the keyboard shortcut <Ctrl> + <Shift> + <Escape>.

 

Conclusion:

In this article, I have shown you how to open the Task Manager app on Windows 10/11 in 6 different ways. Feel free to use the method you like the best.

Python and R programming languages rely on Anaconda as their package and environment manager. With Anaconda, you will get tons of the necessary packages for your data science, machine learning, or other computational tasks.To utilize Anaconda on Ubuntu 24.04, install the conda utility for your Python flavor. This post shares the steps for installing conda for Python 3, and we will install version 2024.2-1. Read on!

How to Install conda n Ubuntu 24.04

Anaconda is an open-source platform and by installing conda, you will have access to it and use it for any scientific computational tasks, such as machine learning. The beauty of Anaconda lies in its numerous scientific packages, ensuring you can freely use it for your project needs.

Installing conda on Ubuntu 24.04 follows a series of steps, which we’ve discussed in detail.

Step 1: Downloading the Anaconda Installer
When installing Anaconda, you should check and use the latest version of the installer script. You can access all the latest Anaconda3 installer scripts from the Anaconda Downloads Page.

As of writing this post, we have version 2024.2-1 as the latest version, and we can go ahead and download it using curl.

$ curl https://repo.anaconda.com/archive/Anaconda3-2024.2-1-Linux-x86_64.sh --output anaconda.sh

Ensure you change the version when using the above command. Also, navigate to where you want the installer script to be saved. In the above command, we’ve specified to save the installer as anaconda.sh, but you can use any preferred name.

The installer script is large and will take some time, depending on your network’s performance. Once the download is completed, verify the file is available using the ls command. Another crucial thing is to check the integrity of the installer script.
To do so, we’ve used the SHA-256 checksum by running the below command.

$ sha256sum anaconda.sh

Once you get the output, confirm that it matches against the available Anaconda3 hashes from the website. Once everything checks out, you can proceed with the installation.

Step 2: Run the conda Installer Script
Anaconda has an installer script that will take you through installing it. To run the bash script, execute the below command.

$ bash anaconda.sh

The script will trigger different prompts that will walk you through the installation. For instance, you must press the Enter key to confirm that you are okay with the installation.
Next, a document containing the lengthy Anaconda license agreement will open.

Please go through it, and once you reach the bottom, type yes to confirm that you agree with the license terms.

You must also specify where you want the installation to be installed. By default, the script selects a location in your home directory, which is okay in some instances. However, if you prefer a different location, specify it and press the enter key again to proceed with the process.

Conda will start installing, and the process will take a few minutes. In the end, you will get prompted to initialize Anaconda3. If you wish to initialize it later, choose ‘no.’ Otherwise, type ‘yes,’ as in our case.

That’s it! You will get an output thanking you for installing Anaconda3. This message confirms that the conda utility was installed successfully on Ubuntu 24.04, and you now have the green light to start using it.

Step 3: Activate the Installation and Test Anaconda3
Start by sourcing the ~/.bashrc with the below command.

$ source ~/.bashrc

Next, restart your shell to open up in the Anaconda3 base environment.
You can now check the installed conda version.

$ conda --version

Better yet, you can view all the available packages by listing them using the command below.

$ conda list

With that, you’ve installed Conda on Ubuntu 24.04. You can start working on your projects and maximize the power of Anaconda3 courtesy of its multiple packages.

Conclusion

Anaconda is installed by installing the conda command-line utility. To install conda, you must download its installer script, execute it, go through the installation prompts, and agree to the license terms. Once you complete the process, you can use Anaconda3 for your projects and leverage all the packages it offers.

Now that you have Ubuntu 24.04 installed, the remaining task is ensuring that you install all the software you need, including Java. Installing Java on Ubuntu 24.04 makes it possible to develop and run Java applications, and as a Java programmer, you will inevitably install Java on Ubuntu.Java isn’t pre-installed on Ubuntu. As such, you must know what steps are required to quickly install Java before you start using it for your projects. Reading this post will arm you with a simple procedure to install Java on Ubuntu 24.04.

Java JDK vs JRE

When installing Java on Ubuntu 24.04, a common concern is understanding the difference between JDK and JRE and knowing which to install. Here’s the thing: Java Development Kit (JDK) comprises all the required tools to develop Java applications. It comprises of the Java compiler and debugger and for someone looking to create Java apps, you must have JDK installed.

As for Java Runtime Environment(JRE), it is required for anyone looking to run Java applications on their system. So, if you only want to run Java applications without building them, you only need to install JRE and not the JDK.

As a programmer, you will likely develop and run Java applications. Therefore, you must install JDK and JRE for everything to work correctly.

How to Install Java on Ubuntu 24.04

Installing Java only requires access to an internet connection. Again, when you install the JDK, it should install the default JRE by default. However, that’s not always the case. Besides, if you want a specific version, you can specify it when running the install command.
Here, we’ve provided the steps to follow to install Java quickly. Take a look!

Step 1: Update Ubuntu’s Repository
Updating the system repository ensures that the package you install is the latest stable version. The update command refreshes the sources list, and when you install Java, you will have the updated source index for the latest version.

$ sudo update

Step 2: Install Default JRE
Before we can start installing Java, first verify that it isn’t already installed on your Ubuntu 24.04 by checking its version with the following command.

$ java --version

If Java is installed, you will get its version displayed on the output. Otherwise, you will get an output showing ’Java’ not found.

Otherwise, install the default JRE using the below command.

$ sudo apt install default-jre

The installation time will depend on your network’s speed.

Step 3: Install OpenJDK
After successfully installing JRE, you are ready to install OpenJDK. Here, you can choose to install the default JDK, which will install the available version. Alternatively, you can opt to install a specific JDK version depending on your project requirements.
For instance, if we want to install OpenJDK 17, we would execute our command as follows.

$ sudo apt install openjdk-21-jdk

During the installation process, you will get prompted to confirm a few things. Press ’y’ and hit the enter key to proceed with the installation. Once the installation is complete, you will have Java installed on your Ubuntu 24.04 and ready for use.

The last task is to verify that Java is installed. By checking the version, you will get an output showing which version is installed. If you want a different version, ensure you specify it in the previous commands, as your project requirements could be different.

$ java --version

For our case, the output shows that we’ve installed Java v21.0.3 .

Conclusion

Installing Java on Ubuntu 24.04 isn’t a complicated process. However, you must know what your project requirements are to guide which version you install. To recap, installing Java requires you to first update the repository. Next, install JRE and then specify what OpenJDK version to install. You will have managed to install Java on Ubuntu 24.04, and this post shares more details on each step.

The Node Package Manager (NPM) is a tool that allows developers to install and work with different JavaScript packages efficiently. Installing NPM involves installing Node.js, and this post shares all the insights you need to install NPM.Node.js is a suitable option for anyone looking to have a scalable backend that utilizes JavaScript. Node.js is built on Chrome’s V8 JS engine, and you can easily install it on your Ubuntu 24.04 to start powering your backend functionality in your projects. We will focus on understanding three options for installing NPM on Ubuntu 24.04.

Method 1: Install NPM on Ubuntu 24.04 via APT

You can find the NPM and Node.js from the Ubuntu repository. If you don’t need any specific Node.js version for your project, you can utilize this option to install NPM and Node.js with the below commands.

First, run the update command.

$ sudo apt update

Next, source Node.js from the default repository and install it using the command below.

$ sudo apt install nodejs

At this point, you have Node.js installed, and you can verify the installed version using the command below.

$ node -v

To install NPM, run the following command.

$ sudo apt install npm

Verify that NPM is installed by checking its version.

$ npm --version

We have npm v9 for our case. You can now comfortably start working on your Node.js project, and with NPM installed, you have room to install any dependencies or packages.
That’s the first option of installing NPM and Node.js on Ubuntu 24.04.

Method 2: Install NPM Using NodeSource PPA

When you install the NodeSource package, it will install NPM without you needing to install it separately. This method allows you to install a specific Nodejs package provided you’ve correctly added the PPA by downloading it using wget or curl.

Start by visiting the Nodejs project to see which version you want to install.

Once you decide on the version, retrieve it using curl as in the following command. For our example, we’ve retrieved version 20.x.

$ curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh

The script will get saved in your current directory, and you can verify it using the ls command.
The next step is to run the script, but before that, you can open it with a text editor to confirm that it is safe to execute.

You can then run the script using bash with the following command.

$ sudo bash nodesocurce_setup.sh

The command will add the NodeSource PPA to your local package, where you can source and install Node.js. When the script completes executing, you will get an output confirming the PPA has been added, and it will display the command you should use to install Node.js.

Note that before installing the Node.js package, if you have already installed it using the previous method, it’s best to uninstall it to avoid running into an error. To do so, use the below command.

$ sudo apt autoremove nodejs npm

To install the Nodejs package, which will also install NPM, run the following command.

$ sudo apt install nodejs

Your system will source the package from the local package where we added the PPA. It will then proceed to install the NodeSource package version that you downloaded.

Once the installation is complete, check its version using the following command.

$ node -v

The output will display the node version you downloaded, which is v20.12.2 for our case. Still, if we check the installed NPM version, you will notice it’s different from what we had earlier.

$ npm --version

The PPA installed NPM v10.5.0, which is higher than what we installed in method one earlier.

Conclusion

For anyone looking to use NPM and Node.js to power their backend application, this post shares two different methods for seamlessly installing NPM. This allows you to run your Node.js and install packages effectively. You can install NPM from the default Ubuntu 24.04 repository or add its PPA from the Node Source project, which will automatically install NPM alongside Node.js.

As the name suggests, grep or global regular expression print lets you search for specific text patterns within a file’s contents. Its functionalities include pattern recognition, defining case sensitivity, searching multiple files, recursive search, and many more. 

So whether you’re a beginner or a system administrator, knowing about the grep command to locate the files efficiently is good. This tutorial will explain how to use grep in Linux and discuss its different applications.

How To Use Grep Command in Linux

The basic function of the grep command is to search for a particular text inside a file. You can do that by entering the following command:

grep "text_to_search" file.txt

Please replace ‘text_to_search’ with the text you want to search for and ‘file.txt’ with the target file. For example, to find the string “Hello” in the file named file.txt, we will use:

grep "Hello" file.txt

simple-example-grep-command

On entering the above command, grep will scan the Intro.txt file for “Hello.” As a result, it shows the output of the whole line or lines containing the target text.

If the target file is on a path different from your current directory, please mention that path along with the file name. For instance:

grep "Hello" ~/Documents/file.txt

grep-command-with-the-file-location

Here, the tildes ‘~’ mark represents your home directory. The above example shows how you can search for a piece of text in a single file. However, if you want to do the same search on multiple files at once, mention them subsequently in one grep command:

grep "Hello" file.txt Linux_info.txt Password.txt

using-grep-command-for-multiple-files

In case you’re not sure about your string’s cases(uppercase or lowercase), perform a case-insensitive search by using the i option:

grep -i "hello" Intro.txt

i-option-in-grep-command

Although the string we input was not the exact match, we received accurate results through the case-insensitive search. In case you want to invert the changes and check files that don’t contain the specific pattern, then please use the v option:

grep -v "Hello" file.txt Linux_info.txt Password.txt

v-option-in-grep-command

Moreover, if you want to display the lines that start with a certain word, use the ‘^’ symbol. It serves as an anchor that specifies the beginning of the line.

grep "^Hello" file.txt

grep-command-example

The above commands will only be useful when you know which file to search. In this case, you can recursively search the string inside the whole directory using the r option. For example, let’s search “Hello” inside the Documents directory:

grep -r "Hello" ~/Documents

r-option-grep-command

Furthermore, you can also count the number of times the input string appears in a file through the c option:

grep -c "Hello" Intro.txt

c-option-in-grep-command

Similarly, you can display the line numbers along with the matched lines with the n option:

grep -n "Hello" Intro.txt

n-option-in-grep-command

A Quick Wrap-up

Users often remember that a file used to contain a piece of text but forget the file name, which can land them in deep trouble. Hence, this tutorial was about using the grep command to search for text in a file’s contents. Furthermore, we have used different examples to demonstrate how you can tweak the grep command’s functioning with a few options. You can experiment by combining multiple options to find out what suits best according to your use case.

Linux works well as a multiuser operating system. Many users can access a single OS simultaneously without interpreting each other. However, if others can access your directories or files, the risk may increase. 

Hence, from a security perspective, securing the data from others is essential. Linux has features to control access from permissions and ownership. The ownership of files, folders, or directories is categorized into three parts, which are:

  • User (u): This is the default owner, also called the file’s creator.
  • Group (g): It is the collection of multiple users with the same permissions to access folders or files. 
  • Other (o): Those users not in the above two categories belong to it. 

That’s why Linux offers simple ways to change file permissions without hassles. So in this quick blog, we have included all the possible methods to change file permissions in Linux. 

How to Change File Permissions in Linux

In Linux, mainly Linux file permissions are divided into three parts, and these are:

  • Read (r): In this category, users can only open and read the file and can’t make any changes to it. 
  • Write (w): Users can edit, delete, and modify the file content with written permission.
  • Execute (x): When the user has this permission, they can execute the executable script and access the file details.
Owner Representation Modify permission using the operator   Permission symbols for symbolic mode Permission symbols for absolute mode
User → u To add use ‘+’ Read → r To add or subtract read use ± 4
Group → g To subtract use ‘-‘ Write → w To add or subtract read use ± 2
Other → o To set use ‘=’ Execute → x To add or subtract read use ± 1

As you can see from the above table, there are two types of symbol representation of permission. You can use both of these modes (symbolic and absolute) to change file permissions using the chmod command. The chmod refers to the change mode that allows users to modify the access permission of files or folders.

Using chmod Symbolic Mode

In this method, we use the symbol (for owner- u, g, o; for permission- r, w, x) to add, subtract, or set the permissions using the following syntax:

chmod <owner_symbol> mode <permission_symbol> <filename>

Before changing the file permission, first, we need to find the current one. For this, we use the ‘ls’ command.

ls -l

l-option-in-ls-command

Here the permission symbols belong to the following owner:

  • ‘-‘ : shows the file type.
  • ‘rw-‘ : shows the permission of the user (read and write)
  • ‘rw-‘ : shows the permission of the group(read and write)
  • ‘r- -‘ : shows the permission of others (read)

In the above image, we highlighted one file in which the user has read and write permission, the group has read and write permission, and the other has only read permission. So here, we are going to add executable permission to others. For this, use the following command:

chmod o+x os.txt

o+x-option-chmod-command

As you can see, the execute permission has been added to the other category. Simultaneously, you can also change the multiple permissions of different owners. Following the above example, again, we change the permissions in it. So, here, we add executable permission from the user, remove write permission from the group, and add write permission to others. For this, we can run the below command:

chmod -v u+x ,g-w,o+w os.txt

multiple-options-in-chmod-command

Note: Use commas while separating owners, but do not leave space between them.

Using chmod Absolute Mode

Similarly, you can change the permission through absolute mode. In this method, mathematical operators (+, -, =) and numbers represent the permissions, as shown in the above table. For example, let’s take an example and the updated permission of the file data is as follows:

l-option-in-ls-command

Mathematical representation of the permission:

User Read + Write Permission is represented as 

665

4+2=6
Group Read + Write
4+2=6
Other Read + Execute
4+1=5

Now, we are going to remove read permission from the user and others, and the final calculation is:

User Read + Write -Read (-4) Updated permission is represented as 

261

4+2=6 6-4=2
Group Read + Write
4+2=6 6
Other Read + Execute -Read (-4)
4+1=5 5-4=1

To update the permission, use the following chmod command:

chmod -v 261 os.txt

changing-permissions-using-the-number-system-in-chmod

Change User Ownership of the File

Apart from changing the file permission, you may also have a situation where you have to change the file ownership. For this, the chown is used which represents the change owner. 

checking-the-file-permissions-of-a-file

The file details represent the following details:

<filetype> <file_permission> <user_name> <group_name> <file_name>

So, in the above example, the owner’s or user name is ‘prateek’, and you can change the user name that only exists on your system. Before changing the username, first list all the users using the following command:

cat /etc/passwd

Or

awk -F ':' '{print $1}' /etc/passwd

awk-command-in-linux

Now, you can change the username of your current or new file between these names. The general syntax to change the file owner is as follows:

sudo chown <new_username> <filename>

Note: Sudo permission is required in some cases.

Based on the above result, we want to change the username from ‘prateek’ to ‘proxy.’ To do this, we run the below command in the terminal:

sudo chown proxy os.txt

checking-file-permissions-using-chown-command

Change Group Ownership of the File

First, list all the groups that are present in your system using the following command:

cat /etc/group | cut -d: f1

command-combination-to-check-the-file-permissions

The  ‘chgrp’ command (change group) changes the filegroup. Here, we change the group name from ‘prateek’ to ‘disk’ using the following command:

sudo chgrp disk os.txt

change-group-using-chgrp-command

Conclusion

Managing file permissions is essential for access control and data security. In this guide, we focused on changing the file permissions in Linux. It has a feature through which you can control ownership (user, group, others) and permissions (read, write, execute). Users can add, subtract, or set the permissions according to their needs. Users can easily modify the file permissions through the chmod command using the symbolic and absolute methods. 

Operating systems use packets for transferring the data on a network. These are small chunks of information that carry data and travel among devices. Moreover, when any network problem arises, packets aid in identifying the root cause of the underlying problem. How? By tracing the route of those packets.

The traceroute command in Linux helps you map the path packets take while traveling to a specific destination. This further helps you troubleshoot network latency, packet loss, network hops, DNS resolution issues, slow website access, and more. So, in this blog, we will explain simple ways to use the traceroute command in Linux.

How To Use Traceroute Command in Linux

Firstly, the traceroute does not come preinstalled in many Linux distributions. However, you can install it by executing one of the below command according to your system: 

Operating System Command
Debian/Ubuntu sudo apt install traceroute
Fedora sudo dnf install traceroute
Arch Linux sudo pacman -Sy traceroute
openSUSE sudo zypper install traceroute

After installation, you can implement the traceroute command by entering:

traceroute <destination_IP>

i-option-in-hostname-command

Replace <destination_IP> with the device’s IP address at the destination. Once you run the command, your system will display the list of hops with the IP address and response time. Hops are the devices that your packets go through while traveling to a specific destination. For example, let’s use the traceroute command for Google’s IP address:

traceroute 8.8.8.8

traceroute-command

The result shows only one hop while marking others as an asterisk(*). This happens because the subsequent hops did not respond within the timeout period of 3 seconds. Moreover, the traceroute command, by default, uses DNS resolution to get the hostnames of hops, which slows down the process. You can omit that part and guide it to display only the IP addresses by using the -n option:

traceroute -n <destination_IP>

n-option-in-traceroute-command

If you want to limit the number of hops, use the -m option along with the traceroute command:

traceroute -m N <destination_IP>

m-option-in-traceroute-command

Here, put the desired number of hops in place of N. On execution, it will return only N number of hops in the results. The traceroute command only displays every hop’s round-trip time(RTT). However, you can get more detailed timing information with the -I option:

traceroute -I <destination_IP>

i-option-in-traceroute-command

This command sends an ICMP echo request to retrieve more accurate RTT data. For instance, retake the example of Google:

Tip: If your specified destination restricts ICMP packets, you can instead trace the UDP packets by employing the -U option:

traceroute -U <destination_IP>

u-option-in-traceroute

In case you want to explore more options for traceroute, then please run the below command: 

traceroute --help

help-option-in-traceroute-command

A Quick Wrap-up

Traceroute is an amazing CLI utility that you can use to diagnose network-related issues in Linux. It traces the path of packets to identify all the critical issues of the network. Hence, We have explained every single detail about the traceroute command with the help of some examples. 

The htop is a CLI utility to check an interactive list of running processes in real-time. It is a more feature-rich and user-friendly alternative to the top command. The htop command allows you to manage system processes, monitor resources, and perform other administration tasks.

One of the most prominent features of htop is that it shows color-coded processes, which helps you differentiate them based on resource usage. Furthermore, it lets you customize the results with its sort and filter options. So, this short tutorial is about how to use the htop command in Linux without hassles. Unlike top, the htop command is not preinstalled in most Linux systems. That’s why you must install it using the following commands:

Operating System Command
Debian/Ubuntu sudo apt-get install htop
Fedora sudo dnf install htop
RHEL/CentOS sudo yum install htop

Now, you can use the htop command, so let’s start with the basics:

htop

 

basic-htop-command

When you execute the above command, it launches the htop utility. Here, you can use the arrow keys to navigate up and down the processes. Moreover, press ‘F1’ or ‘?’ to get the help screen for additional navigation shortcuts.

Sort Processes in htop

In htop, you can sort the processes by CPU, memory, and other usage. Open the sorting menu by pressing F6:

sort-process-in-htop

For example, select the PERCENT_CPU option and press ‘Enter.’

example-of-process-sorting-in-htop

As you can see in the above image, all the processes are now sorted by CPU consumption. 

Search and Filter Processes in htop

To search any process in htop, please go through the following steps:

Press ‘F3’ to open the search bar.

filter-process-in-htop

Similarly, press ‘F4’ to filter out the processes.

Additional Options with htop

-d, –delay=[argument]: By default, htop updates the processes every second, but you can add a delay using this option. For instance, to introduce a delay of 10 seconds, we would enter ‘–delay=10.’

d-option-in-htop

-C, –no-color: This option disables the color output, which is helpful in systems with limited terminal support for colors.

c-option-in-htop

-u, –user=[username]: To display the processes for a specific user. Just replace ‘[username]’ with the target user’s name.

u-option-in-htop

-p, –pid=[PID1,PID2]: Displays information for specified process IDs. For example, let’s check the details of PID 1:

htop -p 1

 
p-option-in-htop

-v, –version: Prints htop version information.

v-option-in-htop

-h, –help: This displays a help message with usage information.

h-option-in-htop-command

Kill a Process in htop

If you want to kill any process, select it and press the ‘F9’ key or ‘k’ to transmit a kill signal for the selected process.

Wrapping Up

Htop is a powerful utility for interactively checking system processes in real time. This tutorial briefly discusses how to use the htop command. As htop is not a preinstalled utility in Linux distributions, your first step is to install it using the mentioned commands. Later, we explained how to sort, search, filter, and kill processes from the htop utility.

All UNIX-based operating systems, including Linux, follow the structure that “everything is a file.” These systems treat all the regular files, directories, processes, symbolic links, and devices like external hardware as files. You can create, modify, and delete files using the commands or from the File Manager.

Deleting files is essential when you accidentally create multiple files that become unnecessary for the system. So, in this quick blog, we will explain quick ways to delete a file in Linux with no trouble. There are a few methods of deleting the files, so let’s look at them individually with the correct examples. 

The rm Command

You can use the rm command to delete the file from the terminal. For example, you want to delete the “filename.txt” located in the Downloads directory, so first run the below command to open the directory in the terminal:

cd ~/Downloads

opening-downloads-directory

 

Then, use the following command:

rm filename.txt

rm-command-to-remove-a-file

The rm command doesn’t display any output, but you can use the -v option to get the output:

rm -v filename.txt

v-option-rm-command

If you want to delete multiple files from the current directory, you can mention all those files in a single rm command. For example, to delete three files– file1.txt, file2.txt, file3.txt, please run the below command:

rm file1.txt file2.txt file3.txt

deleting-multiple-files-using-rm-command

In case you want to delete all the files with the same extension, then you can run the following command: 

rm *.txt

rm-command-to-delete-all-txt-files

As the above image shows, we have deleted all the .txt files from the Downloads directory. Moreover, you can use multiple extensions in a single command to delete different types of files simultaneously. For example, let’s delete all the files having the .txt and the .sh extensions: 

rm -v *.sh *.txt

rm-command-to-delete-multiple-types-of-files

Similarly, you can empty a directory by only adding the * in the rm command: 

rm *

rm-command-to-delete-everything

Remember, the above command deletes all files except the directories. Hence, if there is a subdirectory, then the terminal will show the following output: 

rm-command-output-if-you-delete-a-directory-through-it

However, you can use the -r option with the rm command to delete the subdirectories. The -r option recursively deletes the directory along with its contents:

rm -r *

r-option-in-rm-command

In case you want to get the confirmation before deleting the file, please use the -i option. 

rm -i *

i-option-in-rm-command

Once you run the command, the system will show a confirmation prompt, so all you have to do is press Y to delete or N to decline it. 

From the File Manager

We recommend deleting the file from the File Manager if you are a Linux beginner. So first open the File Manager and locate the directory: 

file-manager-UI-in-linux

Now select the file and right-click it to get the context menu.

selecting-move-to-trash-option

Finally, click on the Move to Trash option or press Delete button.

A Quick Wrap-up

Linux has various commands and methods to delete a file quickly. However, users must know how to delete files to maintain an organized system and minimal storage consumption. This quick tutorial explained two ways of doing so. Initially, we discussed how the rm command works, then explained briefly the step-by-step process of deleting files using the GUI.

The Logrotate utility simplifies the process of administering log files. It relocates and replaces log files to manage their size and organize them while maintaining the information present inside them. For example, it will maintain seven log files to keep daily records for seven days.

While rotating the log files, Logrotate deletes irrelevant old logs, preventing them from consuming excessive disk space. It runs periodically in the background to keep your systems organized and clean. So, if you want to learn about Logrotate, this blog is for you. Here, we have included in-depth information about how to set Logrotate on Linux.

How To Set Logrotate on Linux

Although many Linux distributions have Logrotate as the pre-installed utility. However, if your system does not have Logrotate, please use the following command to install it:

sudo apt install logrotate

command-to-install-logrotate-in-linux

Now, let’s move to the configuration part. There are two kinds of logrotate configurations– global and system-specific. Open the ‘/etc/logrotate.conf’ file using a text editor. It is Logrotate’s primary configuration file, and any changes made to it will affect the whole system.

sudo nano /etc/logrotate.conf

information-in-the-logrotate-config-file

This file has three key sections:

  1. To specify the rotation frequency, i.e., the time it should rotate the logs. It is set to weekly by default, but you can change it to daily, weekly, or monthly.
  2. To define the number of rotated files it should keep, adjust the value based on how much historical data you want to retain. For instance, ‘rotate 4’ guides it to keep the latest four rotated log files and delete the earlier ones to free up disk space.
  3. The third is to specify the permissions and ownership of the new log files it’ll create.

You can tweak these settings according to what suits your system best. For instance, to maintain weekly records for one month(28 days), you must enter:

weekly
rotate 4
create 0644 root root

This way, it will rotate one file weekly and keep four such files. Further, it creates a new log file for currently occurring events while giving the root user and group the read-and-write permissions and read-only for others.

If you have to monitor a specific application’s logs for underlying issues. In that case, you can tailor log rotation settings for that application by creating its separate logrotate configuration file. Let’s take an example of conda. First, create its file using:

sudo nano /etc/logrotate.d/conda

In this file, add configurations specific to the conda logs:

/var/log/conda/*.log {
weekly
rotate 4
compress
delaycompress
missingok
notifempty
create 0644 root root
}

information-for-the-logrotate

Here, the compress command guides to compress the files so that resulting files take up less space. With the delaycompress command, you can hold the latest rotated file uncompressed to make it convenient for the users to refer to it.

The missingok option tells logrotate to ignore the absence of a log file and continue its operations without any error. At last, with notifempty, logrotate won’t rotate any empty log file. The logrotate should run automatically as per the default settings. However, you must confirm it using:

nano /etc/cron.daily/logrotate

A Quick Wrap-up

Knowing the configuration process of the logrotate utility is crucial for system administrators and is also essential for disk management in Linux devices. Hence, this blog explains the approaches used to set logrotate on Linux. You can modify configurations globally and simultaneously change them for specific applications. Moreover, system-specific configurations should be used responsibly because they always override global settings.

Cron is a time-based job scheduler that lets you schedule tasks and run scripts periodically at a fixed time, date, or interval. Moreover, these tasks are called cron jobs. With cron jobs, you can efficiently perform repetitive tasks like clearing cache, synchronizing data, system backup and maintenance, etc.

These cron jobs also have other features like command automation, which can significantly reduce the chances of human errors. However, many Linux users face multiple issues while setting up a cron job. So, this article provides examples of how to set up a cron job in Linux.

How To Set up a Cron Job

Firstly, you must know about the crontab file to set up a cron job in Linux. You can access this file to view information about existing cron jobs and edit it to introduce new ones. Before directly opening the crontab file, use the below command to check that your system has the cron utility:

sudo apt list cron

showing-the-list-of-currently-active-crons

If it does not provide an output as shown in the given image, install cron using:

sudo apt-get install cron -y

Now, verify that the cron service is active by using the command as follows:

service cron status

checking-the-cron-service-status

Once you are done, edit the crontab to start a new cron job:

crontab -e

The system will ask you to select a particular text editor. For example, we use the nano editor by entering ‘1’ as input. However, you can choose any of the editors because the factor affecting a cron job is its format, which we’ll explain in the next steps.

After choosing an editor, the crontab file will open in a new window with basic instructions displayed at the top.

instructions-of-cron-jobs

Finally, append the following crontab expression in the file:

* * * * * /path/script

Here, each respective asterisk (*) indicates minutes, hours, daily, weekly, and monthly. This defines every aspect of time so that the cron job can execute smoothly at the scheduled time. Moreover, replace the terms path and script with the path containing the target script and the script’s name, respectively.

Time Format to Schedule Cron Jobs

As the time format discussed in the above command can be confusing, let’s discuss its format in brief:

  1. In the Minutes field, you can enter values in the range 0-59, where 0 and 59 represent the minutes visible on a clock. For an input number, like 9, the job will run at the 9th minute every hour.

  2. For Hours, you can input values ranging from 0 to 23. For instance, the value for 2 PM would be ’14.’

  3. The Day of the Month can be anywhere between 1 and 31, where 1 and 31 again indicate the first and last Day of the Month. For value 17, the cron job will run on the 17th Day of every Month.

  4. In place of Month, you can enter the range 1 to 12, where 1 means January and 12 means December. The task will be executed only during the Month you specify here.

Note: The value ‘*’ means every acceptable value. For example, if ‘*’ is used in place of the minutes’ field, the task will run every minute of the specified hour.

For example, below is the expression to schedule a cron job for 9:30 AM every Tuesday:

30 9 * * 2 /path/script

For example, to set up a cron job for 5 PM on weekends in April:

0 17 * 4 0,6-7 /path/script

As the above command demonstrates, you can use a comma and a dash to provide multiple values in a field. So, the upcoming section will explain the use of various operators in a crontab expression.

Arithmetic Operators for Cron Jobs

Regardless of your experience in Linux, you’ll often need to automate jobs to run twice a year, thrice a month, and more. In this case, you can use operators to modify a single cron job to run at different times.

  1. Dash (-): You can specify a range of values using a dash. For instance, to set up a cron job from 12 AM to 12 PM, you can enter * 0-12 * * * /path/script.

  2. Forward Slash (/): A slash helps you divide a field’s acceptable values into multiple values. For example, to make a cron job run quarterly, you’ll enter * * * /3 * /path/script.

  3. Comma (,): A comma separates two different values in a single input field. For example, the cron expression for a task to be executed on Mondays and Wednesdays is * * * * 1,3 /path/script.

  4. Asterisk (*): As discussed above, the asterisk represents all values the input field accepts. It means an asterisk in place of the Month’s field will schedule a cron job for every Month.

Commands to Manage a Cron Job

Managing the cron jobs is also an essential aspect. Hence, here are a few commands you can use to list, edit, and delete a cron job:

  1. The l option is used to display the list of cron jobs.

  2. The r option removes all cron jobs.

  3. The e option edits the crontab file.

All the users of your system get their separate crontab files. However, you can also perform the above operations on their files by adding their username between the commands– crontab -u username [options].

A Quick Wrap-up

Executing repetitive tasks is a time-intensive process that reduces your efficiency as an administrator. Cron jobs let you automate tasks like running a script or commands at a specific time, reducing redundant workload. Hence, this article comprehensively explains how to create a cron job in Linux. Furthermore, we briefed the proper usage of the time format and the arithmetic operators using appropriate examples.

Processes are the running instances of programs that consume system resources. Listing these processes helps you monitor system activity, and  troubleshoot issues. That’s why there are multiple tools and utilities in Linux that you can use to list the currently running process.

However, many beginners don’t know the exact way to list the process without errors. So, in this short article, we will explain different methods to list the process in Linux. We have divided this section into multiple parts to give you the best commands to list the processes in Linux.

The ps Command

The ps, or “process status,” is the most common utility to list processes in the terminal:

ps -e

ps-e-command-results

The -e option guides ps to show every process regardless of whether the user owns those processes. Furthermore, you can customize the ps command to produce additional details using the “aux” options:

ps aux

ps-aux-command-result

The top Command

If you desire to view the real-time list of system processes, please use the top command. It continuously updates the process list according to new and completed processes, providing more accurate results:

top

top-command-result

The above command on execution shows the list of processes as per their CPU consumption. Moreover, You can not interact with the terminal until you press “q” to quit the top utility.

The pstree Command

The pstree is very different from the above two commands because it displays the hierarchical relationship of processes in a tree-like structure. It helps you visually understand how a process starts and its connection with other active processes.

pstree

pstree-command-result

The Glances Tool

The Glances tool provides a brief overview of the currently running process. However, you have to install the tool by running the below command: 

Operating System Command
Debian/Ubuntu sudo apt install glances
Fedora sudo dnf install glances
Arch Linux sudo pacman -Sy glances
openSUSE sudo zypper install glances

After the successful installation, you can open the Glances by running the following command:

glances

glances-command-results

A Quick Summary

Knowing how to list processes can help free up the space and turn off the currently running process. This article covered four ways– the top, ps, pstree, and pgrep commands. You can choose to use any of them according to what suits you best. We recommend you use any commands carefully, or you may get errors.

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.