Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

guide to unix using linux / 4th edition / chapter 2 / p9 B.2.9 Wildcards are han

ID: 3809070 • Letter: G

Question

guide to unix using linux / 4th edition / chapter 2 / p9

B.2.9 Wildcards are handy to know when you want to find or work on files that have a specific sequence of characters or when you are searching to find a file and are not certain of the correct spelling of that file name.

To practice using wildcards, you first must create a set of files with similar names. From your home directory, create a directory called files (show command used here) _____________________________.

Now use the cat command and redirection (>) to create the following files with the designated name and content (show the complete cat command used to do this ... remember, use a Ctrl+d on a line by itself to end the redirection):

first_name (a file containing your first name)
___________________________
___________________________
___________________________

middle_name (a file containing your middle name)
___________________________
___________________________
___________________________

last_name (a file containing your last name)
___________________________
___________________________
___________________________

full_name1.txt (a file containing your full name)
___________________________
___________________________
___________________________

full_name2.txt (another file containing your full name)
___________________________
___________________________
___________________________

Type ls *name and press Enter. Write down the files you see and explain why: ________________________________________________________________

Type ls full_name?.txt and press Enter. Write down your observation and explain why: _____________________________________________________

Type ls *.txt and press Enter. Write down your observation and explain why: ________________________________________________________________

Explanation / Answer

Type th efollowing command to go home directory,

cd /home

Now create a directory in home directory by using,

mkdir files

To move to the created directory file.

cd file

To redirect the output of cat line by line in text file,

cat > first_name.txt

cat > middle_name.txt

cat > last_name.txt

cat > full_name1.txt

cat > full_name2.txt

After giving the input press control+d to exit from input prompt for each file.

Type ls *name and press Enter. Write down the files you see and explain why:

Observation:

cannot access *name: No such file or directory, there is no directory by the name in the directory.

Type ls full_name?.txt and press Enter. Write down your observation and explain why:

Obervation:

full_name1

full_name2

The possible file matching with the name along with a specied special character.

Type ls *.txt and press Enter. Write down your observation and explain why:

Observation:

first_name

middle_name

last_name

full_name1

full_name2

list all the text file in the directory files.