0% found this document useful (0 votes)
83 views

Lpic Lab

The document discusses the Linux command uname and how it can be used to display system information. It explains that uname with no options will display the kernel name, while uname -n and uname --nodename will display the network node hostname. It demonstrates running uname with these different options and shows the output is the same hostname ("localhost") in each case.

Uploaded by

Merveil Lubanja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

Lpic Lab

The document discusses the Linux command uname and how it can be used to display system information. It explains that uname with no options will display the kernel name, while uname -n and uname --nodename will display the network node hostname. It demonstrates running uname with these different options and shows the output is the same hostname ("localhost") in each case.

Uploaded by

Merveil Lubanja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

5.2.

4 Step 4
The next command displays information about the current system. To be able to
see the name of the kernel you are using, type the following command into the
terminal:

uname

Your output should be similar to the following:

sysadmin@localhost:~$ uname
Linux

Many commands that are executed produce text output like this. You can
change what output is produced by a command by using options after the name
of the command.

Options for a command can be specified in several ways. Traditionally in UNIX,


options were expressed by a hyphen followed by another character; for
example: -n.

In Linux, options can sometimes also be given by two hyphen characters


followed by a word, or hyphenated word; for example: --nodename.

Execute the uname command again twice in the terminal, once with the option -
n and again with the option --nodename. This will display the network node
hostname, also found in the prompt.

uname -n
uname --nodename

Your output should be similar to the following:

sysadmin@localhost:~$ uname -n
localhost
sysadmin@localhost:~$ uname --nodename
localhost
5.2.4 Step 4
The next command displays information about the current system. To be able to
see the name of the kernel you are using, type the following command into the
terminal:

uname

Your output should be similar to the following:

sysadmin@localhost:~$ uname
Linux

Many commands that are executed produce text output like this. You can
change what output is produced by a command by using options after the name
of the command.

Options for a command can be specified in several ways. Traditionally in UNIX,


options were expressed by a hyphen followed by another character; for
example: -n.

In Linux, options can sometimes also be given by two hyphen characters


followed by a word, or hyphenated word; for example: --nodename.

Execute the uname command again twice in the terminal, once with the option -
n and again with the option --nodename. This will display the network node
hostname, also found in the prompt.

uname -n
uname --nodename

Your output should be similar to the following:

sysadmin@localhost:~$ uname -n
localhost
sysadmin@localhost:~$ uname --nodename
localhost

5.2.5 Step 5
The pwd command is used to display your current "location" or current
"working" directory. Type the following command to display the working
directory:

pwd

Your output should be similar to the following:

sysadmin@localhost:~$ pwd
/home/sysadmin
sysadmin@localhost:~$

The current directory in the example above is /home/sysadmin. This is also


referred to as your home directory, a special place where you have control of
files and other users normally have no access. By default, this directory is
named the same as your username and is located underneath
the /home directory.

As you can see from the output of the command, /home/sysadmin, Linux uses the
forward slash / to separate directories to make what is called a path. The
initial forward slash represents the top-level directory, known as the root
directory. More information regarding files, directories and paths will be
presented in later labs.

The tilde ~ character that you see in your prompt is also indicating what the
current directory is. This character is a "shortcut" way to represent your home.

Consider This
pwd stands for "print working directory". While it doesn't actually "print" in
modern versions, older UNIX machines didn't have monitors so the output of
commands went to a printer, hence the somewhat misleading name of pwd.

5.3.1 Step 1
Execute a new command and then execute the history command:

echo Hi
history

Remember
The date command will print the time and date on the system.
The clear command clears the screen.
Your output should be similar to the following:
sysadmin@localhost:~$ history
1 ls
2 ls -l
3 ls -l /tmp
4 whoami
5 uname
6 uname -n
7 uname --nodename
8 pwd
9 echo Hi
10 history
sysadmin@localhost:~$

Your command numbers may differ from those provided above. This is because
you may have executed a different number of commands since opening the
virtual terminal.

5.3.2 Step 2
To view a limited number of commands, the history command can take a
number as a parameter to display exactly that many recent entries. Type the
following command to display the last five commands from your history:

history 5

Your output should be similar to the following:

sysadmin@localhost:~$ history 5
7 uname --nodename
8 pwd
9 echo Hi
10 history
11 history 5

5.3.3 Step 3
To execute a command again, type the exclamation point and the history list
number. For example, to execute the 9th command in your history list, you would
execute the following:

!9
sysadmin@localhost:~$ !9
echo Hi
Hi

5.4 Shell Variables


Shell variables are used to store data in Linux. This data is used by the shell
itself as well as by programs and users.

The focus of this section is to learn how to display the values of shell variables.

5.4.1 Step 1
The echo command can be used to print text and the value of a variable, and to
show how the shell environment expands metacharacters (more on
metacharacters later in this lab). Type the following command to have it output
literal text:

echo Hello Student

Your output should be similar to the following:

sysadmin@localhost:~$ echo Hello Student


Hello Student
sysadmin@localhost:~$

5.4.2 Step 2
Environment variables are available system-wide. The system automatically
recreates environment variables when a new shell is opened. Examples include
the PATH, HOME, and HISTSIZE variables. The HISTSIZE variable defines how
many previous commands to store in the history list. In the example below, the
command will display the value of the HISTSIZE variable:
sysadmin@localhost:~$ echo $HISTSIZE‌
1000
sysadmin@localhost:~$
5.4.3 Step 3
Type the following command to display the value of the PATH variable:

echo $PATH

Your output should be similar to the following:

sysadmin@localhost:~$ echo $PATH


/
home/sysadmin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
:/usr/games
sysadmin@localhost:~$

The PATH variable is displayed by placing a $ character in front of the name of


the variable.

This variable is used to find the location of commands. Each of the directories
listed above are searched when you run a command. For example, if you try to
run the date command, the shell will first look for the command in
the /home/sysadmin/bin directory and then in the /usr/local/sbin directory
and so on. Once the date command is found, the shell "runs it”

5.4.4 Step 4
Use the which command to determine if there is an executable file, in this case
named date, that is located within a directory listed in the PATH value:

which date

Your output should be similar to the following:

sysadmin@localhost:~$ which date


/bin/date
sysadmin@localhost:~$

The output of the which command tells you that when you execute


the date command, the system will run the command /bin/date.
The which command makes use of the PATH variable to determine the location
of the date command.
5.5.4 Step 4
The final command type is the executable program. These commands invoke
programs installed on the system which perform specific tasks. When a user
types the vi command, the shell uses the PATH file to locate and execute the
program. Programs like vi are available on just about every Linux distribution;
other programs, like vlc (an open source media player often used on Linux
desktops), are installed by users or administrators for a specific purpose and will
not be listed in the PATH unless they have been installed separately.

type vi
cd /bin
type vlc
cd
sysadmin@localhost:~$ type vi
vi is /usr/bin/vi
sysadmin@localhost:~$ cd /bin
sysadmin@localhost:/bin$ type vlc
-bash: type: vlc: not found
sysadmin@localhost:/bin$ cd
sysadmin@localhost:~$

5.5.4 Step 4
The final command type is the executable program. These commands invoke
programs installed on the system which perform specific tasks. When a user
types the vi command, the shell uses the PATH file to locate and execute the
program. Programs like vi are available on just about every Linux distribution;
other programs, like vlc (an open source media player often used on Linux
desktops), are installed by users or administrators for a specific purpose and will
not be listed in the PATH unless they have been installed separately.

type vi
cd /bin
type vlc
cd
sysadmin@localhost:~$ type vi
vi is /usr/bin/vi
sysadmin@localhost:~$ cd /bin
sysadmin@localhost:/bin$ type vlc
-bash: type: vlc: not found
sysadmin@localhost:/bin$ cd
sysadmin@localhost:~$

5.6 Quoting
There are three types of quotes used by the Bash shell: single quotes ('), double
quotes (") and back quotes (`). These quotes have special features in the Bash
shell as described below.

To understand single and double quotes, consider that there are times that you
don't want the shell to treat some characters as "special". For example, as you
learned earlier in this lab, the * character is used as a wildcard. What if you
wanted the * character to just mean an asterisk?

Single quotes prevent the shell from "interpreting" or expanding all special
characters. Often single quotes are used to protect a string (a sequence of
characters) from being changed by the shell, so that the string can be
interpreted by a command as a parameter to affect the way the command is
executed.

Double quotes stop the expansion of glob characters like the asterisk (*),
question mark (?), and square brackets ( [ ] ). Double quotes do allow for both
variable expansion and command substitution (see back quotes) to take place.

Back quotes cause "command substitution" which allows for a command to be


executed within the line of another command.

When using quotes, they must be entered in pairs or else the shell will not
consider the command complete.

While single quotes are useful for blocking the shell from interpreting one or
more characters, the shell also provides a way to block the interpretation of just
a single character called "escaping" the character. To "escape" the special
meaning of a shell metacharacter, the backslash \ character is used as a prefix
to that one character.

5.6.1 Step 1
Execute the following command to use back quotes ` (found under
the ~ character on some keyboards) to execute the date command within the
line of the echo command:
echo Today is `date`

Your output should be similar to the following:

sysadmin@localhost:~$ echo Today is `date`


Today is Mon Dec 3 21:29:45 UTC 2018

5.6.2 Step 2
You can also place $( before the command and ) after the command to
accomplish command substitution:

echo Today is $(date)

Your output should be similar to the following:

sysadmin@localhost:~$ echo Today is $(date)


Today is Mon Dec 3 21:33:41 UTC 2018

Why two different methods that accomplish the same thing? Backquotes look
very similar to single quotes, making it harder to "see" what a command is
supposed to do. Originally, shells used backquotes; the $(command) format was
added in a later version of the Bash shell to make the statement more visually
clear.

5.6.3 Step 3
If you don't want the backquotes to be used to execute a command, place single
quotes around them. Execute the following:

echo This is the command '`date`'

Your output should be similar to the following:

sysadmin@localhost:~$ echo This is the command '`date`'


This is the command `date`
sysadmin@localhost:~$
5.6.4 Step 4
Note that you could also place a backslash character in front of each backquote
character. Execute the following:

echo This is the command \`date\`

Your output should be similar to the following:

sysadmin@localhost:~$ echo This is the command \`date\`


This is the command `date`
sysadmin@localhost:~$

5.6.5 Step 5
Double quote characters don't have any effect on backquote characters. The
shell will still use them as command substitution. Execute the following to see a
demonstration:

echo This is the command "`date`"

Your output should be similar to the following:

sysadmin@localhost:~$ echo This is the command "`date`"


This is the command Mon Dec 3 21:37:33 UTC 2018

5.6.6 Step 6
Double quote characters will have an effect on wildcard characters, disabling
their special meaning. Execute the following:

echo D*
echo "D*"

Your output should be similar to the following:

sysadmin@localhost:~$ echo D*
Desktop Documents Downloads
sysadmin@localhost:~$ echo "D*"
D*
sysadmin@localhost:~$

Important
Quoting may seem trivial and weird at the moment, but as you gain more
experience working in the command shell, you will discover that having a good
understanding of how different quotes work is critical to using the shell.

5.7 Control Statements


Typically, you type a single command and you execute it when you press Enter.
The Bash shell offers three different statements that can be used to separate
multiple commands typed together.

The simplest separator is the semicolon (;). Using the semicolon between
multiple commands allows for them to be executed one right after another,
sequentially from left to right.

The && characters create a logical "and" statement. Commands separated by


&& are conditionally executed. If the command on the left of the && is
successful, then the command to the right of the && will also be executed. If the
command to the left of the && fails, then the command to the right of the && is
not executed.

The || characters create a logical "or" statement, which also causes


conditional execution. When commands are separated by ||, then only if the
command to the left fails, does the command to the right of the || execute. If
the command to the left of the || succeeds, then the command to the right of
the || will not execute.

To see how these control statements work, you will be using two special
executables: true and false. The true executable always succeeds when it
executes, whereas, the false executable always fails. While this may not
provide you with realistic examples of how && and || work, it does provide a
means to demonstrate how they work without having to introduce new
commands.

5.7.1 Step 1
Execute the following three commands together separated by semicolons:

echo Hello; echo Linux; echo Student

As you can see the output shows all three commands executed sequentially:
sysadmin@localhost:~$ echo Hello; echo Linux; echo Student
Hello
Linux
Student
sysadmin@localhost:~$

5.7.2 Step 2
Now, put three commands together separated by semicolons, where the first
command executes with a failure result:

false; echo Not; echo Conditional

Your output should be similar to the following:

sysadmin@localhost:~$ false; echo Not; echo Conditional


Not
Conditional
sysadmin@localhost:~$

Note that in the previous example, all three commands still executed even
though the first one failed. While you can't see from the output of
the false command, it did execute. However, when commands are separated by
the ; character, they are completely independent of each other.

5.7.3 Step 3
Next, use logical "and" to separate the commands:

echo Start && echo Going && echo Gone

Your output should be similar to the following:

sysadmin@localhost:~$ echo Start && echo Going && echo Gone


Start
Going
Gone
sysadmin@localhost:~$

Because each echo statement executes correctly, a return value of success is


provided, allowing the next statement to also be executed.

5.7.4 Step 4
Use logical "and" with a command that fails as shown below:

echo Success && false && echo Bye

Your output should be similar to the following:

sysadmin@localhost:~$ echo Success && false && echo Bye


Success
sysadmin@localhost:~$

The first echo command succeeds and we see its output. The false command


executes with a failure result, so the last echo statement is not executed.

5.7.5 Step 5
The "or" characters separating the following commands demonstrates how the
failure before the "or" statement causes the command after it to execute;
however, a successful first statement causes the command to not execute:

false || echo Fail Or


true || echo Nothing to see here

Your output should be similar to the following:

sysadmin@localhost:~$ false || echo Fail Or


Fail Or
sysadmin@localhost:~$ true || echo Nothing to see here
sysadmin@localhost:~$

7.2.1 Step 1
Type the following command to print the working directory:

pwd
sysadmin@localhost:~$ pwd
/home/sysadmin
sysadmin@localhost:~$

The working directory is the directory that your terminal window is currently


"in". This is also called the current directory. This will be important for when
you are running subsequent commands, as they will behave differently based on
the directory you are currently in.

The output of the pwd command (/home/sysadmin in the example above) is


called the path. The first slash represents the root directory, the top level of the
directory structure.

In the output above, home is a directory under the root directory


and sysadmin is a directory under the home directory.

When you first open a terminal window, you will be placed in your home
directory. This is a directory where you have full access and other users
normally have no access by default. To see the path to your home directory, you
can execute the following command to view the value of the HOME variable:

echo $HOME
sysadmin@localhost:~$ echo $HOME
/home/sysadmin
sysadmin@localhost:~$

7.2.2 Step 2
You can use the cd command with a path to a directory to change your current
directory. Type the following command to make the root directory your current
working directory and verify with the pwd command:

cd /
pwd
sysadmin@localhost:~$ cd /
sysadmin@localhost:/$ pwd
/
sysadmin@localhost:/$
7.2.3 Step 3
To change back to your home directory, the cd command can be executed
without a path. Change back to your home directory and verify by typing the
following commands:

cd
pwd
sysadmin@localhost:/$ cd
sysadmin@localhost:~$ pwd
/home/sysadmin
sysadmin@localhost:~$

Notice the change in the prompt. The tilde ~ character represents your home


directory. This part of the prompt will tell you what directory you are currently in.

7.2.4 Step 4
The cd command may be entered with a path to a directory specified as
an argument. Execute the cd command with the /home directory as an
argument by typing the following:

cd /home
pwd
sysadmin@localhost:~$ cd /home
sysadmin@localhost:/home$ pwd
/home
sysadmin@localhost:/home$

When the path that is provided as an argument to the cd command starts with


the forward slash /, that path is referred to as an “absolute path”. Absolute
paths are always complete paths from the root directory to a subdirectory or file.

7.2.5 Step 5
Change back to your home directory, using the cd command with the tilde ~ as
an argument:

cd ~
pwd
sysadmin@localhost:/home$ cd ~
sysadmin@localhost:~$ pwd
/home/sysadmin
sysadmin@localhost:~$

When the path that is provided as an argument to the cd command starts with a


tilde ~ character, the terminal will expand the character to the home directory
of a user with an account on the system.

If either no other characters or a forward slash follows the tilde, then it will
expand to the home directory of the user currently active in the shell.

If a user name immediately follows the tilde character, then the shell will expand
the tilde and user name to the home directory of that user name. For
example, ~bob would be expanded to /home/bob.

Paths that start with a tilde are considered absolute paths because after the
shell expands the tilde path, an absolute path is formed.

7.2.6 Step 6
Use the echo command below to display some other examples of using the tilde
as part of the path:

echo ~ ~sysadmin ~root ~mail ~nobody


sysadmin@localhost:~$ echo ~ ~sysadmin ~root ~mail ~nobody
/home/sysadmin /home/sysadmin /root /var/mail /nonexistent
sysadmin@localhost:~$

7.2.7 Step 7
Attempt to change to the home directory of the root user by typing the
following command:

cd ~root
sysadmin@localhost:~$ cd ~root
-bash: cd: /root: Permission denied
sysadmin@localhost:~$

Notice the error message; it indicates that the shell attempted to


execute cd with /root as an argument but it failed due to permission being
denied. You will learn more about file and directory permissions in a later lab.
7.2.8 Step 8
Using an absolute path, change to the /usr/bin directory and display the
working directory by using the following commands:

cd /usr/bin
pwd
sysadmin@localhost:~$ cd /usr/bin
sysadmin@localhost:/usr/bin$ pwd
/usr/bin
sysadmin@localhost:/usr/bin$

7.2.9 Step 9
Use an absolute path to change to the /usr directory and display the working
directory by issuing the following commands:

cd /usr
pwd
sysadmin@localhost:/usr/bin$ cd /usr
sysadmin@localhost:/usr$ pwd
/usr
sysadmin@localhost:/usr$

7.2.10 Step 10
Use an absolute path to change to the /usr/share/doc directory and display the
working directory by issuing the following commands:

cd /usr/share/doc
pwd
sysadmin@localhost:/usr$ cd /usr/share/doc
sysadmin@localhost:/usr/share/doc$ pwd
/usr/share/doc
sysadmin@localhost:/usr/share/doc$

Absolute vs. Relative pathnames

Suppose you are in the /usr/share/doc directory and you want to go to


the /usr/share/doc/bash directory. Typing the command cd
/usr/share/doc/bash results in a fair amount of typing. In cases like this, you want
to use relative pathnames.

With relative pathnames you provide "directions" of where you want to go from
the current directory. The following examples will illustrate using relative
pathnames.

7.2.11 Step 11
Using a relative path, change to the /usr/share/doc/bash directory and display
the working directory by issuing the following commands:

cd bash
pwd
sysadmin@localhost:/usr/share/doc$ cd bash
sysadmin@localhost:/usr/share/doc/bash$ pwd
/usr/share/doc/bash
sysadmin@localhost:/usr/share/doc/bash$

Note
If there wasn't a bash directory under the current directory, the previous
command would fail.

7.2.12 Step 12
Use a relative path to change to the directory above the current directory:

cd ..
pwd
sysadmin@localhost:/usr/share/doc/bash$ cd ..
sysadmin@localhost:/usr/share/doc$ pwd
/usr/share/doc
sysadmin@localhost:/usr/share/doc$

The .. represents one level above your current directory location.

7.2.13 Step 13
Use a relative path to change up one level from the current directory and then
down into the dict directory:
cd ../dict
pwd
sysadmin@localhost:/usr/share/doc$ cd ../dict
sysadmin@localhost:/usr/share/dict$ pwd
/usr/share/dict
sysadmin@localhost:/usr/share/dict$

7.3 Listing Files and Directories


In this task, you will explore how to list files and directories.

7.3.1 Step 1
To list the contents of the current directory, use the ls command:

cd
ls

Your output should be similar to the following:

sysadmin@localhost:/usr/share/dict$ cd
sysadmin@localhost:~$ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
sysadmin@localhost:~$

In the output of the previous ls command, the file names were placed in a light
blue color. This is a feature that many distributions of Linux automatically
provide through a feature called an alias (more on this feature in a later lab).

The color indicates what type the item is. The following table describes some of
the more common colors:

Color Type of File

Black or Regular file


White

Blue Directory file


Color Type of File

Cyan Symbolic link file (a file that points to another


file)

Green Executable file (a program)

7.3.2 Step 2
Not all files are displayed by default. There are files, called hidden files, that are
not displayed by default. To display all files, including hidden files, use the -
a option to the ls command:

ls -a
sysadmin@localhost:~$ ls -a
. .bashrc .selected_editor Downloads Public
.. .cache Desktop Music Templates
.bash_logout .profile Documents Pictures Videos
sysadmin@localhost:~$

The names of hidden files begin with a period (a dot character). Typically these
files and often directories are hidden because they are not files you normally
want to see.

For example, the .bashrc file shown in the example above contains


configuration information for the bash shell. This is a file that you normally don't
need to view on a regular basis.

Two important "dot files" exist in every directory: . (which represents the


current directory) and .. (which represents the directory above the current
directory).

7.3.3 Step 3
By itself, the ls command just provided the names of the files and directories
within the specified (or current) directory. Execute the following command to
see how the -l option provides more information about a file:

ls -l /etc/hosts

Your output should be similar to the following:


sysadmin@localhost:~$ ls -l /etc/hosts
-rw-r--r-- 1 root root 150 Jan 22 15:18 /etc/hosts
sysadmin@localhost:~$

So, what does all of this extra output mean? The following table provides a brief
breakdown of what each part of the output of ls -l means:

- The first character, a - in the previous example,


indicates what type of "file" this is. A -character is
for a plain file while a d character would be for a
directory.

rw-r-- This represents the permissions of the file.


r-- Permissions are discussed in a later lab.

1 This represents something called a hard link count


(discussed later).

root The user owner of the file.

root The group owner of the file.

150 The size of the file in bytes

Jan 22 The date/time when the file wa


15:18

7.3.4 Step 4
Sometimes you want to see not only the contents of a directory, but also the
contents of the subdirectories. You can use the -R option to accomplish this:

ls -R /etc/udev
sysadmin@localhost:~$ ls -R /etc/udev
/etc/udev:
rules.d udev.conf
/etc/udev/rules.d:
70-persistent-cd.rules README
sysadmin@localhost:~$

The -R option stands for "recursive". All of the files in the /etc/udev directory


will be displayed as well as all of the files in each subdirectory, in this case
the rules.d subdirectory.

Be careful of the -R option. Some directories are very, very large!

7.3.5 Step 5
You can use file globbing (wildcards) to limit which files or directories you see.
For example, the * character can match "zero or more of any characters" in a
filename. Execute the following command to display only the files that begin
with the letter s in the /etc directory:

ls -d /etc/s*

Your output should be similar to the following:

sysadmin@localhost:~$ ls -d /etc/s*
/etc/securetty /etc/sgml /etc/shells /etc/ssl /etc/sysctl.conf
/etc/security /etc/shadow /etc/skel /etc/sudoers /etc/sysctl.d
/etc/services /etc/shadow- /etc/ssh /etc/sudoers.d /etc/systemd
sysadmin@localhost:~$

Note that the -d option prevents files from subdirectories from being displayed.
It should always be used with the ls command when you are using file globbing.

7.3.6 Step 6
The ? character can be used to match exactly 1 character in a file name.
Execute the following command to display all of the files in the /etc directory
that are exactly four characters long:

ls -d /etc/????

Your output should be similar to the following:

sysadmin@localhost:~$ ls -d /etc/????
/etc/bind /etc/init /etc/motd /etc/perl /etc/skel
/etc/dpkg /etc/ldap /etc/mtab /etc/sgml /etc/udev
sysadmin@localhost:~$

7.3.7 Step 7
By using square brackets [ ] you can specify a single character to match from
a set of characters. Execute the following command to display all of the files in
the /etc directory that begin with the letters a, b, c or d:

ls –d /etc/[abcd]*

Your output should be similar to the following:

sysadmin@localhost:~$ ls -d /etc/[abcd]*
/etc/adduser.conf /etc/blkid.conf /etc/cron.weekly
/etc/adjtime /etc/blkid.tab /etc/crontab
/etc/alternatives /etc/ca-certificates /etc/dbus-1
/etc/apparmor.d /etc/ca-certificates.conf /etc/debconf.conf
/etc/apt /etc/calendar /etc/debian_version
/etc/bash.bashrc /etc/cron.d /etc/default
/etc/bash_completion.d /etc/cron.daily /etc/deluser.conf
/etc/bind /etc/cron.hourly /etc/depmod.d
/etc/bindresvport.blacklist /etc/cron.monthly /etc/dpkg
sysadmin@localhost:~$

8.1 Introduction
This is Lab 8: Managing Files and Directories. By performing this lab, students
will learn how to navigate and manage files and directories.

In this lab, you will perform the following tasks:

 Understand how to use globbing


 Creating, moving and deleting files and directories

8.2 Globbing
The use of glob characters in Linux is similar to what many operating systems
refer to as "wildcard" characters. Using glob characters, you match filenames
using patterns.

Glob characters are a shell feature, not something that is particular to any
specific command. As a result, you can use glob characters with any Linux
command.

When glob characters are used, the shell will "expand" the entire pattern to
match all files in the specified directory that match the pattern.

For demonstration purposes, we will use the echo command to display this


expansion process.

You might also like