Linux Articles

Page 113 of 134

How to Search and Remove Directories Recursively on Linux?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 608 Views

Removing directories is a regular process for anyone working on Unix systems. But sometimes we also need to find the directories first and then decide to delete them. One hurdle in deleting directories is doing recursive deletion because by default Unix systems do not allow deleting of a directory if it is not empty. In this article we will see how to find and remove directories recursively using two effective methods. Using find and exec The find command with -exec searches for directories and executes the removal command directly. This method is efficient for finding and deleting directories ...

Read More

How to Re-run Last Executed Commands in Linux?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 388 Views

Re-running commands in the Linux terminal is a common task that saves time and effort. Linux provides several built-in methods to execute previously run commands without retyping them. Understanding these shortcuts improves productivity when working with the command line. Viewing Command History Before re-executing commands, you can view your command history using the history command. This displays all previously executed commands with line numbers ? history The output shows numbered commands from your session history ? 1 perl -v 2 sudo apt update 3 cal 4 ls -l 5 curl -s https://ipvigilante.com/122.175.62.177 ...

Read More

How to Force User to Change Password at Next Login in Linux?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 765 Views

For security purposes, system administrators often need to force users to change their passwords at the next login. Linux provides several commands to manage password expiration and enforce password changes. This article demonstrates how to force a user to update their password on next login. List System Users First, let's view all users available in the system ? cut -d: -f1 /etc/passwd The output shows all system users ? mail news uucp proxy www-data backup list ... ubuntu uname1 Check Current Password Settings Before making changes, examine the current ...

Read More

How to Find User Account Info and Login Details in Linux?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 5K+ Views

For system administrators, monitoring user account information is essential for security and system management. Linux provides several powerful commands to gather details about users, their login history, group memberships, and current activity. id Command The id command displays user and group identification numbers along with group memberships. It shows details for the current user by default, or you can specify a particular user. id id 2112 Running the above commands gives us the following result ? uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu), 4(adm), 24(cdrom), 27(sudo), 30(dip), 46(plugdev), 113(lpadmin), 128(sambashare) uid=2112(uname1) gid=2112(uname1) groups=2112(uname1) The ...

Read More

How to Find Linux Server Geographic Location in Terminal?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 4K+ Views

When you need to find the geographic location of a Linux server for security purposes, cyber-crime investigations, or compliance requirements, you can track its location using its IP address and third-party geolocation services. This process involves getting the server's IP address and mapping it to geographic coordinates using web APIs. Step 1 − Install Required Tools First, install curl and jq packages. The curl tool makes HTTP requests to geolocation APIs, while jq processes the JSON responses ? sudo apt-get install curl jq The output shows the installation progress ? $ sudo ...

Read More

How to Empty or Delete a Large File Content in Linux?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 989 Views

Continuously growing log files and data files often need to be emptied periodically to free up disk space while preserving the file structure. Linux provides several efficient methods to empty large files without deleting them entirely. Using /dev/null Redirection The most common method redirects empty output from /dev/null to overwrite the target file ? # Check original file size $ ls -lt ref_file.txt -rw-rw-r-- 1 ubuntu ubuntu 2925 Jan 1 08:39 ref_file.txt # Redirect empty output to file $ cat /dev/null > ref_file.txt # Verify file is now empty $ ls -lt ref_file.txt -rw-rw-r-- ...

Read More

How to Download and Extract Tar Files with One Command in Linux

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 6K+ Views

We can download any required file from the web using the Linux terminal. But many times it is found that the downloaded file is a zipped file which is in tar format. In this article we will see how to download and extract the file in a single command. Using wget and tar The wget command downloads the data from the given URL while the tar command does the extraction of the tar.gz files. By combining them with a pipe, we can download and extract in one operation ? $ wget -c https://www.metoffice.gov.uk/hadobs/hadisd/v300_2018f/data/WMO_200000-249999.tar.gz -O - | ...

Read More

How to download a website page on Linux terminal?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 8K+ Views

Linux command line provides powerful tools for downloading web content and offline browsing. The most popular tools are wget and cURL, which can download individual webpages or entire websites from various protocols. Using wget Wget is the most famous downloading tool that supports HTTP, HTTPS, and FTP protocols. It can download entire websites and supports proxy browsing. Check if wget is Available ubuntu@ubuntu:~$ which wget ; echo $? Running the above code gives us the following result ? /usr/bin/wget 0 If the exit code ($?) is 1, then install ...

Read More

How to do simple Arithmetic on Linux Terminal?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 592 Views

While GUI-based Linux desktops provide calculator applications similar to Windows, the Linux terminal offers powerful features for both simple and advanced arithmetic calculations. This article demonstrates how to perform various calculations directly from the Linux terminal. Using bc (Basic Calculator) The bc command stands for "basic calculator" and supports arithmetic operations, variables, comparison operators, mathematical functions, conditional statements, and loops. Below are some practical examples ? Interactive bc Mode Type bc to enter interactive mode where results appear immediately below your calculations ? $ bc bc 1.06.95 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 ...

Read More

How to disable delete permission of File and Directory in Linux?

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 2K+ Views

Sometimes you need to protect important files and directories from accidental deletion in Linux. The chattr command allows you to change file attributes to make files immutable, preventing deletion even with root privileges. Syntax chattr [operator] [flag] [filename] Where: operator: + (add), - (remove), or = (set exactly) flag: i makes the file immutable (cannot be modified or deleted) Checking Current File Attributes First, let's examine the current attributes of files in a directory using lsattr ? $ pwd ; ls -l /home/ubuntu/Documents/tutorials total 4 drwxrwxr-x 2 ubuntu ubuntu ...

Read More
Showing 1121–1130 of 1,337 articles
« Prev 1 111 112 113 114 115 134 Next »
Advertisements