The stat command is one of the most useful utilities in Linux for examining detailed file and directory information. It provides comprehensive metadata about files including permissions, timestamps, sizes, and filesystem properties. This article explores five essential stat command examples that every Linux newcomer should know. Getting Basic File Information The simplest use of the stat command is to display comprehensive information about a file or directory. Simply use the following syntax − stat filename For example, to examine a file called example.txt − stat example.txt This command produces output ... Read More
Process scheduler assigns different processes to the CPU based on particular scheduling algorithms. Each algorithm has different characteristics regarding fairness, efficiency, and the potential for starvation — a condition where some processes may wait indefinitely. Types of Process Scheduling Algorithms The different types of process scheduling algorithms are as follows − FCFS (First Come First Serve) Jobs are executed on a first come first serve basis using a simple FIFO (First In First Out) queue. It is a non-preemptive algorithm where processes run to completion once started. While simple to implement, its performance is often poor ... Read More
Linux terminal allows us to execute a variety of commands, and often we need to repeat a previously executed command. There are several efficient methods to recall and re-execute the last command without retyping it completely. For demonstration purposes, let's assume we previously ran the command ls -ltr and now want to repeat it using various methods available in Linux. Using Arrow Keys The most basic approach is to press the UP arrow key on your keyboard. This retrieves the last command from your command history, allowing you to press Enter to execute it again or modify ... Read More
A single processor system contains only one CPU that executes one process at a time. The processor selects processes from the ready queue and handles them sequentially. Most general-purpose computers use single processor systems as they are cost-effective and sufficient for everyday computing tasks. In a single processor system, even though multiple applications may be running simultaneously, only one process can actually execute at any given moment. The operating system uses time-sharing to create the illusion of parallel execution by rapidly switching between processes. Architecture of Single Processor Systems Single Processor System Architecture ... Read More
Terminating a thread before it has completed is called thread cancellation. For example, if multiple threads are concurrently searching through a database and one thread returns the result, the remaining threads might be canceled. Another situation occurs when a user presses a stop button on a web browser to halt page loading. Often, a web page loads using several threads — each image is loaded in a separate thread. When the stop button is pressed, all threads loading the page are canceled. A thread that is to be canceled is often referred to as the target thread. Cancellation of ... Read More
When working with the Linux command line, reading specific lines from text files is a common task. Rather than viewing entire files, you often need to extract just one particular line based on its line number. This article explores four different methods to read a specific line from a file using various Linux commands and utilities. Sample File Setup Let's create a sample file called test.txt to demonstrate these methods − $ nl test.txt 1 This is line 1, I don't have any interesting data. ... Read More
The Permission denied error when redirecting output to root-owned files is a common issue in Linux systems. When using sudo command > file, the redirection operator (>) runs under the regular user's privileges, not as root, causing permission failures even when the command itself runs with sudo. Understanding the Problem Consider a file that requires root permissions for writing: kent$ ls -l /opt/output.txt -rw-r--r-- 1 root root 0 May 8 10:43 /opt/output.txt When attempting to redirect output as a regular user: kent$ echo "Linux is awesome!" > /opt/output.txt bash: /opt/output.txt: Permission denied ... Read More
Docker containers provide a packaged environment for applications, making them portable and lightweight while allowing version control. Sometimes you need to create snapshots or backups of running containers for emergency rollbacks or to preserve specific states. This article covers how to backup and restore Docker containers using built-in commands. Note: The backup methods described here work for containers with embedded data. For containers using separate data volumes, you must create separate backups for each volume. Backing up a Docker Container The backup process involves creating a snapshot of the container's current state and saving it as an ... Read More
Linux is an open-source operating system that has been gaining popularity in recent years due to its flexibility, stability, and security. Many people associate Linux with complex programming and difficult user interfaces, but this is not always the case. In fact, there are many Linux distributions that are specifically designed for kids, providing a safe and fun computing environment while teaching them the basics of technology. In this article, we will explore amazing Linux distributions for kids, along with their unique features and benefits. Sugar on a Stick Sugar on a Stick (SoaS) is a Linux distribution designed ... Read More
Computer architecture is a set of rules and methods that describe the functionality, organization, and implementation of computer systems. It defines how a system performs operations and executes instructions, serving as the blueprint for building and understanding computers. Sub-divisions of Computer Architecture Computer architecture can be divided into three main categories − Instruction Set Architecture (ISA) − Defines the interface between software and hardware. It specifies the instructions a processor can execute, data types, registers, memory addressing modes, and interrupt handling. The ISA acts as a contract between software programmers and hardware designers. Microarchitecture − Describes ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Economics & Finance