<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Josh</title>
    <description>The latest articles on DEV Community by Josh (@joshalmasin88).</description>
    <link>https://dev.to/joshalmasin88</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F914719%2F677afa64-ae96-497d-807a-943b92ce96f3.png</url>
      <title>DEV Community: Josh</title>
      <link>https://dev.to/joshalmasin88</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joshalmasin88"/>
    <language>en</language>
    <item>
      <title>File System and Disk Management Linux</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Fri, 13 Dec 2024 19:19:34 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/file-system-and-disk-management-linux-36ca</link>
      <guid>https://dev.to/joshalmasin88/file-system-and-disk-management-linux-36ca</guid>
      <description>&lt;h1&gt;
  
  
  Disk Space and Usage Commands
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Display Disk Space Information
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; &lt;code&gt;df&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Description:&lt;/strong&gt; Displays the amount of disk space used and available on filesystems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; &lt;code&gt;df -h&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Description:&lt;/strong&gt; Provides a human-readable format (e.g., in GB or MB) for easier interpretation of disk space usage.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Display Disk Usage
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; &lt;code&gt;du ~&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Description:&lt;/strong&gt; Shows the disk usage of your home directory, listing the size of each subdirectory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; &lt;code&gt;du -sh ~&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Description:&lt;/strong&gt; Gives a summary of the total disk usage in your home directory, displaying it in a human-readable format.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Creating a Virtual Disk
&lt;/h1&gt;

&lt;p&gt;To create a virtual disk, use the following command:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
bash
dd if=/dev/zero of=vdisk.img bs=1M count=256
Explanation of Parameters
if=/dev/zero: Specifies the input file as /dev/zero, a special file that produces null bytes. This is useful for creating empty files or disks.
of=vdisk.img: Sets the output file to vdisk.img, which will be the virtual disk created.
bs=1M: Defines both the input and output block size as 1 megabyte, optimizing the speed of the operation.
count=256: Limits the operation to 256 blocks, resulting in a total size of 256 MB for the virtual disk.
Verifying the Virtual Disk
To verify the creation of the virtual disk, run:
bash


ls -lh vdisk.img
This command lists the details of vdisk.img, including its size and permissions.
Formatting the Virtual Disk
Format the virtual disk with the ext4 filesystem using the following command:
bash


sudo mkfs.ext4 vdisk.img
Additional Details
The mkfs.ext4 command creates an ext4 filesystem on the specified file. This is commonly used for new disks or partitions, ensuring optimal performance for most usage scenarios [[1]] [[2]].
You can customize the filesystem parameters if needed, but the default options are generally sufficient for typical use cases [[1]].
Creating a Mount Point
Create a directory to serve as the mount point for the virtual disk:
bash


sudo mkdir /mnt/vdisk
This directory will be used to access the contents of the virtual disk.
Mounting the Virtual Disk
Finally, mount the virtual disk using:
bash


sudo mount -o loop vdisk.img /mnt/vdisk
Explanation of the Command
The -o loop option allows you to mount a file as if it were a disk. This is particularly useful for virtual disks created from image files.
Now, you can access the contents of your virtual disk at /mnt/vdisk.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>File Compression and Packaging in Linux</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Thu, 12 Dec 2024 12:28:27 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/file-compression-and-packaging-in-linux-3c54</link>
      <guid>https://dev.to/joshalmasin88/file-compression-and-packaging-in-linux-3c54</guid>
      <description>&lt;p&gt;Working with File compression and packaging.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tar -cvf myarchive.tar mydir/ # -c Create, -v Verbose, -f File
tar -tvf myarchive.tar # lists whats in your tar archive
tar -xvf myarchive.tar -C mynewdir # Extract your tar. -x Extract, -v Verbose, -f File, -C change to directory before extracting.

gzip myarchive.tar # will create you a myarchive.tar.gz
or 
tar -czvf myarchive.tar.gz /path/to/extract

tar -xzvf myarchive.tar.gz -C /path/to/extract # -x Extract, -z Uncompress

Tar - used for packaging files and directories together
gzip, bzip2, xz - is used for compressing

zip -r myarchive.zip /myarchive 
unzip -d /path/to/unzip/unzipped myarchive.zip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
    </item>
    <item>
      <title>Linux Environment Variables</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Wed, 11 Dec 2024 21:46:13 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/linux-environment-variables-31in</link>
      <guid>https://dev.to/joshalmasin88/linux-environment-variables-31in</guid>
      <description>&lt;p&gt;Environmental Variables: Variables that are available to your shell. they can be used in scripts that are run from the shell.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

# View list of all your environment variables.
env

# This shows paths for all executable programs:
echo $PATH

# Create your own environmental variable:
export MY_ENV_VAR="My custom environmental var"
# Check if it worked using grep:
env | grep MY_ENV_VAR

# Make permanent variables
vi ~/.zshrc
# Now add your custom variables in
export MY_ENV_VAR="My custom environmental var"
export PATH="$PATH:$HOME/bashscripts"
# Then run this to take affect instead of restarting your terminal
source ~/.zshrc

# Remove variable
unset MY_VAR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Linux User Account Management</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Wed, 11 Dec 2024 01:10:02 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/linux-user-account-management-1kmo</link>
      <guid>https://dev.to/joshalmasin88/linux-user-account-management-1kmo</guid>
      <description>&lt;h2&gt;
  
  
  User account management cheat sheet
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

sudo useradd joshua  # create user
sudo useradd -m -d /home/customhome joshua # create user with custom home directory
sudo useradd -s /bin/bash joshua # create user with shell


# Password:
sudo passwd joshua # Set password for joshua
sudo passwd -l joshua # Locks account
sudo passwd -u joshua # Unlocks account

#User Modify
sudo usermod -aG developers joshua # adds joshua to developers group
sudo usermod -d /home/newhomedir joshua # Gives joshua new home directory
sudo usermod -aG sudo joshua # adds joshua to sudo group

# Change Shell
sudo usermod -s /bin/bash joshua

# Delete user account
sudo userdel -r joshua # -r deletes their home directory as well.

# Switch users
su - joshua

# List users groups
groups 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Text Processing &amp; Regular Expressions</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Tue, 10 Dec 2024 20:55:44 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/text-processing-regular-expressions-13g1</link>
      <guid>https://dev.to/joshalmasin88/text-processing-regular-expressions-13g1</guid>
      <description>&lt;p&gt;&lt;strong&gt;Grep&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grep "keyword" file.txt
grep "^keyword" file.txt # ^ will find your keyword that starts with the line
grep -i "keyword" file.txt # Makes it case insenstive
grep -n "keyword" file.txt # returns back which line your keyword was found.
grep -C 1 "keyword" file.txt # Gives the line before and the line after your keyword.
grep -v "someword" file.txt # Gives back patterns that dont match yours.
grep "Dev[To]*" file.txt # Finds all dev and devto and devt etc.
grep "^[1234567890]" file.txt # finds all lines starting with a number.
grep "[@qwertyuiopasdfghjklzxcvbnm].com" file.txt # finds all emails. 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;SED&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sed 's/Yo/Sup/' file.txt # Replaces first occurrence of Yo with Sup.
sed 's/Yo/Sup/g' file.txt # Replaces all matching on each line.
sed -i's/Yo/Sup/g' file.txt # This will modify the file. The other ways only modify what is show in the terminal.
sed '3d' file.txt # Deletes the 3rd line in the file
sed '1i\First line' file.txt # Adds the text "First line" to the file.txt
sed '$a\Last line' file.txt # Adds the text "Last line" to end of the file.
sed -e 's/Yo/Sup/g' -e 's/joshua/Joshua/g' file.txt # -e allows for mutiple commands.
sed 's/[Ww]orld/Galaxy/g' file.txt # RegEx finds any World or world and replaces with Galaxy.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;AWK&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;awk '{print $1}' file.txt # Prints the first word of each column
awk '{print $1, $2}' file.txt # Prints the first and second word of each line
awk '$2 &amp;gt; 28 {print $1 " is over 20"}' file.txt # Looks at second word of each line and compares it to see if its greater than 28 then print it.
awk 'NR &amp;gt; 1 {sum += $2} END {print "Average age:", sum/(NR-1)}' awk_test.txt # Checks if name records is greater than 1.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
    </item>
    <item>
      <title>System has not been booted with systemd as init system (PID 1).</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Mon, 09 Dec 2024 22:50:10 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/system-has-not-been-booted-with-systemd-as-init-system-pid-1-ank</link>
      <guid>https://dev.to/joshalmasin88/system-has-not-been-booted-with-systemd-as-init-system-pid-1-ank</guid>
      <description>&lt;p&gt;If you get a&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this typically occurs when you're trying to use the systemctl command in an environment that does not support systemd as the init system. &lt;/p&gt;

&lt;p&gt;Solution: Use Sysvinit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use the Below
sudo service start &amp;lt;service name&amp;gt; 

## Example below
sudo service start nginx

# Instead of 
sudo systemctl start &amp;lt;service name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
    </item>
    <item>
      <title>Linux Permissions</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Mon, 09 Dec 2024 22:27:54 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/linux-permissions-3p9l</link>
      <guid>https://dev.to/joshalmasin88/linux-permissions-3p9l</guid>
      <description>&lt;p&gt;View file permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -l file.txt
ls -ld mydir/ # Checks permissions on directory
ls -lR mydir/ # List permissions of files in dir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set Ownership&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chown root:root file.txt
chown -R root:root mydir/  # Makes everything in mydir to be owned by root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Examples of permissions and what they mean:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-rw-rw-r-- 1 root root  0 Dec 10 05:38
#
# - this is a regular file.
# rw- represent the owner's permissions.
# rw- group.
# r-- others.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;r (read): 4
w (write): 2
x (execute): 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 777 file.txt
chmod 650 file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
    </item>
    <item>
      <title>Beginner Linux Commands</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sat, 07 Dec 2024 14:42:49 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/beginner-linux-commands-51le</link>
      <guid>https://dev.to/joshalmasin88/beginner-linux-commands-51le</guid>
      <description>&lt;p&gt;Display Current User:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;whoami
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get Current user UID - User ID, GID - Group Primary ID, Groups - Groups you belong too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;System Monitoring:&lt;br&gt;
Install htop and run it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install htop
htop 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk0hhz7klblccaz6hw4a5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk0hhz7klblccaz6hw4a5.png" alt="htop example" width="800" height="494"&gt;&lt;/a&gt;&lt;br&gt;
htop displays your systems performance. At the bottom of htop shows how you can use htop such as : search, filter, kill, etc. To exit htop just press q.&lt;/p&gt;

&lt;p&gt;Show your current directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pwd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Show path to home directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List directories and files in your current directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create empty a file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create file with text in it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Hello World" &amp;gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a hidden file using the . :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "This file is hidden" &amp;gt; .cantsee
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Display all files even hidden ones:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a copy of file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp myfile.txt myfilecopy.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy to another directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp myfile.txt newdirectory/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Moving files and changing name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mv myfile.txt movedfile.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Move to new dirctory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mv myfile.txt somedirectory/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change name of directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mv somedirectory newnamedirectory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Move and rename one time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mv somedir/myfile.txt ./somefile.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove empty directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rmdir somedir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove directory and all inside it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm -r somedir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove with prompts to confirm removal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm -i file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove with recursive and force. Be careful with this command!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm -rf somedir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read file contents with cat&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read file contents numbered&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat -n file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Print the beginning of a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;head # shows the first 10 lines
head -n1 file.txt  # -n1 prints the first line
head -c1 file.txt # -c1 prints the first character
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;print the last content of the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tail file.txt# shows last 10 lines
tail -n1 file.txt # -n1 prints the first line
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See difference between 2 files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;diff myfile1 myfile2

diff -r ~/Downloads ~/Documents  # Directory diff with -r for recursive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
    </item>
    <item>
      <title>Setting up WHM on Rocky 9 VPS</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Wed, 04 Dec 2024 22:07:35 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/setting-up-whm-on-rocky-9-vps-542m</link>
      <guid>https://dev.to/joshalmasin88/setting-up-whm-on-rocky-9-vps-542m</guid>
      <description>&lt;p&gt;First I'll set up host name that matches my domain name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hostnamectl set-hostname server01.pokeboost.net
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next I'll disable my firewall on my server as its required for WHM and cPanel installations.&lt;/p&gt;

&lt;p&gt;Below appears that there is no firewall service on my vps so i can skip this. Later i will add a firewall.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[root@my-vps ~]# systemctl status firewalld.service
Unit firewalld.service could not be found.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next i'll disable SELinux:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vi /etc/selinux/conf - Changed SELINUXTYPE=disabled
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhl1az3fbr46vwt7whiz6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhl1az3fbr46vwt7whiz6.png" width="300" height="163"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next i will install Perl&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yum install perl -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can finally download and install the software&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /home &amp;amp;&amp;amp; curl -o latest -L
https://securedownloads.cpanel.net/latest &amp;amp;&amp;amp; sh latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure that you have curl before running that command as you can see i didn't have it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9r379881m3hkzg45wkwf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9r379881m3hkzg45wkwf.png" width="300" height="32"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yum install curl -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installation it should have a link to click, Following the link from the terminal.&lt;/p&gt;

&lt;p&gt;( I got a timed out when i visited the link because my VPS didn't have a firewall but my provider Ionos has a cloud panel where you have to open the ports up. So i added 2087 and 2082 port in my firewall policy:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2t1kx08755qd51whvjon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2t1kx08755qd51whvjon.png" width="300" height="159"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yum install curl -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installation it should have a link to click, Following the link from the terminal.&lt;/p&gt;

&lt;p&gt;( I got a timed out when i visited the link because my VPS didn't have a firewall but my provider Ionos has a cloud panel where you have to open the ports up. So i added 2087 port in my firewall policy:&lt;/p&gt;

&lt;p&gt;Then i logged in with my Linux server root credentials: root and root password.&lt;/p&gt;

&lt;p&gt;Now we have successfully installed WHM cPanel on rocky Linux 9.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fizx0i99m8qbq5t0fzoaq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fizx0i99m8qbq5t0fzoaq.png" width="300" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DNS / Hostnames:&lt;/p&gt;

&lt;p&gt;Add A record to my server: I use the same hostname as i named my server.&lt;/p&gt;

&lt;p&gt;Now i will add my default ionos name servers to my WHM account. Here is ionos default  nameservers that i will add&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhanqrdedrsa5z1du73vw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhanqrdedrsa5z1du73vw.png" width="300" height="117"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the name servers and configure records.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faug16zeyexuimcbxmwwu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faug16zeyexuimcbxmwwu.png" alt="Image description" width="300" height="111"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You have completed installing and configuing DNS to work with your new WHM.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>webhost</category>
      <category>whm</category>
    </item>
    <item>
      <title>Set Static IPv4 on AlmaLinux</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Wed, 04 Dec 2024 15:29:05 +0000</pubDate>
      <link>https://dev.to/joshalmasin88/set-static-ipv4-on-almalinux-5dj8</link>
      <guid>https://dev.to/joshalmasin88/set-static-ipv4-on-almalinux-5dj8</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fykb2ijp6m4hyg0z0zsym.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fykb2ijp6m4hyg0z0zsym.png" alt="Static IPv4 on Almalinux" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Identify Your Network Interface&lt;/strong&gt;&lt;br&gt;
First, you need to find the name of your network interface. You can list all network connections with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nmcli connection show&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Mine was enp0s3&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Configure the Static IP Address&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To set a static IP address, use the following command, replacing  with the name of your connection, and adjusting the IP address, gateway, and DNS as needed:&lt;br&gt;
bash&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nmcli connection modify &amp;lt;your_connection_name&amp;gt; ipv4.addresses 192.168.12.100/24&lt;br&gt;
sudo nmcli connection modify &amp;lt;your_connection_name&amp;gt; ipv4.gateway 192.168.12.1&lt;br&gt;
sudo nmcli connection modify &amp;lt;your_connection_name&amp;gt; ipv4.dns 8.8.8.8&lt;br&gt;
sudo nmcli connection modify &amp;lt;your_connection_name&amp;gt; ipv4.method manual&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reference for above:&lt;/strong&gt;&lt;br&gt;
ipv4.addresses: Set this to your desired static IP address and subnet mask (e.g., /24 for 255.255.255.0).&lt;/p&gt;

&lt;p&gt;ipv4.gateway: Set this to your network's gateway.&lt;/p&gt;

&lt;p&gt;ipv4.dns: You can specify one or more DNS servers (e.g., Google's DNS 8.8.8.8).&lt;/p&gt;

&lt;p&gt;ipv4.method manual: This tells NetworkManager to use a static IP configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Bring the Connection Up&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After modifying the connection settings, you need to bring the connection down and then back up to apply the changes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nmcli connection down &amp;lt;your_connection_name&amp;gt;&lt;br&gt;
sudo nmcli connection up &amp;lt;your_connection_name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Make sure everything is correct&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To confirm that your static IP address has been set correctly, you can check the current IP configuration with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nmcli device show &amp;lt;your_interface_name&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>almalinux</category>
    </item>
  </channel>
</rss>
