Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
Ctrl+U—Erases   the entire  line
Ctrl+W—Erases word-by-word
Left and right arrow keys—Move along the line to where the error is
Ctrl+A—Moves the cursor to the beginning of the line
Ctrl+E—Moves the cursor to the end of the line
Ctrl+K—Erases everything to the right of the cursor’s position
Ctrl+Y—Restores something you just deleted but shouldn’t have

Confining a Script to a Directory


Sometimes you want to isolate a process from the rest of the system, such as
when you want to test a script you have written, but you also want to make
sure the script is only able to affect what you want it to and not anything else.
To do this, you can set up what is called a chroot jail. Really, all you are
doing is creating a new directory, copying the files you need for the process to
run into that directory, and then using the chroot command to change the
root directory to the base of this new file system tree. Explained differently,
you are making the system act temporarily as if the directory you just named
is root, when in reality nothing in the file system has changed.


For example, let’s say you have a simple file system like this:


Click here to view code image
/
├─etc
├─home
| └─testing
| └─fakeetc
| └─www
└─var
└─www


If you enter this:


Click here to view code image
matthew@seymour:~$ chroot testing


And follow it with this:


Click here to view code image
matthew@seymour:~$ ls /


You receive this output:

Free download pdf