How to read and change the value of kernel parameters using sysctl

How to read and change the value of kernel parameters using sysctl

Sysctl is a utility installed by default in all modern Linux distributions. It is used both to read and write the value of kernel parameters at runtime; the available parameters are those listed under the /proc pseudo-filesystem, and specifically under the /proc/sys directory. In this article we learn how to use this utility, how to make changes persist a reboot, and how to load settings from a file “manually”.

In this tutorial you will learn:

  • How to read the value of kernel parameters
  • How to modify the value of kernel parameters at runtime
  • How to make changes persist a reboot
  • How to load settings from a file manually

Read more

What is dmesg, And How Do I Use It?

What is dmesg in Linux, And How Do I Use It?

If you have been using Linux for some time, you will likely have come to appreciate how stable and configurable it is, especially if you have some idea of managing a Linux system well. One such tool in managing a system is checking the dmesg kernel log regularly, and especially when there is a problem with the system. The first place to go to is often the dmesg log.

In this tutorial, you will learn:

  • How to access the dmesg kernel log
  • How to use standard date and timestamps instead of the default (the number seconds since kernel was started)
  • What sort of information you can see in the kernel log

Read more

Hung Linux System? How to Escape to the Command Line and More

Hung Linux System? How to Escape to the Command Line and More

It is not much fun when your Desktop hangs. The fear of lost work, the inability to continue work, and more. But it need not always be like this. Knowing just a little extra – a few shortcut keyboard combinations and a few commands at the command line – will hopefully get you back up and running quickly. It does not always work, but it works often.

In this tutorial, you will learn:

  • How to do basic immediate troubleshooting steps on a hung system
  • How to execute a memory test using a Memtest86+ ISO image burned to disc
  • A number of keyboard shortcuts that will empower you to handle hung systems better
  • Information about what avenues to take to do further troubleshooting steps

Read more

Adding a new user with custom home directory on Linux

How to create a user with a custom home directory on Linux

Normal user accounts on Linux have their own home directory. This is the location where all of the user account’s personal files typically reside, including their recent downloads, desktop contents, etc.

By default, a user’s home directory is usually located at /home/username where “username” is the name of the user account. However, you can actually place a user’s home directory just about anywhere you’d like. Linux gives us the option to choose a location for the home directory whenever we are creating a new user.

In this guide, we’ll go over the commands needed to specify a custom home directory when creating a new user on Linux.

In this tutorial you will learn:

  • How to create a user with a custom home directory
Adding a new user with custom home directory on Linux

Adding a new user with custom home directory on Linux

Read more

Mounting and accessing an ISO file in Linux

How to mount ISO image on Linux

An ISO file is an image file of a CD/DVD or other disc. It contains all the files from the disc, neatly packed into a single .iso file. This allows users to burn new copies of the disc, or they can open the ISO file to browse and copy its contents to their system.

An ISO file can also be mounted, which is the virtual equivalent to inserting a disc into your PC. The operating system will treat the ISO as a physical CD rom. In this guide, we’ll see how to open and mount an ISO file on a Linux system. This can be done from both command line and GUI, so we’ll be covering the steps for both methods.

Since the instructions will vary depending on what desktop environment you’re using, we’ll be covering the steps for GNOME, KDE, and Xfce. The steps for command line should be the same across any Linux distribution.

In this tutorial you will learn:

  • How to open and mount an ISO file via GNOME GUI
  • How to open and mount an ISO file via KDE GUI
  • How to open and mount an ISO file via Xfce GUI
  • How to open and mount an ISO file via command line
Mounting and accessing an ISO file in Linux

Mounting and accessing an ISO file in Linux

Read more

Multiple commands showing the kernel version of a Linux system

How to check Kernel version on Linux

Every Linux system is running a Linux kernel, which serves as the foundation for a fully packaged operating system. As technology evolves, the Linux kernel receives updates to accommodate new hardware, features, and security patches.

Keeping your Linux kernel up to date is an important task for administrators and users alike. Do you know what kernel version your Linux distribution is running? In this guide, we’ll show you how to find the Linux kernel version through various command line utilities.

In this tutorial you will learn:

  • How to check kernel version with uname, hostnamectl, and /proc/version
Multiple commands showing the kernel version of a Linux system

Multiple commands showing the kernel version of a Linux system

Read more

Finding large files on Linux

How to find large files on Linux

When it comes to tidying up your hard drive on Linux, either to free up space or to become more organized, it’s helpful to identify which files are consuming the most storage space.

In this guide, we’ll show you how to identify the largest files on your Linux system, through both command line and GUI methods. You can also see our other guide on checking disk usage by folder if you’d like to identify hefty directories instead of individual files.

In this tutorial you will learn:

  • How to find large files via command line with find
  • How to find large files via GUI with QDirStat

Finding large files on Linux

Finding large files on Linux

Read more

Disabling SELinux

How to disable SELinux

SELinux, which stands for Security Enhanced Linux, is an extra layer of security control built for Linux systems. The original version of SELinux was developed by the NSA. Other key contributors include Red Hat, which has enabled it by default in their own RHEL and its derivative Linux distributions.

Although SELinux can protect our system through access control for programs and system services, it’s not always necessary to have it enabled. Some users may even find that it interferes with certain programs they try to install. Certain distributions also have their own recommended alternative to SELinux. For example, Ubuntu uses AppArmor, which should be used instead of SELinux. In this guide, we’ll go over the step by step instructions to disable SELinux on all major Linux distributions.

In this tutorial you will learn:

  • How to check the status of SELinux
  • How to put SELinux in permissive mode
  • How to disable SELinux
Disabling SELinux

Disabling SELinux

Read more

How to compare files using diff

How to compare files using diff

The diff utility is, in the vast majority of cases, installed by default in every Linux distribution out there. The program is used to calculate and display the differences between the contents of two files. It is mainly used when working with source code two compare the same versions of two files and highlight the differences between them. In this article we will learn the various modes in which diff can work and how to create a diff file which can later be applied as a patch with the patch utility.

In this tutorial you will learn:

  • How to use diff
  • How to display the output of diff on two columns when using diff in normal mode
  • How to read the diff output in normal, context and unified mode
  • How to create a diff file and apply it as a patch with the patch utility

Read more

How to use bridged networking with libvirt and KVM

How to use bridged networking with libvirt and KVM

Libvirt is a free and open source software which provides API to manage various aspects of virtual machines. On Linux it is commonly used in conjunction with KVM and Qemu. Among other things, libvirt is used to create and manage virtual networks. The default network created when libvirt is used is called “default” and uses NAT (Network Address Translation) and packet forwarding to connect the emulated systems with the “outside” world (both the host system and the internet). In this tutorial we will see how to create a different setup using Bridged networking.

In this tutorial you will learn:

  • How to create a virtual bridge
  • How to add a physical interface to a bridge
  • How to make the bridge configuration persistent
  • How to modify firmware rules to allow traffic to the virtual machine
  • How to create a new virtual network and use it in a virtual machine
How to use bridged networking with libvirt and KVM

How to use bridged networking with libvirt and KVM

Read more

time command on Linux

How to use time command on Linux

The time command is a very simple, but useful command line utility in Linux. Essentially, you can think of it as a stopwatch built into the terminal, as it measures the amount of time it takes to execute a specified Linux command.

In this guide, we’ll show you how to use the time command through various examples, and teach you how to interpret its output. We’ll also show how to use GNU time, which is different than the time utility built into the Bash and zsh shells.

In this tutorial you will learn:

  • How to use time command
  • How to use GNU time
  • How to interpret the output of the time and GNU time commands
time command on Linux

time command on Linux

Read more

How to delete a directory on Linux

How to delete directory on Linux

Deleting a directory (also called folder) on Linux is a common task that every user will have to perform at some time or another. This can be done via any desktop environment that you have installed, or from command line with the rm command.

While this is a pretty basic function, there are some important caveats to keep in mind. In this guide, we’ll go over several examples of deleting a directory on Linux. Feel free to follow along on your own system in order to master the rm command and GUI process.

In this tutorial you will learn:

  • How to delete a directory via GUI
  • How to delete a directory via command line
How to delete a directory on Linux

How to delete a directory on Linux

Read more