Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Linux Articles
Page 112 of 134
How to decorate your Linux Terminal using Shell?
The Linux terminal appearance can be customized using shell commands and environment variables. While GUI settings provide basic customization, shell commands offer more precise control over colors, fonts, and prompt formatting in Ubuntu-based systems. Most terminal customizations are handled through environment variables that can be modified using shell commands. The primary variable for controlling the terminal prompt is PS1. The PS1 Variable The PS1 variable controls the primary prompt string displayed when the shell is ready to read a command. It uses backslash-escaped special characters to determine what appears at the prompt ? echo $PS1 ...
Read MoreHow to create an Animated Art on Your Linux Terminal?
Linux terminals can display animated art using ASCII characters and specialized packages. These animations range from simple moving text to complex scenes like trains and castles, created using shell scripting and command-line utilities. Installing and Running the Steam Locomotive The sl package creates a fun train animation that "runs" across your terminal screen. Install it using the package manager and execute with a simple command ? sudo apt-get install sl sl Running the above code displays an animated steam locomotive moving across your terminal ? Creating ASCII Castle Animation You ...
Read MoreHow to Create a New Ext4 File System in Linux?
Creating a new Ext4 file system in Linux involves formatting a partition with the Ext4 file system type. This is essential when adding new storage or repurposing existing partitions. In this tutorial, we'll explore how to identify available file systems, examine current partitions, and format a partition with Ext4. Available Filesystem Types First, let's check what file system tools are available on your system. The following command lists all the file system creation utilities ? $ ls -1 /sbin/mkfs* /sbin/mkfs /sbin/mkfs.bfs /sbin/mkfs.cramfs /sbin/mkfs.ext2 /sbin/mkfs.ext3 /sbin/mkfs.ext4 /sbin/mkfs.ext4dev /sbin/mkfs.fat /sbin/mkfs.minix /sbin/mkfs.msdos /sbin/mkfs.ntfs /sbin/mkfs.vfat ...
Read MoreHow to Change or Set System Locales in Linux
We often need to customise the operating system to match our preferences like the language we want to use, the time zone we are in, or the type of currency which would become the default in the OS. In this article we will see how to customise these options which is known as locale. Checking Current Locale We can check the current locale by using the locale command as shown below. We get a list of variables which can be reset to different values as per our choice ? $ locale Running the above ...
Read MoreDisplay Command Output or File Contents in Column Format in Linux
When working with files containing multiple columns, data can appear cramped and difficult to read. The column command in Linux helps format text into readable columns with proper spacing and alignment, making data analysis much easier. Sample File Let's examine a sample CSV file with iris dataset that we'll use to demonstrate the column command ? $ cat iris.data The output shows cramped CSV data ? Id, SepalLengthCm, SepalWidthCm, PetalLengthCm, PetalWidthCm, Species 1, 5.1, 3.5, 1.4, 0.2, Iris-setosa 2, 4.9, 3.0, 1.4, 0.2, Iris-setosa 3, 4.7, 3.2, 1.3, 0.2, Iris-setosa 4, 4.6, ...
Read MoreWhy should eval be avoided in Bash, and what should I use instead?
eval is a built-in Bash command that concatenates its arguments into a single string, joins them with spaces, then executes that string as a bash command. While powerful, eval poses serious security risks and should generally be avoided. How eval Works Let's see a basic example of eval in action − $ var="echo hello" $ echo $var $ eval $var Running the above code gives us the following result − echo hello hello When eval is applied, the variable expands and gets executed as a command, no longer behaving as ...
Read MoreWhat are the calling conventions for UNIX & Linux system calls on i386 and x86-64
A system call is the fundamental interface between an application and the Linux kernel. When a Unix/Linux program does file I/O, network data transfer, or invokes processes that interact with low-level instructions, system calls are involved. Making these calls usually involves using a library called glibc which contains the functions. Common System Calls Below is a list of some frequently used system calls and their purpose ? Sr.No ...
Read MoreLooping through the content of a file in Bash
Reading file contents line by line is a common requirement in Bash scripting. There are several approaches to accomplish this task, each with its own advantages depending on your specific needs. Creating a Sample File First, let's create a sample file to work with ? # Create the file cat > a_file.txt
Read MoreHow to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script?
When transferring files between Windows and Unix systems, you'll often encounter issues with end-of-line characters. Windows uses CRLF (Carriage Return + Line Feed) while Unix uses LF (Line Feed) only. This guide shows three methods to convert Windows line endings to Unix format using Bash. Understanding the Problem Windows files use \r (CRLF) for line endings, while Unix systems use (LF). When viewing Windows files on Unix, you may see ^M characters at the end of each line. Method 1: Using dos2unix The dos2unix command is specifically designed for this conversion and comes pre-installed on ...
Read MoreLinux WC Command Examples to Count Number of Lines, Words, Characters
The wc command (word count) is a fundamental Linux utility for counting lines, words, characters, and bytes in files. It's commonly used with the -l option for line counting, but offers several other counting options through various arguments. Available Options Option Command Function 1 wc -c Display number of bytes 2 wc -m Display number of characters 3 wc -w Display number of words 4 wc -l Display number of lines 5 wc -L Display length of longest line ...
Read More