Question

a) How would you use the ls command to display all of the files/directories in the...

a) How would you use the ls command to display all of the files/directories in the directory ‘/sbin’ that start with ‘bl’?

b) How would you use the ls command to display all of the files/directories in your current directory that contain the word ‘grade’ somewhere in the name and end with ‘.pdf’?

c) How would you use the ls command to display all of the files/directories in your current directory that are any two characters followed by the file extension ‘.py’?

d) What is the purpose of a wildcard?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) ls -d /sbin/bl*

-- will display the files and directores that starts with letters 'bl'

b) ls *grade*.pdf

-- will gives the filename containing the word 'grade' somewhere in the
filename and ends with '.pdf'


c) ls -d ??.py

-- gives the any two characters in the filename and ends with extension '.py'


d) purpose of wildcard

1) wildcards are used in linux terminal in searching files and folders
2) wildcards are also used in SQL queries to find the string from the tables
3) wildcard patterns are used in regular expressions

screenshot of output

$ 1s -d /sbin/m sbin/mkfs.bfs. exe sbin/mkfs.exe /sbin/mkfs. cramfs.exe /sbin/mkfs.minix. exe /sbin/mkswap. exe s 1s grade#.

Add a comment
Know the answer?
Add Answer to:
a) How would you use the ls command to display all of the files/directories in the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1.Write a find command that will display the inode number of all files in the working...

    1.Write a find command that will display the inode number of all files in the working directory (only) that contain the string "#include". 2.Write an ls command with a glob specification that will list the names of all files in the working directory that are exactly 10 characters long, begin with w, x, y, or z, and do not contain a "." character (i.e. no file extension). 3.Write an ls command with a glob specification that will list the names...

  • Displays the names of the non-hidden files and directories in the current directory, or another directory,...

    Displays the names of the non-hidden files and directories in the current directory, or another directory, along with creation time, and size of file. In case of subdirectories, it displays the word <DIR> instead of file size. At the end, the command should display the total number of files in the directory, the total file size, and the number of sub-directories. Examples: LodgherDir (displays info of all files and directories in current directory) LodgherDir c:\LFromDir (displays info of all files...

  • do numbers 4-8 4. Given any directory, use the Is command to display: • all files...

    do numbers 4-8 4. Given any directory, use the Is command to display: • all files and sub-directories starting with the letter "D" (note do not list anything in any sub-directory) • its immediate sub-directories (sub-directories only, and no other ordinary files) its immediate hidden sub-directories only - take a screenshot (#3-3) that clearly shows the command and the result. 5. Assume that the following files are in the working directory: $ ls intro notesb ref2 section 1 section3 section4b...

  • Write a command line that uses only ls and grep to list all files in your...

    Write a command line that uses only ls and grep to list all files in your current directory whose names consist of three letters (lowercase or uppercase) followed by an arbitrary number of digits (zero digits is possible)

  • A filename con comprise multiple embedded dots (e.g., a.b.c.d.e). True False A device file is not...

    A filename con comprise multiple embedded dots (e.g., a.b.c.d.e). True False A device file is not really a stream of characters and doesn't contain anything at all. True False Relative pathnames begin with the root directory. True False Running the ls -a command uniquely identifies directories and binary executables. True False What is the result of running mkdir -p share/man/cat1 from the command line? a. It creates the directory share. b. It creates the directory share/man. c. It creates the...

  • 5.Create two files also called file file1 and file2 in testdir_2 Use the ls -lR to show you created the directories 6. Change the permission of the files in the directories below and show their permi...

    5.Create two files also called file file1 and file2 in testdir_2 Use the ls -lR to show you created the directories 6. Change the permission of the files in the directories below and show their permissions testdir/testdir_1/file1 where owner has read and execute permissions testdir/testdir_1/file2 where where owner has read, write and execute permissions. Group has read only permissions 7. Create a directory called newdir/newdir_1/newdir_2 copy the file testdir/testdir_1/file1 to this directory Change the permisions of the file to owner,...

  • QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A....

    QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A. List all files and directories recursively starting from / B. List a file names * in / C. List all files in / directory D. List all files and directories in / directory QUESTION 2 Which command is used to extract a column/field from a text file / input. A. paste B. get C. cut D. tar QUESTION 3 Which command creates an empty...

  • Unix/Linux The purpose of this lab is to practice the commands to manage and organize files...

    Unix/Linux The purpose of this lab is to practice the commands to manage and organize files and directories: How would one go about this? Thanks. Task 1: Preliminaries: 1) If you have not already done so, create a directory called bin under your HOME directory. 2) If you have not already made a copy (using ftp) of the file called famous.dat from the Assignment#1, do that now. 3) Make bin the active/working directory. Task 2: Perform all of the following...

  • COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files...

    COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files created by you have rw-rw---- as default permissions? How would you sort in the background a file called "bad.txt", and place the results in a file called "sort.txt"? Archive the contents of your home directory (including any subdirectories) using tar. Compress the tar archive with gzip. Now extract their contents. Use the “find” command to locate in /docs and /usr/docs all files that Begin...

  • Linux Question: I just need the command for the below: How many files are below “/etc/”?...

    Linux Question: I just need the command for the below: How many files are below “/etc/”? In other words, I want the number of files that are in this directory andany directories below it. You will need to use the “find” command to get this number and it is between 500 and 2500.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT