Find macOS Serial Number using Terminal

  1. You need to open your Terminal. Either by going to your Applications>Utilities>Terminal or by simply using Spotlight Search (type Command + Space on your keyboard) then type Terminal and press enter.
  2. Type the below command into your Terminal and press enter:
system_profiler SPHardwareDataType

The Terminal will display your serial number as shown below:

Find macOS Serial Number using Terminal
Find macOS Serial Number using Terminal

This command in macOS will also show you more details about your machine. These include Model, Chip, Memory, Total number of cores and more.

Contact me if you have any questions. You can also check out my ITPro Helper shop. I make my own T-shirts and mugs designs in New York City.

Start Tomcat at boot time in Red Hat 8

The other day I installed a Tomcat server in Red Hat 8 for a client. The client had to reboot the server and couldn’t find a way to start it. I found a way to start Tomcat at boot time in Red Hat 8.

As usual, I needed to go for a walk around New York City in Brooklyn before taking on this one.

First, we need to create a startup script file for Tomcat in:

/etc/init.d

You can name this file tomcat and enter the below:

#!/bin/sh
export CATALINA_HOME="/usr/local/tomcat"
ERROR=0
case "$1" in
 start)
            echo $"Starting Tomcat"
            sh $CATALINA_HOME/bin/startup.sh
            ;;
 stop)
           echo $"Stopping Tomcat"
           sh $CATALINA_HOME/bin/shutdown.sh
           ;;
 restart)
           sh $CATALINA_HOME/bin/shutdown.sh
           sh $CATALINA_HOME/bin/startup.sh
            ;;
 *)
         echo $"Usage: $0 {start|stop|restart}"
 exit 1
 ;;
esac
exit $ERROR

Assigned the permissions below:

chomod 755 tomcat

Next, create a symbolic link of the tomcat script inside the rc.d directory:

ln -s /etc/init.d/tomcat /etc/rc.d/rc6.d/K24tomcat 
ln -s /etc/init.d/tomcat /etc/rc.d/rc0.d/K28tomcat
ln -s /etc/init.d/tomcat /etc/rc.d/rc3.d/S80tomcat
ln -s /etc/init.d/tomcat /etc/rc.d/rc2.d/S81tomcat
ln -s /etc/init.d/tomcat /etc/rc.d/rc5.d/S81tomcat

Go ahead and reboot your server and see if Tomcat starts automatically.

You can always contact me if you have any questions. Also, remember to visit my ITPro Helper shop where I created unique T-Shirts and coffee mugs designs.

How to Configure SSH Server in Ubuntu

A client called me asking me to setup and configure SSH on a new Ubuntu server they got for a project. They needed the server to be accessed by a remote Web Developer they hired.

After having a great cup of coffee Villa Sarchi varietal I decided to take on this one.

Install SSH Server in Ubuntu

New Ubuntu installs do not have SSH service by default. You need to install it. It very easy. Run the below command on your Terminal:

sudo apt update

Then do:

sudo apt install openssh-server

Select ‘yes’ when asked. This last command will install SSH server in Ubuntu. Once the installation is done the SSH service will be started. You can check this by running this command:

sudo systemctl status ssh

Make the SSH server more secure using UFW in Ubuntu

UFW (Uncomplicated FireWall) is Ubuntu’s default firewall. Allow SSH port 22, port 8000, port 5000(these two are for testing only) on your Ubuntu server:

sudo ufw allow ssh
sudo ufw allow 8000
sudo ufw allow 5000

Then enable the firewall:

sudo ufw enable

To see what’s configured under your ufw rules:

sudo ufw status

This will give you a summary as the one below:

Configure SSH Server in Ubuntu
UFW status command output

Next, I needed to create a Linux user with sudo rights. You can tap on that link to see the steps necessary to do that. After you’re done you should be able to connect to the server using the following ssh command:

ssh youruser@yourserverIP

For example:

ssh pepe@192.168.2.11

You can also add your public key to the Ubuntu server. This way you don’t need to enter a password when you SSH. You can also add this server to a config file in your .ssh/config

I will be adding more details about security for SSH server. For now, visit my ITPro shop to see cool IT inspired T-Shirts and coffee mugs I designed.

Open VS Code from macOS Terminal

A client called me the other day asking me how to open VS code from macOS terminal. The user started doing some Web Development and wanted to make his environment run smoothly.

After I finished my meeting with my friend coffee farmer from Finca Perseverancia in Honduras I decided to put together this brief tutorial to Open VS Code from macOS Terminal.

First, you need to start VS Code. If you don’t have it you can download it here. Then, run Command + Shift + P. You should see the below:

VS Code command palette
VS Code command palette

This area in VS Code is called the ‘VS Code command palette’. This will let you change settings.

Next, type in the command palette the below and hit Enter:

shell

It should look like the screenshot below. The option Install ‘code’ command in PATH should be selected. This will do all changes you need.

You should see a confirmation window saying:

Shell command 'code' successfully installed in PATH.

That’s all. Contact me if you have any questions. You can also leave a comment below. If you like to support me visit my ITPro Helper shop. I made some cool T-Shirt and coffee mugs designs.

Windows 11 not Accepting File Names Over 260 Characters

The new Windows 11 is another Microsoft release. As usual, I’m not impressed at all. Anyways, a client was having issues when trying to clone a git repo on her new Windows 11 machine. the client kept getting error “Destination path too long” error message.

There are some suggestions online to make a registry and or use the Group Policy Editor. Both did not work for me. The suggested registry change is to change the value of the below registry key to ‘1’:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

I rebooted and still got the same error above. I did not even try Local Group Policy since this was a Windows 11 Home edition.

After having some great coffee from Colombia, I found a way to make this work.

I created a folder directly on the root (C: drive). For example, C:\work_here

On the Windows 11 command prompt I change directories to the above and did a git clone. All works now.

Contact me if you have any questions. Remember to check my T-shirt and Coffee mugs shop.

Change Screenshot Location Using macOS Terminal

My desktop kept getting overloaded with screenshots. If you want to keep your macOS desktop nice and clean you can change the screenshot location in your macos using the Terminal.

This is simple. First, I brewed my own coffee at home. I got this great coffee from El Salvador which is fantastic!

Open your Terminal and type the following command:

defaults write com.apple.screencapture location /Users/[your_username]/Desktop/screenShots

In this case I decided to have my screenshots save to a folder in my Desktop. Now, every time I take a screenshot I only need to look inside one folder instead of wondering where is the file in my entire Desktop.

How to Flush DNS Cache macOS Terminal

A client with about 150 macOS called me. They needed to find a quick and effective way to flush DNS cache on macOS Terminal. After brewing a great cup of coffee from Guatelama I decided to take on this one.

I found a simple combination of commands using the macOS Terminal. Once you open your Terminal copy and paste the commands below and press enter:

sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

You will not see a success confirmation message on the Terminal. After you run it try to ping or access the desired hostname.

You can even place this command on a bash script and deploy it to all your clients or ever for yourself (maybe create an alias in the Terminal).

Hope this is helpful. Contact me if you have any questions. Also, remember to see my cool T-Shirts and coffee mugs shop where I made my own designs.

cp Command to Overwrite Without Confirmation

I’m used to running the cp command in Linux often. But, this time a client had an emergency and I needed to use the cp command to overwrite a directory in their Red Hat Linux box.

I needed to login with root for this one. I needed to restore a directory to it’s original location using the cp command to overwrite the old corrupted one. In the terminal I ran:

cp -rf /data/restore/restored-dir/var/www/cms/ubi /var/www

And got prompted to confirm the overwrite for each file:

cp: overwrite ‘./ubi/index.html’?

It sucks to have to confirm thousands of files even when you’re logged in as root! Why? I ran to the kitchen and brew myself a nice cup of coffee from Guatemala.

Then, I found out that root in Red Hat Linux has an alias for the cp command:

which cp

and got:

which cp comamnd

In order to escape this alias in Linux I had to run the same command previously, but with an added ‘ / ‘ in front of the cp command:

/cp -rf /data/restore/restored-dir/var/www/cms/ubi /var/www

Now, all works. I was able to copy the restored files.

You can always contact me if you have any questions. Also, make sure to visit my coffee mugs and T-Shirts shop for inspiration.

Change MariaDB Data Directory Location CentOS

A client asked me if I can help their WordPress developer configure a development Linux box. They created a separate partition and wanted to change their MariaDB Data Directory Location on their CentOS server.

After taking a walk in New York City by the Madison Square Park I decided to put this tutorial together. There are some simple steps:

  1. Moving MariaDB Data Directory
  2. Pointing to the New Data Location
  3. Restart MariaDB

Moving MariaDB Data Directory

We need to verify the the current MariaDB data location first. Login using the below command. Enter your password when prompted:

mysql -u root -p

Then, once logged in run the following:

select @@datadir;

You should see the current location:

Change MariaDB Data Directory
MariaDB data location

Type exit.

Next, stop MariaDB:

sudo systemctl stop mariadb

Confirm it really stopped:

sudo systemctl status mariadb

Read the output and make sure it says:

Stopped MariaDB database server.

Point to the New Data Location

Now, we need to tell MariaDB where the new location will live. Edit /etc/my.cnf by running:

sudo vim /etc/my.cnf

Find the line that begins with ‘datadir=’ and make the changes to the new location. Also, change the ‘socket=’ if necessary.

Remember, you can also define a custom .cnf in side the /etc/my.cnf.d/ 

Write your above changes and now let go start MariaDB and see.

Finally, start MariaDB by running this command:

sudo systemctl start mariadb

Verify its running:

sudo systemctl status mariadb

Also, repeat the first command above:

mysql -u root -p
select @@datadir;

In order to verify the changes. Type exit or \q.

Cheers! Remember to see my T-shirt and coffee mugs shop. I designed some inspirational ones. Let me know what you think.

Hope you enjoy this Change MariaDB Data Directory brief tutorial.

Setup Windows 11 without a Microsoft Account

I found myself configuring for the first time a new Windows 11 laptop for a client. I was used to configure the initial account in other Windows versions as a local user. This time the setup of Windows 11 without a Microsoft account was very tricky.

After having a beer in one of my favorite bars in New York city I found a way to get around this confusing setup.

I tried the old fashion way to manage Windows users and I ran:

lusrmgr.msc

I got the usual screen which is funny because this is Windows 11 and NOT Windows 10. See what it says on the Local Users and Group screen:

lusrmgr.msc window in Windows 11

Finally, I found a quick way to setup Windows 11 without a Microsoft account.

Windows 11 without Microsoft account
New user screen Windows 11

I like the command prompt in either Windows or Linux or whatever system I touch.

At the setup screen in Windows press Shift + F10 shortcut. This will open a command prompt. Next, we need to release the network configuration we setup in the previous screen by running this command:

ipconfig /release
Windows 11 without Microsoft account
ipconfig /release command Windows 11

Quickly click on the Back button/arrow. Windows will now show you the ‘Who’s going to use this device?’ screen. This will be a local user. Enter your desired username, press Next and then enter a password for this new local user. You will be prompted for the usual privacy settings.