Various commands used to detect a connected network cable on Linux

How to detect whether a physical cable is connected to network card slot on Linux

If you’ve ever needed to know whether a physical cable is connected to a network port on your Linux system, you don’t necessarily need to be right in front of the computer or server to look and see. There are several methods we can use from the Linux command line in order to see if a cable is plugged into a network slot.

There are a few reasons why this could come in handy. For one, it shows you whether the system itself detects that there’s a cable plugged in. This could be an essential troubleshooting step if you know for a fact that the cable is properly plugged in, yet the system is not detecting it. It’s also helpful on remote systems or if you’re just too lazy to look at the back of the computer and see if the cable is plugged in.

Check out some of the examples below where we go over various commands that check whether a physical network cable is plugged in or not.

In this tutorial you will learn:

  • How to detect physical network cable connectivity with Bash commands and ethtool

Read more

Recovering deleted files from a FAT filesystem on Linux

Data recovery of deleted files from the FAT filesystem

Although FAT32 or FAT16 are very old file systems, which is reflected in their poor performance in comparison to other file system alternatives, they are still widely used by many electronic devices. Usually, these devices include USB sticks, digital cameras, camcorders and other peripheral storage devices.

There’s a good chance that you own and store personal data on a device with the FAT filesystem. If you accidentally delete important data from the device, we’ve got good news for you: it can be recovered on Linux.

In this guide, we’ll go over the step by step instructions to recover deleted data from the FAT filesystem on Linux. Read on as we use the testdisk command to perform file recovery.

In this tutorial you will learn:

  • How to create a low level backup of FAT filesystem
  • How to install testdisk tool on major Linux distros
  • How to use testdisk to recover deleted files from FAT

Read more

Getting to know the hardware of your Linux box

Getting to know the hardware of your Linux box

When you buy a new PC, laptop, or server and install a Linux distribution, you want to know what hardware is actually installed in the Linux box and more importantly which piece of hardware is supported by the kernel out of the box and which needs special tweaking with modules to get it to work.

This guide features a list of command line examples which should help you to troubleshoot your hardware and find some information about it. This is not an ultimate troubleshooting guide but certainly will serve as a good starting point. Note that some commands may not be available for your platform by default, and some commands may be specific to certain distributions.

In this tutorial you will learn:

  • How to see what hardware is installed via Linux commands

Read more

Retrieving and setting a new UUID for a partition on Linux

How to retrieve and change partition’s UUID Universally Unique Identifier on linux

Hard drive partitions on Linux systems rely on a UUID (universally unique identifier) for unique labels. This is basically a unique string of characters that the operating system will use to identify your hard disk partitions and other storage components.

You can see this for yourself by examining the /etc/fstab file on your own system.

$ grep UUID /etc/fstab

In this guide, we’ll go over several command line methods to retrieve the UUIDs of hard disk partitions. We’ll also show you how to generate UUIDs and change a partition’s UUID.

In this tutorial you will learn:

  • How to retrieve, generate, and change the UUID of a partition

Read more

VSZ and RSS columns in the ps command output

ps output – Difference between VSZ vs RSS memory usage

The ps command on Linux systems is a default command line utility that can give us insight into the processes that are currently running. It can give us a lot of helpful information about these processes, including their PID (process ID), TTY, the user running a command or application, and more.

There are two columns in the output of the ps command that don’t get talked about a lot. These are the VSZ (Virtual Memory Size) and RSS (Resident Set Size) columns. Both columns give us information about how much memory a process is using. In this guide, we’ll go over their meanings and how to interpret the data they show us in the ps command on Linux.

In this tutorial you will learn:

  • How to interpret VSZ and RSS numbers in the ps command output

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

Making use of your older hardware with Linux/BSD

Introduction

Some of you may wonder what is the purpose of this article. First, because hardware nowadays is pretty cheap, you don’t need older hardware anymore. Second, there are some articles across the Internet dealing with this already. The answer to the first problem is: well, you’ll see in the article. The answer to the second is we have some experience with older hardware first-hand, and we found it to be very useful to this day, so we want to share this with you. Older hardware, PC or not, is to be found everywhere, sometimes for free, and you can get to it easily. You will get some ideas from this article, but of course we don’t say the following list is exhaustive. Only your imagination sets the limit. The only knowledge we expect from you is to have some idea what you want to do. If you don’t yet, our article may be of help.

The hardware

Before we start, there are some variables that need some comments. First, the word “older” means different things for different people. To some, it may mean a 6 year-old AMD Athlon processor and 1GB of RAM. To others, “older” may be a PentiumII with 128 MB RAM. This article is mainly focused on the latter part, meaning really old hardware that’s still of some use with Open Source operating systems. Of course, if you have something more powerful, even better. The other variable is the hardware. People can find an old SPARC machine with < 100$ that is still usable, depending of course on what you want to do with it. The places you can find such machines, SPARC, SGI or Intel-based are Ebay, some local shop that sells older computers or even your friendly sysadmin that can’t wait to get rid of old machines. Take note that non-Intel machines will be more expensive, so think twice if you really need some exotic piece of hardware.

Read more

Linux system and hardware monitoring made efficient

Introduction

Whether you’re a home user or a system/network administrator at a large site, monitoring your system helps you in ways you possibly do not know yet. For example, you have important work-related documents on your laptop and one fine day, the hard drive decides to die on you without even saying goodbye. Since most users don’t make backups, you’ll have to call your boss and tell him the latest financial reports are gone. Not nice. But if you used a regularly started (at boot or with cron) disk monitoring and reporting piece of software, like smartd for example, it will tell you when your drive(s) start to become weary. Between us, though, a hard drive may decide to go belly up without warning, so backup your data.

Our article will deal with everything related to system monitoring, whether it’s network, disk or temperature. This subject usually can form enough material for a book, but we will try to give you only the most important information in order to get you started, or, depending on experience, have all the info in one place. You are expected to know your hardware and have basic sysadmin skills, but regardless where you’re coming from, you’ll find something useful here.

Temperature monitoring

Installing the tools

Some “install-everything” distributions may have the package needed for you to monitor the system temperature already there. On other systems, you may need to install it. On Debian or a derivative you can simply do

 # aptitude install lm-sensors

Read more

In-depth HOWTO on Linux kernel configuration

While we talked before about kernel compilation and configuration, we focused on the general idea. This time we want to dig deeper into the configuration part, giving you useful advice you will need when tailoring a kernel to perfectly match your hardware.
The main idea behind this is that you will need to know your hardware extremely well in order to have a kernel built exactly for it. At the beginning we will cover what you will need in order to compile your kernel and after that we move into Linux kernel configuration, compilation and installation. Please note that this time it’s not very important if you compile a vanilla kernel or a distribution kernel. We will however, recommend a “modus operandi”, which of course does not mean that you have to follow. After reading this guide you will be able to decide what suits you best. We expect some moderate knowledge about Linux system internals and development tools.

What you will need

From now on, as stated before, we will show you how we do this, so everything you’ll read will be specific to our system, unless stated otherwise. Typing ‘du -h’ in our kernel source tree shows 1.1G. This is after we typed ‘make clean’. In short, we’d say you better have at least 2.5G available for the kernel tree, since code gets added constantly and object files take quite some space. Also /lib/modules/ will use a lot of disk as time passes, and, if you have a separate /boot partition, that may get crowded too.

Of course, after you configure the kernel, you’ll want to compile it, so the usual suspects must be present : make, git, gcc, the readline library for menuconfig… Speaking of git, you might have heard about the recent break of kernel.org, so if you try to clone the usual location or try to pull, you will get

$  git pull
fatal: Unable to look up git.kernel.org (port 9418) (Name or service not known) 

What you can do is use the new, temporary location of the git tree as announced by Linus Torvalds :

 $ git pull git://github.com/torvalds/linux.git 

Read more

main

Introduction to the lsblk command

Lsblk is a very nice utility installed by default on practically all Linux distributions: we can use it to retrieve a vast range of information about all the block devices attached to the system. In this article we will see how it works and how to use it.

In this tutorial you will learn:

  • How to use the lsblk utility to retrieve information about block devices
  • What is the meaning of the columns displayed in the default utility output
  • How to specify the columns to be displayed and format the output as json or as a list
  • How to display information about a specific device.

Read more

Formatting SD or USB disk on Linux

Formatting SD or USB disk under Linux

In this guide, we go through the steps to format an SD or USB disk in Linux. This can be done via GUI or command line, and we’ll cover the process for both. The guide will be applicable regardless of what Linux distribution you’ve decided to use, especially the command line method.

This will wipe all the data from your USB or SD disk and get it ready for use under Linux or another system. It’s also used to clear the device before creating a bootable live USB drive.

In this tutorial you will learn:

  • How to format an SD or USB disk via GUI
  • How to format an SD or USB disk via command line

Read more

Using webcam on Manjaro Linux

How to test Webcam on Manjaro Linux

Webcam setup on Manjaro Linux and other user-friendly Linux distributions should be automatic. You can usually plug in your webcam and have instant access to it. If you have a built-in camera, that should also work without any extra configuration.

In this guide, we’ll go over testing a webcam on Manjaro and give some troubleshooting pointers in case yours isn’t being detected automatically.

In this tutorial you will learn:

  • How to test webcam

Read more