Understanding Shell Script in Linux Mint and how to use it properly

 

Shell script

Shell scripts are powerful!

Any Admin who has used shell scripts to complete a bunch of tasks on Linux will tell that you should already be using it.  It’s something that even I can’t really understand but know a lot about since I have to install Linux a lot.   Sometimes it can go weeks before I have to use my shell script again or the next day.  It varies from time to time when I will need to use it but it is an admins best friend.   Is shell scripts like python, absolutely but there is something that we should at least explore and understand.   I am going to talk about this and give examples for those who might want to follow along with me as we talk about “What is shell scripts and how can I use them?”.  I am sure this will be a long series maybe a few post here and there but it will be really good for those who might want to learn even more about the world of Linux.

Shell scripts vs python

Let’s at least get this one out of the way, because someone is bound to ask this question.  What’s the difference in shell scripts verses python?  In the short answer not much, but in the long answer the python language is more complex and you can do a lot more with the python did you can do with shell but only to a point.  Each one has it’s own unique qualities and can be used on Linux and Windows.   Although shell scripts can’t be run on exactly, they can be renamed to be batch files (.bat) which is DOS(Directory of System) old system.  Way before Windows we had DOS and way before any GUI interfaces we had to create batch files to load up the system.  If you’re old enough you probably remember autoexec.bat or even the config.sys files that you occasionally had to edit to get to the command prompt.

Shell scripts in Linux

What’s the use of using shell scripts in Linux you might be asking yourself?  It’s very useful to use when there is a problem or need to install a bunch of things that would take longer to install individually.  Shell script basics are really just that like a batch file in DOS and it can do a lot of things from asking a question to installing many different files.   It can rename or remove files, it is also good for cleaning up a directory that might be full of junk files or maybe you want to have a shell script to backup your /home directory.  This is the power of shell scripting in Linux.  Shell script basics can make your life so much easier and better in the long when you finally decide to delve into the Linux system.

Shell scripts If and then

Just like batch files, you can use this in Shell scripting.  If something happens then do this or you can even go farther that by using Else statements also.  You can ask something from the admin like where the file location of a file you want to use.  It can make your life so much simpler and can help keep the Linux system running smoothly.

if [ expression ]
then
statement
fi

You can do so much more with the shell script when you personalize it to what ever you might need.

echo What is the shell script you want to run?
read $FILE
if ! [ +r $FILE ]; then
Echo "Admin permissions are required to run this shell script"
then exit 0

As you can see this can be very useful when you want to get around certain installation situations and needing to install files without prompting.

Here’s a good one for those who might need to do just that:

echo y|sudo apt-get install [apt program]

This will allow you to bypass the yes question when it is asked and you can just create a basic shell script to install the files that you wanting to do like I have from time to time with gaming systems.   If you don’t want to wait around and install them manually this is the best approach for people who might want to multiple programs at once.

Executing the shell script

if you can’t execute the shell script than you haven’t given permissions to execute it in Linux.  You either have edit the properties in Linux, by right clicking on the shell script and clicking on the properties tab.   Then check “Allow executing file as a program” or you can do a command line

chmod 0700 script.sh (only allow owner to run script)
chmod 0755 script.sh (Allow owner users, and groups to run script)

As you can see the chmod command can be very useful in Linux, so take care to use it wisely.   I will talk about even more about shell scripting in the coming days and hopefully provide you with a very powerful script for installing all the gaming and even the drivers that you might need to for your new Linux gaming system.

More advice for new computer technicians

Photo by Dmitriy on Pixabay

Job Searching is outdated!

In My previous post, Some advice for computer technicians, I did talk about what a technician usually has to do to fix or repair a system.  He even has to deal with some very difficult customers.

Now with that said I wanted to change directions and talk about the job search area and what you should expect.  Being a computer technician that has the educational background but not the experience of actually being a computer technician, can be quite frustrating sometimes when it comes to job searching.  It can just make me scratch my head when they require a 1 to 2 or even 5 years of experience to even start doing the job we went to school to get the education to do the job.  How is any employer going to over a entry-level job and still require some sort of experience that shouldn’t even be a requirement to get the job.

This just seems like someone is not understanding what the word entry-level means and why it shouldn’t require much to get that job or position.

Don’t Apply for every job

This one just seems like it needs to be said.  Just because you have the education, don’t apply to all the jobs that you are interested in before doing a little research.  Figure out what you want to do and how much you are worth.   Use places like Glassdoor and indeed to make sure the company you are considering applying for has a good reputation or at least got some good reviews by previous employees.  You know you will have to deal with bad bosses from time to time, so you can figure out if you want to apply for a job that has a bad boss or if you might just hold of on taking that job or applying for that job.

You are worth more

This one is even better because some people will take these low paying jobs because they want to get their foot in the door or get the experience.   I say don’t do it, find an employer who will pay what you are worth.   I could go down the street and get paid to bag groceries than maybe an employer who only wants to pay me 12 or 13 dollars to start off on.   That just boggles me, that I went to get an education and still can get a job that pays more than what I got my education for.   If we stopped allowing them to do this by not applying or accepting those jobs, the pay will eventually go up but we must be able to say no.

Don’t expect that Dream job

I say this with some trepidation that we shouldn’t expect to find that dream job right away.   In fact, we will probably have to work at a dead end job for a year or two at the very least to be able to have the requirements to get that dream job.   In truthfulness, you could easily find that dream job right after getting your education but the chances on that are slim to none, I’d say.  This is something, I’ve seen time and time again that people loss hope right after getting their education to be stuck in a dead end job.   This is the time to keep looking for a better job and create notifications to help keep you looking for a  better job down the road.

Avoid Job text Bots

This one seems quite common.  You get the text that says you’d be a great fit or something along the lines and you ask a question in text and it says “Perfect . . . .“.  These are just bots that I have come across, this is how lazy recruiters are trying to recruit people for their job.  If anything, his means the job might not be all that it is worth and they are having people quite left and right and this is the easiest way to try to find people to fill the job position.   Seems kind of a catch 22 in my book, if they aren’t going to actually read my question and answer it then the job isn’t for me.  I’ve turned them off by texting stop when I find out it was bot that answered me or when I get the perfect or some other way to say we want to talk to you before they even read your text.

These are just what I’ve seen in the job market as of late and thought I would talk about some of these and others ways to find a job in the computer repair or a technician jobs.  You can even figure out how much a computer technician should make by using Glassdoor or even Indeed to find out the salary rages someone would be making in your area.

What are some things you’ve seen that makes you cringe when looking for a job as a computer technician?  Have you seen some of this?  Leave a comment below and tell me your experiences as a job seeker.  If this post has helped you consider using my affiliate links to say thank you for this great post.

How to wipe your hard drive securely before selling or recycling your computer

Photo by: pastedo on Pixabay

Wiping the Hard drive

Sometimes it’s a good idea to wipe the hard drive beyond recovery to prevent someone else from getting that information about the previous owner.     It is always a good idea to erase the information before you sell or recycle or even donate your computer.   You can destroy the data on the hard drive with little or no effort but it does takes an app to do it.   Depending on your situation, if you have an OEM system, than you will probably want to reinstall Windows into the system that you are going to wipe securely and erase the data on the hard drive.  It’s best before you do this to create a USB or DVD of the operating system you are going to wipe.   If this is Windows 10, you can download the the media creation tool for Windows 10 and make a bootable USB for Windows 10 for after the wiping of the hard drive.  If this is an older system like Windows 7, I would suggest before wiping checking to see if you have the DVD for it or you could buy a Windows 7 from amazon using my Affiliate Link, which I’ll get a small amount of money when you do that.  If this is another system all together, Like Linux, or even Mac OS you’ll have to get a copy of the operating system that you are going to wipe and reinstall it to be helpful to the next person to use the system.

DBAN : Darik’s Boot and Nuke

Darik's boot and nuke

This is one of the utilities that I use to remove and erase all the information securely to prevent anyone from getting the information that is on the hard drive.    It’s open sourced and can be downloaded freely.   They do have an enterprise version that is for those who are running a business and requires a license to do use in a business environment.  This is however the first one that I use when I have a Hard drive that I need to erase, destroy,  or wipe the entire Hard drive.  This can even be used on SSD and NVME’s.

MHDD

This one is similar to DBAN but has some interesting features that work well with what I might need to do.  I often times will us MHDD after I use DBAN just to be safe and make sure nothing is left on the hard drive, or the Solid State drives to prevent anyone from getting any information from the hard drive.  This probably sounds like over kill but I figure it sometimes is needed to prevent the people from accessing the data.  It was developed by Dmitry Postrigan and I have used this program from time.  You’ll need to download the ISO and create a bootable USB or CD/DVD to use this program and I suggest something like Yumi Pen Drive creator to make a USB Bootable Disk for MHDD.

Formatting the HDD, SSD, or NVME

Format commends

This is the last option I would suggest because this option is only going to do it once and you’ll need to format the disk several times with different commands to provide enough assurances that the data is destroy or wiped.  This option is good for those disk drives that didn’t have any really important information on them and had either games or files that probably didn’t have anything on that would be too personal  for anyone to find.   I usually use this as a last resort when I know the system wasn’t used to keep personal data and maybe the HDD was being exclusively used for games on it.  The format command on a HDD or SSD could be useful because it’s already on the media creation tool and can be accessed by hitting Shift+F10.

Then all you will need to do it type:

format <drive>: /fs:NTFS /p:1 (For zeros)
or
format <drive>: /fs:NTFS /p:2 (For one's)

This will write zero’s  or one’s to every sector on the HDD or SDD and will securely erase the data.   I have found to go from zero’s to one’s or doing one’s than doing zeros.   Be warned thought doing this will take a very long time.  It could be hours between passes.

This option is good when you have a system that you can use to install and format HDD and still do other things on the system or if you can pull the HDD and SSD out and temporarily install it on the working system.  While it does it things you can do other things on the system.   Be warned this might take some of your system resources while you are formatting the HDD in question.  The System might be a bit slower to respond.   Also it will take a VERY long time to do multiple passes on a HDD.  So don’t be surprised if it takes several minutes to go from 0 to 1% or several hours to even get to 100% depending on the size of the drive you are formatting.

Do you have any good tools that work better?  Why not leave a comment and tell me what you use to securely wipe hard drives and SSD’s.  Why not share your experiences and hear how you do it.  If this has helped you with something, why not consider checking out my affiliate links below and say thank you for this great resource.

How to repair a computer after a power surge

Dell Dimension 3000 Fried

Computer repair after power surge

Is that even possible?  There seems to be some questions about that with a few friends of mine.  We’ve been talking about this and I thought I’d would bring you along for the ride.   If you didn’t have a Uninterruptable Power supply(UPS)(Amazon Affiliate Link), then maybe it is time to buy one. See my affiliate link of all the possible UPS that Amazon has.  The problem with some computers is that they have so many things that could happen that you might not really know what could of been hit.  I’m going to walk through some possible areas where to look for burns and or shorts in the system to possible know what you might need to do to get your system back up.  Be advised this is only a way to tell what might be the problem and it may be worse than you can know just by looking and seeing.

Power Supply

The first place I always look is at the Power supply.  Since that is where electricity is designed to go to.  If you push the start button and the power supply doesn’t even turn on, than you might have a blown power supply.  You can however check the motherboard and memory but I usually check the PSU when I suspect the power supply might of gotten hit by lighting or a surge in the system.   The PSU does have a fuse inside it that might of blown.   That is usually something you will not be able to get at.   However if you have another PSU you can use to plug into the system than you might be able to know if the PSU is the issue in the first place.  Do you need a new PSU, why not check out my Amazon Affiliate link and see if you can find another one  for your needs.

Depending on your system setup

If you suspect that it was from your LAN(Local area network) network that you got the power surge, than I would start looking inside the computer around the LAN connection.   Some people use WIFI and it will not cause any problems but if you use a LAN cord to connect to the internet that is the next place to look at to make sure it’s not burned or any black areas around the connection.  If that’s the case the Motherboard will most like need to be replaced but that is if nothing else works.   You’ll probably need to buy a CPU and motherboard and depending on your setup the GPU.   If the GPU was close to the LAN, than that might need to be replaced too.  With the high prices of GPU’s this could get really expensive really fast.  However if the system turns on and still refuses to post without errors, you could  always try to problem solve the motherboard issue before you switch it out.    Even my Gigabyte b450m ds3h(Amazon Affiliate Link) motherboard wouldn’t be to hard to replace if I had to but I would have to buy another i9 LGA 1200 CPU which would cost a lot.

Motherboard powers on

If the motherboard powers on and you’ve done the problem solving for the motherboard.  The last thing I usually try is to remove everything possible besides the CPU and one stick of RAM to verify that there isn’t anything that might not be working.   If you do that and it boots then it’s either the RAM(Random Access Memory) or the GPU (Graphics Processing UNIT) if it has one in the first place.  If however you get the CMOS or CPU FAIL error than the motherboard or the CPU is bad and at that point the only good option is to replace the motherboard and everything else associated with it.   You can however try to use the CPU and memory on a new motherboard if you want to know if they are good but I usually just replace it completely because you never know when those other parts will fail and than you will still have repair and upgrade the system at the same time.   You probably won’t be able to find the same CPU again unless you buy it second hand.

Well these are the area’s I usually look at when I suspect either a power surge or a lightning strike has just happened and my system won’t boot or even start due it.   If it happened to you, I feel sorry for you but you should either invest in a UPS or a extension cord that has a circuit breaker to prevent you system from being fried.

Did it happen to you?  How did you handle it or was it worse than you thought?  I’d love to hear how you solved your issues and what it was like to have those issues.  Why not leave a comment and talk about it.   Don’t forget to sign up for my newsletter and receive notifications when I post new content. 

Some advice for new computer technicians

Computer network technician training offered in Vancouver

We can’t do this alone!

This is the most important idea that you should understand. Most computer technicians think that they have to do it alone when it comes to problem solving an issue.  It is because  no one can ever know how to fix every possible problems that may arise.   Those are the times we should ask question and ask for help from other technicians.   This will help you even more than you might imagine because some other technician might know how to solve the issue or problem that you are having.    We might never really understand what someone else might know.   This also includes customers, because what one customer might not know another one might.

Research is everything

Sometimes even other technicians might not know what is causing the problem.  So use everything at your fingertips.   Don’t underestimate the power of word search in Google, Bing, and Yahoo.  It isn’t like one search engine is better than another.  Each search engine has some information that some others might not have.  Don’t just use one but should always use all of them.   Sometimes one search engine will not have the answers, so I will always go and check out two or more search engines for a possible fix for the issues.

You will have angry customers!

No one tells you this but no matter how nice or good you are, you’ll have those angry customers. You should be prepared to deal with them. I say this with some experience, no matter what you’ll do for a customer there will always be those who know nothing about computers and then get mad at you for some reason or another. You’ll need to learn to be patient with an angry customer. Learn to come up with ways to alleviate the stress or anger from the customer. My go to phrase when a customer is angry or stressed is “Here’s what I can do for you . . . “.   If you tell the customer that you can do something for the customer even if it is something small, it helps with making the customer feel like they are being heard.   Also learn to active listen to the customer and make sure you hear what they say by repeating back to them the problems they are having.   Also sometimes the customer is going to just need to vent and be angry.  Technicians should learn to just be there for the customers.

Computers will break!

This is the next thing you will learn being a technician, that no matter how careful you are going to be with a computer, You’ll break a system just by doing something you’ve done a billion times.   If it can be broken, it will be broken.  Murphy just likes to make people’s life harder, and we will always have those days.   I can say with certainty that no one will ever be perfect at solving problems or fixing the issues.   I’ve seen motherboards break or CMOS fail at the most unusual times.  So you should be prepared to always apologize to the customers or say your sorry and make it right, even if it’s not your fault.   Sometimes customers will want to feel like they are important to you and that helps keeps the customers coming back.

No technical jargon

No matter how much you know or think you know, keep the technical jargon to a minimum with customers.   Most of them aren’t even going to know what you are talking about if you don’t relate the problem to the customer.  I can remember several times when I heard someone tell a customers about a command or hardware and the customers eyes just glaze over because they just don’t understand.   Only tell the customer what they need to know, if it’s a customer error, teach the customer and try to prevent them from creating the problem again.

I’ve been in the computer world a long time and I am sure the old and new a like will agree that these are some valuable tips for those who might be interested in being a technician.  Nothing I’ve said here will stop angry customers but it might help.   What’s some things you’ve learned to help with customers not getting angry or make the customer happy?  I’d love to here what helped you with customers and I am sure others will too.