Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

pattern as opposed to a regular expression, which means you can use ? to
match a single character or * to match zero or many characters. You can


specify multiple —exclude parameters to exclude several patterns. Here is
an example:


Click here to view code image
matthew@seymour:~$ du --exclude=".xml" --exclude=".xsl"


However, typing numerous —exclude parameters repeatedly is a waste of
time, and you can use -X to specify a file that has the list of patterns you want
excluded. The file should look like this:


Click here to view code image
.xml
.xsl


That is, each pattern you want excluded should be on a line by itself. If that
file were called xml_exclude.txt, you could use it in place of the
previous example, like this:


Click here to view code image
matthew@seymour:~$ du -X xml_exclude.txt


You can make your exclusion file as long as you need, or you can just specify
multiple -X parameters.


TIP
If you run du in a directory where several files are hard-linked to the same
inode, you count the size of the file only once. If you want to count each
hard link separately for some reason, use the -l parameter (lowercase L).

Using echo


You can do many things with echo, especially with redirection (see Chapter
12 , “Command-Line Master Class, Part 2,” for more about redirecting
output). In its simplest use, echo sends whatever you tell it to send to
standard output. If you want to repeat text on the screen (which is useful in a
shell script, for example), just enter the text string in single quotation marks
(’), and the output appears below it, like this:


Click here to view code image
matthew@seymour:~$ echo 'I have the power!'
I have the power!


If you want to know the value of a system variable, such as TERM, enter the

Free download pdf