diff --git a/docs/lesson/boot-process-bootloader.html b/docs/lesson/boot-process-bootloader.html index 4f9b5b03b..035d9027c 100644 --- a/docs/lesson/boot-process-bootloader.html +++ b/docs/lesson/boot-process-bootloader.html @@ -76,13 +76,13 @@
The most common bootloader for Linux is GRUB, you are most likely using it on your system. There are many other bootloaders that you can use such as LILO, efilinux, coreboot, SYSLINUX and more. However, we will just be working with GRUB as our bootloader.
So we know that the bootloader's main goal is to load up the kernel, but where does it find the kernel? To find it, we will need to look at our kernel parameters. The parameters can be found by going into the GRUB menu on startup using the 'e' key. If you don't have GRUB no worries, we'll go through the boot parameters that you will see:
Let’s start making some copies of these files. Much like copy and pasting files in other operating systems, the shell gives us an even simpler way of doing that.
$ cp mycoolfile /home/pete/Documents/cooldocs
mycoolfile is the file you want to copy and /home/pete/Documents/cooldocs is where you are copying the file to.
-You can copy multiple files and directories as well as use wildcards. A wildcard is a character that can be substituted for a pattern based selection, giving you more flexibility with searches. You can use wildcards in every command for more flexibility.
+You can copy multiple files and directories as well as use wildcards. A wildcard is a character that can be substituted for a pattern based selection, giving you more flexibility with searches.
+Wildcards are not a feature of cp, they are a feature of the shell. Before cp ever runs, the shell replaces the pattern with the list of matching filenames, so cp only ever sees ordinary filenames. That means wildcards work the same way with almost any command, and it also means the shell expands them against the files that exist right now.
Linux has some great built-in tools to help you how to use a command or check what flags are available for a command. One tool, help, is a built-in bash command that provides help for other bash commands (echo, logout, pwd, etc).
$ help echo-
This will give you a description and the options you can use when you want to run echo. For other executable programs, it’s convention to have an option called --help or something similar.
-$ echo --help+
This will give you a description and the options you can use when you want to run echo. Note that help only works on built-ins, so help ls won’t work, because ls is a separate program rather than something built into the shell.
+For other executable programs, it’s convention to have an option called --help or something similar.
+$ ls --help+
Don’t expect this to work on built-ins though. Since the shell handles them itself, echo --help won’t print any help, it will just echo the text --help back at you.
Not all developers who ship out executables will conform to this standard, but it’s probably your best shot to find some help on a program.
diff --git a/docs/lesson/modifying-permissions.html b/docs/lesson/modifying-permissions.html index a744667b1..1b605c473 100644 --- a/docs/lesson/modifying-permissions.html +++ b/docs/lesson/modifying-permissions.html @@ -90,7 +90,7 @@Removing permission bit on a file
$ chmod u-x myfile
Adding multiple permission bits on a file
-
$ chmod ug+w+
$ chmod ug+w myfile
There is another way to change permissions using numerical format. This method allows you to change permissions all at once. Instead of using r, w, or x to represent permissions, you'll use a numerical representation for a single permission set. So no need to specify the group with g or the user with u.
The numerical representations are seen below:
Ah, the Batmans of package management, these systems come with all the fixins to make package installation, removal and changes easier, including installing package dependencies. Two of the most popular management systems is yum and apt. Yum is exclusive to the Red Hat family and apt is exclusively to the Debian family.
Install a package from a repository
-Debian: $ apt install package_name -RPM: $ yum install package_name +Debian: $ sudo apt install package_name +RPM: $ sudo yum install package_name+
Note the sudo. Installing and removing software changes the whole system, not just your own files, so these commands need superuser access. Only the commands that just read information, like apt show, work without it.
Remove a package
-Debian: $ apt remove package_name -RPM: $ yum erase package_name +Debian: $ sudo apt remove package_name +RPM: $ sudo yum erase package_name
Updating packages for a repository
It's always best practice to update your package repositories so they are up to date before you install and update a package.
-Debian: apt update; apt upgrade -RPM: yum update +Debian: sudo apt update; sudo apt upgrade +RPM: sudo yum update
Get information about an installed package
diff --git a/docs/lesson/regular-expressions-regex.html b/docs/lesson/regular-expressions-regex.html index 3d77ca3db..9721d9b1c 100644 --- a/docs/lesson/regular-expressions-regex.html +++ b/docs/lesson/regular-expressions-regex.html @@ -161,19 +161,16 @@Exercise
Try to combine regular expressions with grep and search through some files.
grep [regular expression here] [file] +-## Quiz Question - -What regular expression would you use to match a single character? - -## Quiz Answer - -. -
What regular expression would you use to match a single character?
+.
+Adding the -i flag like many of the other commands, will give you a prompt on whether you want to actually remove the files or directories.
$ rm -r directory
You can’t just rm a directory by default, you’ll need to add the -r flag (recursive) to remove all the files and any subdirectories it may have.
-You can remove a directory with the rmdir command.
+There is also the rmdir command, but it only removes a directory that is already empty. It will refuse to do anything if there is still something inside, which makes it a much safer choice than rm -r when you only mean to clean up an empty directory.
$ rmdir directory@@ -168,6 +168,7 @@
How do you remove a file called myfile?
rm myfile
diff --git a/docs/lesson/stdout-standard-out-redirect.html b/docs/lesson/stdout-standard-out-redirect.html index 0e0cfd2e2..563c5f868 100644 --- a/docs/lesson/stdout-standard-out-redirect.html +++ b/docs/lesson/stdout-standard-out-redirect.html @@ -155,9 +155,7 @@What redirector do you use to append output to a file?
- -+
>>
diff --git a/docs/lesson/systemd-overview.html b/docs/lesson/systemd-overview.html index 0c570ed67..d1843735d 100644 --- a/docs/lesson/systemd-overview.html +++ b/docs/lesson/systemd-overview.html @@ -82,8 +82,8 @@Similar to Sys V runlevels, systemd boots into different targets:
Every file that gets created comes with a default set of permissions. If you ever wanted to change that default set of permissions, you can do so with the umask command. This command takes the 3 bit permission set we see in numerical permissions.
Instead of adding these permissions though, umask takes away these permissions.
$ umask 021-
In the above example, we are stating that we want the default permissions of new files to allow users access to everything, but for groups we want to take away their write permission and for others we want to take away their executable permission. The default umask on most distributions is 022, meaning all user access, but no write access for group and other users.
+In the above example, we are taking nothing away from the user, taking the write permission away from the group, and taking the execute permission away from everyone else.
+Now, what is umask subtracting from? Not 777, as you might expect. The system starts from 666 for a new file and 777 for a new directory, and then removes the umask bits. Files start at 666 because it would be a bad idea to make every file you create executable.
+So with the common default umask of 022:
++new file: 666 - 022 = 644 (rw-r--r--) +new directory: 777 - 022 = 755 (rwxr-xr-x) ++
This is why a file you just made is not executable even though your umask leaves the user bits alone. If you want to run it as a program, you still have to add the execute bit yourself with chmod.
When you run the umask command it will give that default set of permissions on any new file you make. However, if you want it to persist you'll have to modify your startup file (.profile), but we'll discuss that in a later lesson.
@@ -98,20 +105,17 @@What command is used to change default file permissions?
+umask
+$ cp mycoolfile /home/pete/Documents/cooldocs
mycoolfile is the file you want to copy and /home/pete/Documents/cooldocs is where you are copying the file to.
-You can copy multiple files and directories as well as use wildcards. A wildcard is a character that can be substituted for a pattern based selection, giving you more flexibility with searches. You can use wildcards in every command for more flexibility.
+You can copy multiple files and directories as well as use wildcards. A wildcard is a character that can be substituted for a pattern based selection, giving you more flexibility with searches.
+Wildcards are not a feature of cp, they are a feature of the shell. Before cp ever runs, the shell replaces the pattern with the list of matching filenames, so cp only ever sees ordinary filenames. That means wildcards work the same way with almost any command, and it also means the shell expands them against the files that exist right now.
$ rm -r directory
You can’t just rm a directory by default, you’ll need to add the -r flag (recursive) to remove all the files and any subdirectories it may have.
-You can remove a directory with the rmdir command.
+There is also the rmdir command, but it only removes a directory that is already empty. It will refuse to do anything if there is still something inside, which makes it a much safer choice than rm -r when you only mean to clean up an empty directory.
$ rmdir directory
How do you remove a file called myfile?
rm myfile