Discover DevOps roles and learn Linux from basics to advanced at DevOpsRoles.com. Detailed guides and in-depth articles to master Linux for DevOps careers.
In this tutorial, How to run a single command on multiple Linux machines at once. I will create a script on the Linux servers to send commands to multiple servers.
Prerequisites
2 Virtual Machine
ssh Connectivity Between 2 Servers
Configure SSH on Server 1
For example, The Server calls the name controller. This server is using the operating system Ubuntu.
create the SSH config file with the command:
cat ~/.ssh/config
For example, the content as output below
Create the script to run a single command on multiple Linux machines at once
We will create 1 script to run a command for a remote Linux server.
sudo vi /usr/local/bin/script_node1
In that file, paste the following:
#!/bin/bash
# Get the user's input as command
[[ -z ${@} ]] && exit || CMD_EXEC="${@}"
# Get the hosts from ~/.ssh/config
HOSTS=$(grep -Po 'Host\s\Knode1' "$HOME/.ssh/config")
# Test weather the input command uses sudo
if [[ $CMD_EXEC =~ ^sudo ]]
then
# Ask for password
read -sp '[sudo] password for remote_admin: ' password; echo
# Rewrite the command
CMD_EXEC=$(sed "s/^sudo/echo '$password' | sudo -S/" <<< "$CMD_EXEC")
fi
# loop over the hosts and execute the SSH command, remove `-a` to override the>
while IFS= read -r host
do
echo -e '\n\033[1;33m'"HOST: ${host}"'\033[0m'
ssh -n "$host" "$CMD_EXEC 2>&1" | tee -a "/tmp/$(basename "${0}").${host}"
done <<< "$HOSTS"
Save and close the file.
Now, We will update the package for server calls name node1 as command below:
script_node1 sudo apt-get update
Via youtube
Conclusion
You have to run a single command on multiple Linux machines at once. I hope will this your helpful. Thank you for reading the DevopsRoles page!
In this post, How to Install pyenv and manage multiple python versions.
Pyenv is a fantastic tool for installing and managing multiple Python versions. It also offers the ability to quickly switch from one version of Python to another.
Pyenv integrates with the Virtualenv plugin to support creating virtual environments (virtual environments), and library projects will be installed in isolation in this virtual environment without affecting the system.
The output terminal config file ~/.bashrc as below
[vagrant@devopsroles ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
export PATH="/home/vagrant/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
[vagrant@devopsroles ~]$ source .bashrc
[vagrant@devopsroles ~]$ pyenv --version
pyenv 2.2.4
[vagrant@devopsroles ~]$
use pyenv
For example, I will introduce how to use pyenv to set up a virtual environment using python 3.6.6 for the project demo. Path ~/projects/demo
If the installation fails, maybe your system lacks the necessary libraries for compiling, install the missing libraries here
Create a virtual environment with virtualenv, which uses Python 3.6.6.
pyenv virtualenv 3.6.6 app
Enable environment settings
pyenv activate app
To deactivate environment settings
pyenv deactivate app
Useful Commands
Conclusion
You have to Install pyenv and manage multiple python versions. I hope will this your helpful. Thank you for reading the DevopsRoles page! Install pyenv, Install pyenv.
In this tutorial, how to use the fd command in Linux. fd command-line tool to find files in the file system. this tool is very simple.
The “fd” command is not a standard command in Linux. It seems that you might be referring to a specific command that is not part of the core Linux utilities.
What is the ‘fd’ Command?
The ‘fd’ command is a powerful and user-friendly tool that facilitates file searches within the Linux file system.
Although not a native Linux command, it is often considered a better and more intuitive alternative to the ‘find’ command. ‘fd’ is built on Rust, which contributes to its speed and efficiency.
Install fd command
Before you can start using ‘fd’, you need to install it on your Linux system. In this section, we’ll cover how to install ‘fd’ using popular package managers like ‘apt’ and ‘yum’, as well as from source.
(Optional) Create an alias for fd that refers to fdfind.
alias fd=fdfind
(Optional) To make the alias permanent.
vi ~/.bashrc
#Add this entry to the bashrc file
alias fd=fdfind
Use the fd command in Linux
Before using the fd command in Linux, we need to read the help of the command.
# fd --help
The output terminal as below
Find all files and directories starting with “abc” followed by any number of digits, you can use the following command:
fd -e "^abc\d+"
find all files that were changed before a specified number of days
$ fd index /home/vagrant --changed-before 365d
Finding Files Inside a Specific Directory
$ fd password /etc
Finding Files Based on Extension
$ fd -e html
Finding Hidden Files
$ fd -H bash
More details information about fd command.
man fd
Conclusion
fd command is a simple command in Linux. It uses the number of lines of files. These are just a few examples of how you can use the “fd” command.
For more advanced usage and options, you can refer to the documentation or help of the specific “fd” implementation you have installed on your system, as there are multiple versions available. Thank you for reading the DevopsRoles page!
In this tutorial, How to Install LAMP Stack on Rocky Linux. A LAMP stack, which stands for Linux, Apache, MySQL (or MariaDB), and PHP, is a popular software bundle that provides the necessary components for hosting dynamic websites and web applications. In this tutorial, we’ll walk you through the steps to set up a LAMP stack on a Rocky Linux server.
Prerequisites
Before we begin, ensure that you have:
A running Rocky Linux instance
Root or sudo privileges
A stable internet connection
How to install LAMP Stack on Rocky Linux
Install Apache on Rocky Linux
Apache HTTP Server is one of the most widely used web servers in the world. To install it, run the following command:
dnf install -y httpd httpd-devel httpd-tools
Enable Apache start at boot time
systemctl enable httpd
start the Apache HTTPd daemon
systemctl start httpd
To check Apache running on Rocky Linux
systemctl status httpd
The output terminal is below
Opens a browser that can access your Server’s IP address
http://Your-IP-address
OR
http://domain.com
Install MariaDB on Rocky Linux
Next, you’ll need a database server. You can choose between MariaDB and MySQL. In this example, we’ll use MariaDB. Install it with the following command:
dnf install mariadb-server mariadb
The output terminal as below
Enable MariaDB to start at boot time
systemctl enable --now mariadb
Start the MariaDB daemon
systemctl start mariadb
To check MariaDB running on Rocky Linux
systemctl status mariadb
Additional steps to harden the database server. Run the MariaDB security script to secure your installation:
mysql_secure_installation
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Follow the on-screen prompts to set a root password and improve the security of your database server.
Install PHP on Rocky Linux
The default PHP stream is PHP 7.2. PHP is a server-side scripting language commonly used in web development. Install PHP and the PHP MySQL extension with the following command:
To install the latest module Stream. We will reset the PHP streams.
To verify that your LAMP stack is installed and running correctly, create a test PHP file in the Apache web root directory. We’ll use info.php as an example:
We create a test PHP file in the /var/www/html path.
vi /var/www/html/info.php
The content info.php is below
<?php
phpinfo();
?>
Save the changes and restart the webserver.
systemctl restart httpd
Open back browser
http://server-ip/info.php
The output is below
Remove file test PHP
rm -f /var/www/html/info.php
Conclusion
Congratulations! You’ve successfully install LAMP stack on your Rocky Linux server. You now have a powerful platform for hosting websites and web applications. Remember to secure your server, keep your software up to date, and regularly back up your data to ensure a stable and reliable web hosting environment. I hope will this your helpful. Thank you for reading the DevopsRoles page!
This comprehensive guide should equip you with the knowledge to manage and expand your LAMP stack setup. For any further customization or troubleshooting, refer to the official documentation and community forums. Happy coding!
egularly backing up and, if necessary, restoring your PostgreSQL database is essential for data protection and disaster recovery. Remember to schedule automated backups, keep your backup files in a secure location, and test your backup and restore procedures periodically to ensure they work as expected.
By following these steps, you can safeguard your data and have peace of mind knowing that your PostgreSQL database is protected against data loss and system failures.
You have Backup and restore a Postgres database. I hope will this your helpful. Thank you for reading the DevopsRoles page!
xargs Command powerful tool that can revolutionize the way you handle various tasks on your system. Whether it’s processing files, executing commands in parallel, or manipulating data streams, xargs is a versatile Swiss Army knife for any Linux enthusiast.
What does the xargs command in Linux?
xargs is a great command that reads streams of data from standard input, then generates and executes command lines.
In this blog, we will explore the ins and outs of the xargs command, its practical applications, and how it can make your life as a Linux user much easier.
Syntax
xargs [options] [command]
Here are some common options used with the xargs command:
-n: Specifies the maximum number of items to be passed as arguments to the command.
-I: Allows you to specify a placeholder (usually {}) for the argument, which is replaced by each item from the input.
-t: Prints the command being executed before running it.
-p: Asks for confirmation before executing each command.
-r: Prevents the command from running if there is no input.
-a: Specifies the input file from which xargs should read the items instead of STDIN.
-P: Sets the maximum number of parallel processes to run at once.
xargs command Tips and Tricks
How to create multiple files with xargs command in Linux.
Check the most recent four logins for each currently logged-in user.
who | awk '{print $1}' | xargs -I x last -4 x
The output terminal is below
Conclusion
You have to use xargs command for your work daily. The xargs command is an indispensable tool that empowers Linux users to streamline their tasks and increase productivity.
The xargs command is a versatile tool that can greatly enhance your command-line productivity. Whether you’re processing files, running commands in parallel, or performing batch operations, xargs can simplify and automate many tasks. However, it’s important to use it with care, especially when dealing with commands that modify or delete files.
Its ability to handle large sets of data, parallelize operations, and simplify complex tasks makes it a valuable asset in any Linux user’s toolkit. I hope will this your helpful. Thank you for reading the DevopsRoles page!
You need to create a “virtual environment” to host your local copy of Ansible.
virtualenv ansible2.9
This command creates a directory called ansible2.9 in your current working directory.
You must activate it
source ansible2.9/bin/activate
You should see the prompt change to include the virtualenv name.
(ansible2.9) $
The output terminal is as below
Let’s install Ansible
pip3 install ansible==2.9
The output terminal is as below
Conclusion
Congratulations! You’ve successfully installed Ansible using Virtualenv. This setup allows you to manage Ansible and its dependencies separately, ensuring a clean and controlled environment for your automation tasks. Activate the virtual environment whenever you need to work with Ansible and deactivate it when you’re done to keep your system Python environment tidy. I hope will this your helpful. Thank you for reading the DevopsRoles page!
In this tutorial, How to check the dependencies of the package in Ubuntu.
How to Check Package Dependencies in Ubuntu
The default package manager in Ubuntu and Debian-based distros is APT. There are several ways to get the list of Dependencies of a Package in Ubuntu
APT Package Manager
The basic syntax of the command
sudo apt depends package_name
For example, How to check dependencies for the Nginx package
sudo apt depends nginx
The output terminal is as below
Alternatively, You can use apt-cache command
To list the dependencies of a package in Ubuntu, you can use the apt-cache command. The apt-cache command provides information about packages available in the repositories.
Please note that you may need administrative privileges (e.g., using sudo) to execute apt-cache commands.
Here’s how you can list the dependencies of a package:
sudo apt-cache depends nginx
The output terminal is as below
To get additional information on a specific package
sudo apt show nginx
sudo apt-cache show nginx
Using dpkg
If you have downloaded a DEB package on your system and want to know which dependencies will be installed along with the package
In this tutorial, How to Run a Local Shell Script on a Remote SSH Server. You can pass entire scripts over SSH without having the .sh file on the remote Linux server.
To run a local shell script on a remote SSH server, you can use the ssh command with the following syntax:
ssh user@remote_host 'bash -s' < local_script.sh
Here’s a breakdown of the command:
user: Replace this with the username for the remote SSH server.
remote_host: Replace this with the IP address or hostname of the remote SSH server.
local_script.sh: Replace this with the path to your local shell script that you want to run on the remote server.
Linux commands are powerful tools that allow users to interact with the operating system and perform various tasks efficiently. Whether you’re a beginner or an experienced Linux user, having a cheat sheet of commonly used commands can be invaluable. In this blog post, we’ll provide you with a handy Linux commands cheat sheet to help you navigate through your Linux journey.
System Information
Linux Commands cheat sheet for System Information. You want to query information about your system.
Commands
Description
For example
whoami
Output the current user using the Linux system
[vagrant@localhost ~]$ whoami vagrant
w
who or which systems are online especially
[vagrant@localhost ~]$ w 20:29:06 up 3 min, 1 user, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT vagrant pts/0 10.0.2.2 20:27 2.00s 0.01s 0.00s w
cal
Outputs the present month’s calendar.
[vagrant@localhost ~]$ cal September 2021 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
date
Displaying the current date and time.
[vagrant@localhost ~]$ date Tue Sep 21 20:30:00 +07 2021
last reboot
A useful command of how many times your system restarted.
[vagrant@localhost ~]$ last reboot reboot system boot 3.10.0-1127.el7. Tue Sep 21 20:25 – 20:30 (00:04) reboot system boot 3.10.0-1127.el7. Tue Sep 21 14:42 – 17:26 (02:44) reboot system boot 3.10.0-1127.el7. Sat Sep 18 20:56 – 22:00 (01:03) reboot system boot 3.10.0-1127.el7. Sat Sep 18 14:37 – 22:00 (07:22) wtmp begins Sat Sep 18 14:37:54 2021
hostname -I
Outputs the assigned IP address your system is currently
Outputs information about the CPU and processing units.
[vagrant@localhost ~]$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 …..
lsscsi
Lists out the SCSI/SATA devices like hard drives and optical drives.
[vagrant@localhost ~]$ lsscsi [0:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sda
These commands should help you gather hardware information about your Linux system. By utilizing them, you can gain insights into the components and configurations of your machine.
Networking
Here are some commonly used commands to gather networking information in Linux:
Commands
Description
For example
ping hostname_or_IP
Useful in analyzing the responsiveness of a hostname connected to a network.
[vagrant@localhost ~]$ ping 192.168.3.4 PING 192.168.3.4 (192.168.3.4) 56(84) bytes of data. 64 bytes from 192.168.3.4: icmp_seq=1 ttl=64 time=0.017 ms 64 bytes from 192.168.3.4: icmp_seq=2 ttl=64 time=0.021 ms 64 bytes from 192.168.3.4: icmp_seq=3 ttl=64 time=0.021 ms
tcpdump
Used to dump network traffic.
[vagrant@localhost ~]$ sudo tcpdump -i eth0
netstat -r -v
Prints network routing, information, and connections.
[vagrant@localhost ~]$ netstat -r -v Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default gateway 0.0.0.0 UG 0 0 0 eth0 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
ip addr show
Outputs network interfaces and their related IP addresses.
ifconfig
Outputs configured network interfaces’ IP addresses.
whois domain_name
Reveals more information regarding an active domain name on the internet.
[vagrant@localhost ~]$ host huuphan.com huuphan.com has address 104.21.73.16 huuphan.com has address 172.67.137.70 huuphan.com has IPv6 address 2606:4700:3032::6815:4910 huuphan.com has IPv6 address 2606:4700:3031::ac43:8946 huuphan.com mail is handled by 10 aspmx2.googlemail.com. huuphan.com mail is handled by 1 aspmx.l.google.com. huuphan.com mail is handled by 5 alt1.aspmx.l.google.com. huuphan.com mail is handled by 10 aspmx3.googlemail.com. huuphan.com mail is handled by 5 alt2.aspmx.l.google.com.
wget file_name
Useful in downloading a file from a specified domain name
wget https://www.huuphan.com/filename.zip
ifconfig -a
Outputs all the network interface details
ifconfig eth0
Outputs eth0 configuration and address details.
ethtool eth0
Used to manage hardware and network drivers query and control settings
[vagrant@localhost ~]$ ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on MDI-X: off (auto) Cannot get wake-on-lan settings: Operation not permitted Current message level: 0x00000007 (7) drv probe link Link detected: yes
These commands should help you gather networking information in Linux, enabling you to troubleshoot network issues, check connections, and analyze network configurations.
Archives and File Compression
Archiving and file compression are common tasks in Linux that help to organize and reduce the size of files. Here are some commonly used commands for archives and file compression:
Commands
Description
For example
tar cvf compressed_file_name.tar file_name # creating tar xvf compressed_file_name.tar file_name # extracting
creating or extracting files with .tar
[vagrant@localhost ~]$ tar cvf share.tar share share/ [vagrant@localhost ~]$ tar xvf share.tar share/
tar czf compressed_file_name.tar.gz
compresses a tar file into a gzip archive.
tar cjf archive.tar.bz2 folder
compresses a tar file inside a bz2 archive.
[vagrant@localhost ~]$ tar cjf archive.tar.bz2 share [vagrant@localhost ~]$ ll total 20 -rw-rw-r–. 1 vagrant vagrant 150 Sep 23 07:51 archive.tar.bz2
tar xjf archive.tar.bz2
extracts a tar file compressed inside a bz2 archive.
gzip, gunzip, zcat file_name
creating, extracting. or viewing files with .gz extension
These commands should help you perform file compression, archiving, and extraction tasks in Linux. The specific options may vary depending on the command and the desired operation.
Installing Packages
Installing packages is a fundamental task in Linux for adding new software and libraries to your system. The method of package installation can vary depending on the Linux distribution you are using. Here, I’ll provide an overview of package management tools commonly used in different distributions:
Commands
Description
For example
yum search keyword
Search a package installation based on specific keywords.
[vagrant@localhost ~]$ yum search nginx Loaded plugins: fastestmirror Determining fastest mirrors base: mirror.vietnix.vn epel: mirror.xeonbd.com extras: mirror.vietnix.vn updates: mirror.vietnix.vn =============== N/S matched: nginx ========== collectd-nginx.x86_64 : Nginx plugin for collectd munin-nginx.noarch : NGINX support for Munin resource monitoring nginx-all-modules.noarch : A meta package that installs all available Nginx modules nginx-filesystem.noarch : The basic directory layout for the Nginx serve ……
yum install package.rpm
The use of a YUM package manager to install and configure a package.
yum info package
To find more information about a package before optionally proceeding with its installation.
[vagrant@localhost ~]$ yum info nginx Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile base: mirror.vietnix.vn epel: mirror.xeonbd.com extras: mirror.vietnix.vn updates: mirror.vietnix.vn Available Packages Name : nginx Arch : x86_64 Epoch : 1 Version : 1.20.1 Release : 2.el7 Size : 586 k Repo : epel/x86_64 Summary : A high performance web server and reverse proxy server URL : https://nginx.org License : BSD Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and : IMAP protocols, with a strong focus on high concurrency, performance and low : memory usage.
rpm -i package.rpm
To install a downloaded RPM package.
yum remove package
To uninstall or remove a Yum package from your system.
tar zxvf sourcecode.tar.gz cd sourcecode ./configure make make install
Command sequence to install a package software that comes as a source code.
dnf install package.rpm
Using the DNF package manager to install package software.
apt install package
Using the APT package manager to install package software.
rpm -e package.rpm
Using the RPM package manager to remove or uninstall an rpm package
Remember to use the sudo command before installation commands to execute them with administrative privileges.
Search Commands
Searching for files, directories, and text within files is a common task in Linux. Here are some commonly used search commands:
These commands should help you search for files, directories, and text within files on your Linux system. You can customize the search criteria based on your specific requirements.
SSH Logins
SSH (Secure Shell) is a widely used protocol for securely accessing remote systems over a network. Monitoring SSH logins can be important for security and auditing purposes. Here’s how you can view SSH login information:
Commands
Description
For example
ssh user_name@hostname
Connects you to a remote machine or server
ssh host
Connects you to a specified host through the default port 22.
ssh -p port user_name@hostname
Connects you to a remote machine or server through a specified port.
telnet hostname
Uses telnet’s default port 23 to connect you to a target hostname, remote machine, or server.
File Transfers and Management
File transfers and management are common tasks in Linux for organizing, moving, copying, and transferring files between different locations. Here are some commonly used commands for file transfers and management:
Commands
Description
For example
rm -r -f
To remove or delete active files and directories
du -s
Give important information regarding the disk usage (storage space) on your Linux system.
[vagrant@localhost ~]$ du -s /home/vagrant 60 /home/vagrant
Used for moving directories or files to a different system path or location.
grep, egrep, fgrep -i -v
Useful in printing lines with a matching pattern.
scp file.txt server:/tmp
To copy files to a remote server.
scp server:/home/vagrant/*.txt /tmp
to copy files from a remote server to a directory on a local machine.
scp -r server:/home/vagrant /tmp
recursively copy all the files and directories on a remote server’s directory to a target machine directory.
rsync -a /var/www /backups/
Synchronizes the content of two directories (/var/www and /backups) on the same machine.
rsync -avz /home/vagrant server:/backups/
synchronizes the content of a folder on a local machine with the content of a folder on a remote server.
These commands should help you with basic file transfers, copying, moving, renaming, and deleting files and directories in Linux. Remember to use appropriate options and double-check before performing any destructive operations like removing or overwriting files.
File and Directory Operations
Working with files and directories is a common task in Linux. Here are some commonly used commands for file and directory operations:
Commands
Description
ls
list the files and directories under and directory path.
pwd
print working directory
mkdir dir_name
create a directory with the specified name.
rm filename
delete a file with the specified name.
rm -rf directory_name
recursively and forcefully delete a directory with the specified name.
cp filename1 filename2
copy filename1 to filename2
cp -r directory1 directory2
recursively copy the content of directory1 to directory2
mv filename1 filename2
rename filename1 to filename2
ln -s /path/to/file_name link_name
To create a symbolic link (link_name) to a specified file name (file_name).
touch filename
to create a new file
more filename
open and display the contents of a specified file.
cat filename
open and display the contents of a specified file.
cat filename1 >> filename2
appends or adds the content of filename1 at the bottom of filename2.
head filename
Outputs the first ten lines of a specified file name.
tail filename
Outputs the last ten lines of a specified file name.
gpg -c filename
to encrypt a specified file.
gpg filename.gpg
to decrypt a specified file with a .gpg extension.
wc filename
Outputs the number of bytes, lines, and words of a specified file name.
cd
Takes you to the Home directory
cd /target/directory
To change directories to a specific directory name.
These commands should help you perform common file and directory operations in Linux. Be careful when using commands like “rm” or “rmdir” to avoid accidental deletion of important files or directories.
Disk Utilities and Usage
Monitoring disk usage and managing disk-related tasks are essential in Linux to ensure efficient use of storage space. Here are some commonly used disk utilities and commands for disk management and usage:
Commands
Description
For example
df -h
Display the amount of free space in the file system
Outputs the target mount point associated with all your file systems.
mount device_path mount_point
to mount a device.
mkfs -t -V
to create a new file system.
resize2fs
updating a file system, especially after lvextend*
fsck -A -N
to check and repair a file system.
pvcreate
creating a physical volume.
mount -a -t
mounting a file system.
lvcreate
creating a logical volume.
unmount -f -v
unmounting a mounted file system.
These commands and utilities will help you monitor disk usage, manage partitions, mount file systems, and perform disk-related tasks in Linux. Make sure to use appropriate administrative privileges, such as “sudo,” when required.
Environment Variables
Commands
Description
For example
env
Display all exported environment or run a program in a modified environment