Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

Each of the commands in the previous sections can be used with pattern-
matching strings known as wildcards or regular expressions. For example, to
delete all files in the current directory beginning with the letters abc, you can


use an expression beginning with the first three letters of the desired
filenames. An asterisk (*) is then appended to match all these files. Use a
command line with the rm command like this:


Click here to view code image
matthew@seymour:~$ rm abc*


Linux shells recognize many types of file-naming wildcards, but this is
different from the capabilities of Linux commands supporting the use of more
complex expressions. You learn more about using wildcards in Chapter 11,
“Command-Line Master Class, Part 1,” and in Chapter 14, “Automating
Tasks and Shell Scripting.”


NOTE
You can also learn more about using expressions by reading the grep
manual pages (man grep), but because both man and grep are covered
in Chapter 11, “Command-Line Master Class, Part 1,” this mention is
included only to whet your appetite.

Working as Root


The root, or super user, account is a special account and user on UNIX and
Linux systems. Super user permissions are required in part because of the
restrictive file permissions assigned to important system configuration files.
You must have root permission to edit these files or to access or modify
certain devices (such as hard drives). When logged in as root, you have total
control over your system, which can be dangerous.


When you work in root, you can destroy a running system with a simple
invocation of the rm command like this:


Click here to view code image
matthew@seymour:~$ sudo rm -rf /


This command line not only deletes files and directories but also could wipe
out file systems on other partitions and even remote computers. This alone is
reason enough to take precautions when using root access.


The only time you should run Linux as the super user is when you are
configuring the file system, for example, or to repair or maintain the system.
Logging in and using Linux as the root operator isn’t a good idea because it

Free download pdf