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 42 of 134
How to List All Connected SSH Sessions on Linux
Secure Shell (SSH) is a commonly used protocol for secure remote access to Linux servers. When multiple users are connected to a Linux server via SSH, it can be useful to list all connected SSH sessions for administrative or monitoring purposes. In this article, we will discuss how to list all connected SSH sessions on Linux using various command-line tools. Using the who Command The who command is a simple and widely available command-line tool for listing logged-in users on a Linux system. To list all connected SSH sessions, you can use the who -a command. The -a ...
Read MoreFind and Convert Files Ending With CRLF on Linux
You can use the find command in Linux to search for files ending with CRLF, and the dos2unix command to convert those files to use LF line endings. CRLF (Carriage Return + Line Feed) line endings are commonly used in Windows systems, while LF (Line Feed) endings are standard on Linux systems. Searching for Files With CRLF Endings The most efficient way to find files with CRLF line endings is using grep with the -r (recursive) and -l (list filenames only) options − grep -rl $'\r' /path/to/search This command searches recursively through the specified ...
Read MoreIntroduction to Bash Globbing on Linux
Bash globbing is the process of using wildcard characters to match multiple filenames or paths in the shell. Bash provides several special characters that can be used for globbing, such as *, ?, and []. This feature allows you to perform operations on multiple files without having to specify each filename individually. The * character is a wildcard that can match zero or more characters in a filename or path. For example, the command ls * would list all files in the current directory, while the command ls *.txt would list all files with the .txt extension in the ...
Read MoreExclude grep From ps Results on Linux
The ps command in Linux displays information about running processes on a system. It provides a snapshot of current processes, including process ID (PID), user ownership, CPU and memory usage, and the command that started the process. When using ps with grep to filter processes, the grep command itself often appears in the results, which can be unwanted. Common Problem with ps and grep When searching for specific processes using ps | grep, the grep command itself appears in the output because it's also a running process at that moment: $ ps aux | grep ssh ...
Read MoreHow to Check Logs Using journalctl in Linux
Logs are a crucial component of any Linux system, as they provide a record of system activity, including system events, user actions, and system processes. journalctl is a command-line utility for viewing and managing logs on Linux systems using the systemd initialization system. It provides powerful filtering and formatting capabilities to help administrators monitor system health and troubleshoot issues effectively. Basic journalctl Commands The journalctl command can view and filter system logs for all system services, the kernel, and specific services or users. It can display the entire journal, view logs from a specific boot, or filter logs ...
Read MoreHow to Calculate Optimal Blocksize to Use With dd in Linux
The optimal block size to use with the dd command in Linux depends on the specific use case and the hardware you are working with. However, as a general rule of thumb, it is best to use a block size that is a multiple of the disk's physical block size, as this can lead to better performance. Determining Physical Block Size To determine the physical block size of a disk, you can use several methods. The fdisk command with the -l option will list all partitions on the disk, along with the start and end cylinders, and the ...
Read MoreShowing a GUI Notification From a Shell Script in Linux
GUI notifications from shell scripts in Linux allow you to display visual alerts and messages to users. Two primary tools accomplish this: notify-send for desktop notifications and zenity for interactive dialog boxes. Using the notify-send Command The notify-send command is part of the libnotify library and comes pre-installed on most Linux distributions. It displays brief desktop notifications that appear in the system notification area. Basic Syntax notify-send [options] Simple example displaying a notification − notify-send "Hello" "World" Common Options Option Description Example Values ...
Read MoreRun a Java Application as a Service on Linux
Running a Java application as a service on Linux allows your application to start automatically at boot time, run in the background, and be managed using standard system commands. This approach ensures your Java applications remain running even after terminal sessions are closed and can be controlled through the system service manager. Understanding Linux Services A service (or daemon) in Linux is a background process that performs specific functions without direct user interaction. Services can be started automatically at boot time and controlled using command-line tools or system service managers like systemd or Upstart. To create a ...
Read MoreDelete the History of the Last n Commands on Linux
In Linux, the command history is a record of previously executed commands stored in a file called .bash_history, located in each user's home directory. The history command displays this history, and commands are assigned sequential numbers that can be executed using !number syntax. For example, typing !123 will execute the command numbered 123 in the history. There are several options to customize command history behavior: The history -c command clears the current session's command history. The HISTFILE environment variable specifies a different file to store command history. The HISTSIZE and HISTFILESIZE variables control the maximum number of ...
Read MoreMonitoring Network Usage in Linux
Network monitoring in Linux involves tracking and analyzing network traffic, bandwidth usage, and connection statistics to ensure optimal system performance. Unlike general system monitoring that focuses on CPU and memory, network monitoring specifically targets data flow across network interfaces and helps identify bottlenecks, suspicious activity, and resource-hungry applications. Network Monitoring Tools Linux provides several powerful command-line tools for network monitoring, each serving different purposes − nload − Displays real-time network traffic statistics with visual graphs for interface monitoring. Speedometer − Shows network usage with customizable display formats and measurement units. iftop − Lists active network connections ...
Read More