How to reset lost root password on Ubuntu 16.04 Xenial Xerus Linux

This guide will provide you with an information on how to reset lost root ( administrator ) password on Ubuntu 16.04. This guide assumes that you have the actual physical access to your Ubuntu 16.04 Linux box.

Reboot to Grub Menu

In the first step you need to reboot your Ubuntu 16.04 Linux box to Grub’s menu. If the Ubuntu 16.04 is the only installation available keep pressing SHIFT after you start your computer until GRUB’s menu appears:
reboot your Ubuntu 16.04 Linux box in Grub's menu

Read more

Identifying the CentOS Release version

How to check CentOS version

The purpose of this tutorial is to show how to check the CentOS version of your Linux system. It’s possible to do this from either command line or GUI, so you can use whichever method is more convenient for you. Classic CentOS is nearing its end of life and will be replaced by CentOS Stream. Knowing your CentOS version will give you some insight into how long your system will continue to be supported.

Read more

How to extract a specific file from gzip compressed archive tarball

In order to extract a specific file from gzip compressed archive tarball you first need to know the full path to this file. Consider a following example.

$ tar tzf to-gzip.tar.gz
to-gzip/
to-gzip/file10.txt
to-gzip/file9.txt
to-gzip/file8.txt
to-gzip/file7.txt
to-gzip/file6.txt
to-gzip/file5.txt
to-gzip/file4.txt
to-gzip/file3.txt
to-gzip/file2.txt
to-gzip/file1.txt

Read more

Searching for two different file name patterns in a compressed archive on Linux

Search the contents of compressed gzip archive file on Linux

Archives compressed with gzip have the .tar.gz or .tgz file extension. It’s easy enough to extract the contents from these files, but what if you only need a certain file? There’s not much sense in extracting hundreds or thousands of files from an archive if you’re only looking for a few files.

Fortunately, we can utilize the Linux command line and even GUI archive managers to search the contents of gzip compressed archives. Once we identify the file we want, it’s possible to extract the file by itself, rather than extracting every single file.

In this guide, we’ll show how to search one or multiple gzip archives for a particular file from both command line and GUI.

In this tutorial you will learn:

  • How to search the contents of a compressed gzip archive via command line
  • How to search the contents of a compressed gzip archive via GUI
  • How to search the contents of multiple gzip archives
  • How to extract a particular file from a gzip archive

Read more

Compress file or directory using RAR archive tool on Linux shell

Here is a quick config tip on how to compress and extract files using RAR archive utility. First let’s see how we can compress directory using RAR. In our example we have a directory called my_files containing five files:

$ mkdir my_files
$ touch my_files/file{1..5}
$ ls my_files/
file1  file2  file3  file4  file5

To compress entire directory using RAR archive tool we use rar’s a command. The below command will create a RAR archive called my_files.rar containing all five above files:

$ rar a my_files.rar my_files/

Creating archive my_files.rar

Adding    my_files/file5                                              OK 
Adding    my_files/file4                                              OK 
Adding    my_files/file3                                              OK 
Adding    my_files/file2                                              OK 
Adding    my_files/file1                                              OK 
Done
$ ls -l my_files.rar 
-rw-rw-r--. 1 lrendek lrendek 307 Nov  3 06:55 my_files.rar

Read more

Create a random character text file using Linux shell

Here is a nice trick on how to create a dummy character text file consisting of any chosen or random characters. In the first example we will create and simple file consisting of a single character X with a size of 1000 bytes:

$  < /dev/urandom tr -dc "X" | head -c1000 > file.txt
SAMPLE:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

or we can create a file consisting of an alphabetic and numeric character:

$ < /dev/urandom tr -dc "[:alnum:]" | head -c1000 > file.txt
SAMPLE:
CCjeuAhJNc4yxBfeMbbYX1U1TnSCVS5oiV53MtGoA6s45FAw9H9PyfZJHrA421

Read more