Recent Changes - Search:

Video Sites

NCECAYoutubeIndex not maintained

Thai

w0it

pmwiki.org

edit SideBar

UnderstandingLinux

I am going to try and explain Linux using the process of setting up an Allstar Node on a Raspberry Pi as an example. This is not an explaination of how to setup the node, but how to learn about Linux as you do. Since I work on a Mac I use a program called Terminal to get me into the Raspberry Pi. Windows users often use PuTTY?, If you are working from a Raspberry Pi you might find yourself using LXTerminal? to do this. There are many other terminal programs. They run a command line interface. You type in commands and they do what you tell them to do.

Bash Shell Interface. This is really what tells the computer what to do. It sits between your keyboard strokes and the computer and interprets your commands and feeds them to the computer and sends a response back to the screen.

When I open a wind on my Mac it opens a bash shell that operates on my Mac. It tells me when I last used a bash shell and what file was used to control it. The file is associated with a device usually a keyboard.

 Last login: Thu Sep  4 16:41:40 on ttys000

It follows this information, again on my mac with my username and a prompt. The prompt is sort of a question, "tell me what to do". It is usually, maybe always a special character. On my Mac it is a "%", on my Allstar node it is a "#".

Here is what this looks like on a Mac and the Allstar Linux machine

  • Mac
    louiskatz@louiss-iMac ~ %

This says "user louiskatz on louis' iMac, tell me what you want me to do".

  • Allstar node bash shell
    [root@WOIT-52109 supermon]#

This says, "root user" on the machine called W0IT-52109, you are in the folder called supermon. Tell me what to do.

"So Louis, what does 'root' mean." It is the main directory. I think of it as the top of the stump, just before you cut a tree down, all the branches and sub-branches lead out from it. You could think of it as a room of file cabinets, each with many drawers, each drawer with folders and subfolders, but the room analogy is too limited, and a drawer and a folder really are the same thing. I think bigger to smaller branches represents the file system better.

Its important to understand that everything is a file that is on the hard drive. Even folders are files that contain a list of files. To get the list, to look at part of the file that is folder you are currently in, you can type "ls" . "ls" stands for "list" and it gives you a simple list of the normal visible files you might see in a folder on a graphical user interface like the Windows system, or the Mac system or Ubuntu. It prints them in alphabetic order with capitalized file names first. On the Mac all types of files are colored the same in the Terminal. On the Raspian machine, the Pi, the directories or folders are blue, but these change on different systems. If you want to know what kind of files these are, who owns them, when they were changed, you need to use an option with the ls command, -l which means long.

[root@WOIT-52109 supermon]# ls -l
total 708
-rw-r--r-- 1 root root  42817 Jan 31  2018 Cape_Coral_yard.jpg
-rw-r--r-- 1 root root     99 Feb 18  2018 README
-rw-r--r-- 1 root root    337 Sep  3 19:13 allmon.bu
-rw-rw-r-- 1 root http    362 Sep  4 10:20 allmon.ini
-rw-r--r-- 1 root root    869 Feb 23  2018 allmon.ini.example
-rw-r--r-- 1 root root  14280 Sep 30  2018 allstarLogo.png
-rw-r--r-- 1 root root   3609 Sep 30  2018 allstarlink.jpg

The -rw-r--r-- tells you what the different sorts of users can do with these files. The first used on these files is "root". The column after this is the group. In this case all the files are in group of uses called "root" except for one owned by the group http. The numbers like 42817 tells you the size of the file. This is followed by the date it was written and then its name.

These are all things you would normally think of as files but there are a few special that are hidden because they normally do not need to be seen. If you need or want to you can use -a option to see All the files. You can group these options with spaces between them.

[root@WOIT-52109 supermon]# ls -l -a
total 724
drwxr-xr-x 5 root http   4096 Sep  3 19:19 .
drwxr-xr-x 6 root root   4096 May 18  2022 ..
-rw-r--r-- 1 root root    115 Feb  4  2018 .htaccess
-rw-r--r-- 1 root root    136 Sep  4 10:12 .htpasswd
-rw-r--r-- 1 root root  42817 Jan 31  2018 Cape_Coral_yard.jpg
-rw-r--r-- 1 root root     99 Feb 18  2018 README

So, we were talking about the root directory, the start of the tree of files. To get there and see it we have to Change Directories. For this we use the change directories command cd . To indicate the root directory we can just use / , cd / . This is what you will see

[root@WOIT-52109 supermon]# cd /
[root@WOIT-52109 /]# 

If you look again at the output of ls -l -a you will see two files. One is the dot file, named "." . That is this directory. The .. file points to the directory this one is in. If you use the command cd ../ it takes you up one directory. cd ../../ takes you up two.

Again, it says use root, on the W0IT? machine is at the "/" or root directory. Lets see what is in it.

[root@WOIT-52109 /]# ls   
bin   dev  home  lost+found  mnt  proc  run   srv  tmp  var
boot  etc  lib   media       opt  root  sbin  sys  usr

For me, this list was very confusing. I could spend hours looking for files in it before I learned what these folders were supposed to be used for. So here is a list.

  • bin - bin stands for binaries. These are executable programs. I believe this refers to programs written in text converted to binary numbers, machine language, ready to be executed.
  • sbin - binaries for administrators and admin or super ('s') users including, but not necessarily "root". There are a lot of users that are not really people like "http". Users in this sense are sort of groups of permissions designed to take care of automated functions that need to happen.
  • usr - user related programs. It also can contain a bin directory. I believe that when it contains an sbin directory this is really the same directory as other sbin directories, an alias.
  • etc - system configuration files
  • srv - this is where server related files are kept, like the web server. On Allstar systems it is where Supermon, the web interface files are kept.
  • dev - dev= devices. These are files that essentially tell the computer how to interact with devices like keyboards, drives, printers, usb hubs, you name it.
  • home - this is the default directory.
  • lost+found - files that have been goofed up, and cannot be assembled back or otherwise corrupted end up here.
  • mnt - temporary mount directories for mounting the file system (whatever that means)
  • proc - information about running processes
  • run - runtime data.
  • mnt - temporary mount data for devices.
  • media - mount points for removable media. On the Raspberry Pi with the file system on a flash card, the flash card does not count as removable.

One of the more confusing things about this is that there can be a bin or srv or etc directory in several places and these are different directories. So you need to know where the directory is as well as what it is called. So, someone might tell you to edit a file called index.php . It could be buried anywhere on your computer. But if you know it is for a server, and is used in Supermon, the successor of Allmon you might be able to just find it. On my system it is in the allmon2 directory which is in the http directory in the srv directory in root. From root or anywhere you could type "cd /srv/http/allmon2 or do these changes of directory, one at a time with an ls command inbetween to know where you are going.

Editing files. If you never used a command line editor before it can be a little daunting. I tell first time users to put their mouse out of reach. Everything is done with the keyboard. Rather than mouse around, you use the arrow keys to move your cursor. For me the delete key operates a bit different and inserting text is a bit different but,, I have become used to it. There are many text editors that can be on or built-in to a linux or unix or bsd system, but an editor called nano is common and what I prefer.

In order to open a file, say a configuration file called bogus.conf, or whatever its name is you can navigate using cd to the folder it is in and then type "nano bogus.conf" But, especially if you are beginning linux user, and even if not, and especially if you have five thumbs on each hand, you should make a copy of the file first. cp stands for copy. cp bogus.conf bogus.bu_2025.09.04 creates a copy of the original file named bogus.bu_2025.09.04 . It is good to date them. "bu" stands for backup. Unless you have a compelling reason to do otherwise, use this format. Do not rely on the file date as a means to store when it was used. Its better to have it in the file name and change the name if you change it.

It is good to know how to get out of things. control X and control C get you out of most things. You can usually just close the terminal window, but that is not always the best choice.

Edit - History - Print - Recent Changes - Search
Page last modified on September 04, 2025, at 09:26 PM