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 109 of 134
How To Use The Bash read Command?
The read command is one of the most fundamental commands in Bash scripting. It is used to read input from the user or from a file. In this article, we will explore how to use the read command effectively, with several examples and their output. Basic Usage of read Command The most basic usage of the read command is to take input from the user. Here's a simple example − Example echo "Please enter your name: " read name echo "Hello, $name" When you run this script, it will prompt you to enter ...
Read MoreBash Special Variables in Linux
Bash (Bourne Again SHell) is the default shell for most Linux systems. It is a command language interpreter that executes commands from standard input, files, or command-line arguments. Bash provides a set of special variables that contain various system-related and user-related information. These variables are automatically set by the shell and provide crucial data for script execution and system monitoring. What are Bash Special Variables? Bash special variables are predefined variables that store system and user-related information. They are prefixed with the $ symbol and are automatically updated by the shell. These variables are essential for creating robust ...
Read MoreHow can I use wstring(s) in Linux APIs
Wide character strings (wstrings) are sequences of wide characters that can represent Unicode characters from multiple languages and special symbols. In Linux programming, wstrings enable robust text handling for international applications, supporting characters from Arabic, Chinese, Russian, and special symbols like accents and emojis. What are wstrings and why use them? A wstring is a sequence of wide characters where each character uses the wchar_t data type, typically requiring more bytes than regular characters. This expanded representation allows encoding of characters beyond the ASCII range. Benefits of using wstrings in Linux APIs include: Unicode support ...
Read MoreUses of Exec Command in Linux
The exec command is a built-in command in Unix and Linux shells that replaces the current shell process with a new process. Unlike regular command execution that creates a child process, exec overlays the current process entirely, making it particularly useful for process management and resource optimization in shell scripts. The basic syntax of the exec command is: exec [-cl] [-a name] [command [arguments...]] [redirection...] How Exec Works When you execute a command normally, the shell creates a new child process while keeping the parent shell running. With exec, the new command completely replaces ...
Read MoreFind the Total Size of All Files in a Directory on Linux
Finding the total size of all files in a directory is a common task for Linux system administrators and users who need to monitor disk usage and manage storage effectively. Linux provides several command-line tools and GUI applications to calculate directory sizes in various formats. Understanding directory sizes helps users identify storage bottlenecks, clean up unnecessary files, and optimize system performance. This guide covers multiple methods to find the total size of directories on Linux systems. Finding the Total Size Using Command-Line Tools The du Command The du (disk usage) command is the most commonly used ...
Read MoreList the Size of Each File and Directory and Sort by Size in Linux
Listing and sorting files and directories by size is essential for system administration, disk space management, and file organization. Linux provides multiple command-line tools and GUI methods to accomplish this task efficiently. This guide covers various approaches to list files and directories sorted by their size. Command Line Methods Using the ls Command The ls command is the most common tool for listing directory contents. By default, it sorts entries alphabetically, but you can modify this behavior with specific options. Basic listing with detailed information: ls -la This displays all files (including ...
Read MoreGet the Full Path of a File in Linux
Every file and folder in Linux has a path that directs the user to it. This path is required for programs and scripts to locate and access files. There are various ways to locate the path to a file or folder if you need to. We can get a full file path with different commands on a Linux machine. In this tutorial, we'll show you how to obtain a file's complete path in Linux using multiple command-line methods. Understanding File Paths in Linux In Linux, there are two different kinds of paths: absolute and relative. A forward ...
Read MoreHow to display the current working directory in the Linux system?
To print the current working directory, we use the pwd command in the Linux system. pwd (print working directory) − The pwd command is used to display the name of the current working directory in the Linux system using the terminal. This is a shell builtin command that is available in most Unix shells such as Bourne shell, ash, bash, ksh, and zsh. Syntax The general syntax of the pwd command is as follows − pwd [-LP] A brief description of options available in the pwd command. Option Description ...
Read MoreHow to change the file owner and group in Linux?
To change the file owner and group, we use the chown command in the Linux operating system. Linux is a multiuser operating system where every file and directory belongs to an owner and group. The chown command allows administrators to transfer ownership and group membership of files and directories. Syntax The general syntax of the chown command is as follows − chown [OPTION]... [OWNER][:[GROUP]] FILE... chown [OPTION]... --reference=RFILE FILE... Common Options Option Description -c, --changes Gives a diagnosis for all files that actually changed ...
Read MoreHow to create a symbolic link to a directory in Ubuntu?
Symbolic links (symlinks) in Linux are advanced shortcuts that point to another file or directory on your system. A symbolic link appears to be the same as the original file or directory it references, even though it's simply a pointer. This powerful feature allows you to create references to files and directories located elsewhere in the filesystem. What are Symbolic Links? Symbolic links are essentially file system objects that contain a path to another file or directory. When you access a symbolic link, the operating system automatically redirects you to the target location. This is particularly useful for ...
Read More