Hands on the Command Line in BASH
Thank you for your patience as I’ve been off on very practical and heavy-duty responsibilities with my Dad’s estate and with moving myself and all my stuff into a wee little house in the city.
I am now buckling down to work again. So I’ve just been checking to see what I was doing here before, and where I left off. As I see it, I was working my way through an online course in Linux on the linux.org site, and then summarizing the key thoughts or lessons I feel are important to share with others on this learning curve.
There is so much you can do in Linux that is much like in Windows. You click links or icons and things happen. But there is much more open to you if you are willing to learn some basic commands at the terminal. I confess, I have mixed feelings about that. I want to be a smart guru type too, but knowing what cryptic codes to type at the command prompt is plain scary.
Let’s plunge in. It’s bound to get easier once we understand some of it.
You click on that icon on the perimeter of your screen that looks like a TV or monitor. Up comes a window with a command prompt. (Do you recall working with a DOS computer yeas ago? This is a lot like that. Only instead of a C:/ prompt, you now are in a BASH shell. That’s an anacronym for “Bourne Again Shell” - named after someone.
You’ve most likely set up a user for yourself, so the prompt is likely to be your user name, and your IP address, like this; ruth@207-47-212-213:~>
It can be other things too, depending on your setup.
Let’s try out some basic commands. AT that prompt type;
cd /
That brings you to the top (or bottom, depending on how you look at the system tree) of all the files in your computer. Most commands have to be made while either at the root of your system, or in the directory where you want to affect the files. So we’ll be needing that “cd” command quite often.
But if you now try this command;
cd /root
which is different from the one above…. you now get a “Permission denied” response. Huh? What’s with that?
It means that you can’t get into that directory without first switching into your role as root user. We’ll get to that in a bit. Here’s some other basic commands you can use as an ordinary user;
ls
(that’s a small L and an s) It stands for “list the files please.” If you include a switch, -a, as in;
ls -a
it will provide you with a list of all the directories and files in that directory, including the hidden ones that start with a period, .
Now that you can see what’s in there, type;
cd /bin
See? That has got you inside the bin directory. Now type;
ls
Hmm! Before the list was all in blue (directories), now we have different colours for the files.
Incidentally, I’ve learned that bin is a very important part of our linux system. You might associate that word with garbage bins. Think of it instead as storage bins in your estate’s warehouse or special pantry. Your wealth is carefully sorted out and stored there.
Do you want to know where all the “gears” are? Your configuration files? Okay, you can back-track by typing;
cd ..
which gets you back out of bin and then you can type;
cd /etc
But a short-cut is available too. Just type;
cd /etc
and there you have leaped into this other folder. To see what’s there, you type, naturally;
ls
Whew! here’s a lot of files!
We’ll pick up and learn more next time…. I don’t want to overwhelm you all at once.
