Overview A programmer may want to write three different programs. However, he realizes that some of the functionality needed for each program could be shared among them. Therefore, he decides to create a library containing these shared features. A library is basically a collection of code and data that other people can use. On Linux, archives (located at the.a file extension) contain compiled code, whereas shared objects (.so files) contain interpreted code. Here, we’ll examine how software runs under Linux and the purposes of the library and archive files. We’ll also see some examples of how we can create these ... Read More
Overview This article will show you how to protect your files from unauthorized access using the Linux file system permissions, and how to use chmod command to set permissions for a specific user or group of users. Besides the Linux file permission mechanisms that help us keep our files safe from misuses, most Linux shells have built-in safeguards against accidental file overwrite. We’ll cover some of them here. Protecting Files With noclobber All POSIX shell implementations support the noclobber option. If you're using a shell script, meaning the shell will complain if you try to overwrite an existing directory. By ... Read More
Overview There are many different ways to compress and collect file on Linux systems. We have several options for doing so: using the command line tools, GUI applications. However, if we share files with Windows or Mac users, the ZIP file remains the most convenient option. We want to maintain its convenience. We’ll look at how to organize our files so they aren't cluttered with unnecessary folders. We'll learn some basic file management techniques. These might seem obvious if you're doing them manually, but can get tricky when you're working with scripts. We'll use the bash shell's built−in push/pop commands ... Read More
Overview We'll learn how to remove empty directories and empty file on Linux. Empty directories don't take up any disk space, but they're good to keep them tidy. We should clear out old files and folders periodically. All the instructions in this tutorial are for Linux systems. They won't work on Windows. Delete Empty Files in a Directory You can use the `find` command to remove all the empty files in an existing folder. $ find . -type f -empty -print -delete To delete empty directories, we first need to search for all the empty folders in the specified ... Read More
Overview Here, we’ll see how we can validate the syntactical correctness of a bash script without actually executing it. We’re going to examine some of the Bash and external tools that can be used for that task. Configure Let’s first write a simple script that we’ll be using in almost every example throughout the tutorial. $ cat unity_check.sh #! /bin/bash read -p "Enter the input: " num1 if [ -z "$num1" ] then echo "The number is empty" exit 0 fi if [ "${num1}" -eq 1 ] then echo "Number entered is 1" else echo "Not equal to One !!" ... Read More
Overview We often use shell scripts or work with Linux commands when handling paths. Extracting the last part of a given file name is a fairly common task. For example, if we're trying to access /tmp/dir/target, then we want to be able to access target as a file name. Yes, this looks easy enough. But there might be some edge cases that could cause us to fail. We’ll take a close look at this problem and explore some common solutions. Discussion of Common Solutions We know that Linux file systems don't allow slashes (/) to be parts of filenames or ... Read More
Huffman coding is a lossless data compression algorithm. In this algorithm, a variable-length code is assigned to input different characters. The code length is related to how frequently characters are used. Most frequent characters have the smallest codes and longer codes for least frequent characters.There are mainly two parts. First one to create a Huffman tree, and another one to traverse the tree to find codes.For an example, consider some strings “YYYZXXYYX”, the frequency of character Y is larger than X and the character Z has the least frequency. So the length of the code for Y is smaller than ... Read More
Overview When working with SSH keys, it is important to keep them safe. We can protect ourselves against accidental deletion by storing them in an encrypted file. We can also make sure they aren’t compromised if someone tries to steal them by keeping them offline. For example, we could store them in a password protected folder on a USB drive. However, this isn’t the best way to do things. If you have multiple machines and want to copy your key from one machine to another, then there are better ways of doing that than copying the key files over. This ... Read More
Overview We’ll go through some of the features available on the CPU installed on our computer’s motherboard. We’ll briefly look at the concept of virtual file systems before we dive into the details of the topic. Afterward, we’ll discuss the flags obtained from the /proc/cpuinfo virtual directory for different CPU manufacturers such Intel, AMD, and Arm. Virtual Files A virtual file system (VFS) is an abstraction layer that allows us to treat files as if they were stored on a disk drive. The VFS provides a way to access data without having to know where it actually resides. For example, ... Read More
In this article, we will discuss how to get the denominator from a rational number. Rational numbers − In mathematics, rational numbers are defined as numbers that can be expressed in the form of a/b where a and b are integer values. For example- 1/3, 5/8 etc. Note that the denominator of a rational number can never be zero. Syntax func NewRat(a, b int64) *Rat func (x *Rat) Denom() *Int NewRat() function takes two integer numbers as input arguments and returns a rational number in the form of a/b. here a is the numerator and b is the denominator ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP