General Background Information
An "Operating System" (or "OS" for short) is the main piece of software on a computer. It gets all of the other software to work with the hardware of the computer. The core part of the Operating System is the "Kernel". The Kernel is a program that always stays in Memory. Two popular Operating Systems are Microsoft Windows and macOS.Easy Installation
Here we will give a simple step-by-step procedure for running LinuxMint (a very easy to use Distro derived from Ubuntu). This will let us try it out, and if we want, permanently install it over Microsoft Windows or some other OS. If you are worried about accidentally deleting all of your files, then do all of this on a computer that you are NOT worried about wiping out. [Eli shows how to run a copy of Ubuntu inside of macOS using VirtualBox. This is another option for testing it out if you are hesitant to go through the process described below.]Using Basic Commands...
Because LinuxMint has a GUI, we can get by without ever really using the Shell. However, knowing how to use it can be very useful. Sometimes people copy-and-paste commands from various websites into the Shell without understanding what those commands actually do. This is not always a good idea. Instead, let's try to learn why we might use a particular command before we type it in. Please keep in mind that all commands are case-sensitive (i.e.: there is a difference between typing something in uppercase or lowercase, and we must use spaces properly). Some commands are also Distro specific. Here, we are focused on commands appropriate to LinuxMint. [If you are interested, there is also a little interactive course at LinuxCommand.org for learning more.]...For Closing The Shell
To open the Shell, click the black icon on the taskbar labeled "Xfce Terminal", or press CTRL + ALT + T. The window that pops up is the Shell. This is where we can type in commands.exit
and press ENTER.
...For Learning More
If we input a letter and press TAB, then we will get a list of all of the commands that start with that letter.whatis
followed by a space, then a command, and press ENTER. This will tell us very briefly what that command does.
man
followed by a space, then a command, and press ENTER. This will bring up a page within the manual that covers that command. Yes, the manual for the Operating System is built into the Operating System itself! ☺
less
integrated into the Shell. The page that pops up whenever we use the man
command is actually a text file. Use the ↑ UP ARROW and ↓ DOWN ARROW to navigate through this text file, or press ENTER to advance through it line-by-line. Press H for a descrption of how to navigate through text files in general with less
. Press Q to quit using less
.
--help
, and press ENTER. The information that comes up is very similar to the page in the manual, but it is not a separate text file. It appears inside the Shell itself.
--help
command brings up impossible to scroll through. In order to open up this information in less
, type a vertical bar | immediately after --help
, followed by the word less
, and then press ENTER. This will open up the same information in a text file that we can scroll through with the arrow keys. Again, press Q to quit using less
.
man
instead of --help|less
, but try both and see what works best for you.
clear
and press ENTER. This will remove all of the previously entered commands and extra text.
...For Navigating Through "Directories" or "Folders"
Whenever we are using a GUI, we usually refer to a specific location on a drive as a "folder". Whenever we are using a CLI, we usually refer to a specific location on a drive as a "directory". Directories and folders are equivalent..txt
or .pdf
)
.jpg
or .png
)
.mp3
or .ogg
)
.mp4
or .avi
)
C:\
" to specify different drives. GNU+Linux does not do this. Instead, all drives are treated as if they are part of a single directory.
pwd
and press ENTER. This will give us the "address" of our current location within the File Tree, a list of folders separated by forward slashes /. The letters pwd
mean "print working directory", and the "working directory" is our current location.
ls
and press ENTER. The letters ls
mean "list", and a list of folders and/or files should pop up. Any text in blue is the name of another directory.
cd
followed by space, and then the name of that directory. Press ENTER. We will see the text in front of the cash sign $ change to show that we are now within a different directory. The letters cd
mean "change directory".
cd
followed by a space, and then a hyphen -. Press ENTER. To go up a folder (i.e.: along our absolute path), type in cd
followed by a space, and then two periods. Press ENTER. To reiterate:
cd -
takes us to the directory that we were in previously
cd ..
takes us up a folder within the same address
cd
followed by a space, and then a tilde ~. Press ENTER.
cd
followed by a space, then a forward slash /, and pressing ENTER.
Folder | Name | Contents |
---|---|---|
binaries | A "binary" is essentially a program. This is how the system keeps track of applications. | |
system binaries | This contains programs related to the system itself. | |
bootloaders | This contains everything needed for the OS to boot up. | |
devices | This contains "pseudofiles" related to the hardware of the computer. For example, "sda" is a disk, and a number after it is a partition on that disk. | |
et cetera | This contains system-wide applications and settings. | |
libraries | This contains files that are used by the programs within /bin and /sbin. | |
or /media |
mount | This contains all external drives (USB, SD, etc.). |
optional | This usually contains software that is manually installed, or applications that are self-created. | |
processes | This contains "pseudofiles" that are generated to describe system processes and the use of system resources. This information is handy for developing programs. | |
This is the root user's home folder. | ||
This is a "temporary filesystem" (or "tempfs") that runs inside of RAM. It shows the runtime information for boot processes. Everything within this folder disappears with a shutdown or reboot. | ||
This contains "snap packages", self-contained applications that run differently from normal. | ||
service | This contains service data (such as information related to a webserver or FTP). | |
system | This is similar to /run. It shows what is going on within the Kernel. | |
temporary | This holds file data that is in use. For example, it can contain information for a text document that hasn't been saved yet. If a program crashes, check here before you reboot to try to recover the files. | |
user | This contains applications installed by specific users. It is different from /bin. | |
variable | This contains files that are expected to change dynamically in size. For example, it can include "log files" (which keep track of what is going on inside of a program) or the "spool" (which shows what is in the printer queue). | |
This contains all of the user's personal files. It is similar to "My Documents" in Microsoft Windows. |
...For Handling "Files" or "Folders"
To make a new directory (i.e.: a new folder), type inmkdir
followed by a space, and then the name that you want to give the folder. Press ENTER. The letters mkdir
are short for "make directory".
mv
followed by a space, the name of the file, another space, and then the address of the location that we want to place it in. Press ENTER.
cp
instead of mv
. Rather than shifting the file from one location to another, it will make an extra copy within the location we specify.
rm
followed by a space, and then the file name. Press ENTER. Please note that this deletes the file directly; it does NOT put it into the "Trash" folder!
mv
cp
rm
unzip
, followed by a space, and then the file name. Press ENTER. All of the files that it contains will then appear within the same directory.
...For Installing / Updating / Uninstalling Software
Linux Mint has a program called "Software Manager" (under "System" in the main menu). This program allows one to install / uninstall various apps with just a click of a button (through an interface that is similar to something like Google Play). However, one will eventually need to learn some commands if they want to install stuff that Software Manager doesn't have.sudo
. This is short for "superuser do". Whatever command comes after it will be run under "superuser," but we will probably be prompted to enter a system password first.
apt
.
sudo apt install
followed by a space, and then the name of a program. It will install this program once we hit ENTER.
install
with update
, remove
, and purge
to do these actions on that same program after it is installed. Sometimes different aspects of a program will be separated into distinct "packages". Therefore, the difference between remove
and purge
is that the latter also gets rid of all associated files.
remove
and purge
commands, packages can be marked for "removal" or "complete removal" by right-clicking their name within the list.
...For Handling Permissions
Sometimes we have to change the permissions on an individual file or folder before we can do anything with it. By "permission", we mean that we have to specify who can do what to which file or folder.Account | Meaning |
---|---|
This is the owner of the file or folder. | |
This is when multiple users share in the ownership of a file or folder. | |
This is every user outside of the above two categories. | |
This refers to the above three categories simultaneously. |
Action | Meaning |
---|---|
To "read" a file or folder is to be able to view its contents. | |
To "write" to a file or folder is to be able to modify it (i.e.: to add or delete from its contents). | |
To "execute" a file is to be able to run it; this assumes it is a program. To "execute" a folder means that we can enter into it with the cd command. |
ls -l
followed by a space, and then the name of the file. Press ENTER. [Note that there is a space between the ls
and the -l
.]
ls
means to "list". In this case, the -l
means to put it into "long form" (i.e.: show the details behind the files and folders that are listed). A line of text that is split into columns should pop up. Generally, the layout from left-to-right is...
-
) or a directory (marked with a d
).
r
, then they can read that file or folder. If there is a w
, then they can write to that file or folder. If there is an x
, then they can execute that file or folder. The letters r
, w
, and x
always come in this order. If there is a hyphen instead of one of those letters, then it means that the user cannot do that action.
chmod
command. This is short for "change mode".
chmod
followed by a space. The next character that we type will determine who this command applies to:
u
for user.
g
for group.
o
for other.
a
for all of the above.
+
), removing permissions (with a -
), or setting a particular permission and removing all others (with a =
).
r
for read.
w
for write.
x
for execute.
chmod u+x
, and then the name of the file or folder, it will allow the user to execute that file or folder once we hit ENTER. In other words, the +x
means that we are giving the permission to execute that file or folder to u
, the user.
chmod u-x
, and then the name of that same file or folder, it will remove the permissions that we just gave once we hit ENTER. Again, -x
means that we are removing the permission to execute that file or folder to u
, the user.
chmod g=r
, and then the name of a file or folder, it will allow the group to read that file or folder and nothing else once we hit ENTER. The g=r
means allow the group to read that file or folder and remove every other permission from it (i.e.: make it "read only").
chmod
followed by a space.
u
, g
, o
, or a
to determine who it applies to.
+
, -
, or =
to give, remove, or change permissions.
r
, w
, and/or x
to determine what actions are allowed.
Base-10 Number | Meaning |
---|---|
no permissions | |
execute | |
write | |
write and execute | |
read | |
read and execute | |
read and write | |
read, write, and execute |
Base-10 | ||||||||
---|---|---|---|---|---|---|---|---|
Base-2 | ||||||||
Equivalent Pattern |
chmod
followed by a space, 777, and then the name of a file or folder. Once we hit ENTER, it will allow the user, group, and all others the ability to read, write, and execute that file or folder. In other words, anyone can now do anything they want with that file or folder. The first seven allows the user read, write, and execute permissions. The second seven does the same thing for the group. The last seven does the same thing for everyone else.
Conclusion
We hope that this has been helpful in exploring GNU+Linux and gaining a basic understanding of how to use it. This can serve as a basis for more "advanced" uses of the Operating System, like writing "Shell Scripts", a kind of programming done within the CLI itself.