Question

In: Computer Science

In Linux Terminal 1. Give a command using find to search from the root directory the...

In Linux Terminal

1. Give a command using find to search from the root directory the file program.f and redirect any errors to the file myerrors.txt

2. Give a command for finding files having the letters index as the beginning of the file name and located in your home directory (provide the absolute path)

3. Give a command for finding within a directory called /mp3collection, only those mp3 files that have a size less than 5000 Kilobytes (< 5MB).

4. Give a commmand that searches for those files that are present in the directory /home/david and its subdirectories which end in .c and which have been accessed in the last 10 minutes.

5. Give a command that searches within the directory /mp3-collection for files that have their names beginning with ’Metallica’ and whose size is greater than 10000 kilobytes (> 10 MB).

6. Give a command that searches in the same directory as above case but only for files that are greater than 10MB, but they should not have ’Metallica’ as the starting of their filenames.

Solutions

Expert Solution

1. Give a command using find to search from the root directory the file program.f and redirect any errors to the file myerrors.txt

ans:

find / -name "program.f" 2> myerrors.txt

/ - for root directory

-name Search for files with specified name( case sensitive)

program.f is the file name to search for.

2> for error redirection

myerrors.txt file in which errors will be redirected

2. Give a command for finding files having the letters index as the beginning of the file name and located in your home directory (provide the absolute path)

ans:

find /home -name "index*"

/home :searches from home directory

-name :Search for files with specified name( case sensitive)

index* :finds files starting with index in file name

3. Give a command for finding within a directory called /mp3collection, only those mp3 files that have a size less than 5000 Kilobytes (< 5MB).

ans:

find /mp3collection -name "*.mp3" -size -5000k

/mp3collection searches from directory mp3collection

-name Search for files with specified name( case sensitive)

*.mp3 Search for all files with .mp3 extension

-size -5000k option to specify files with size less than 5000 kilobytes

4. Give a commmand that searches for those files that are present in the directory /home/david and its subdirectories which end in .c and which have been accessed in the last 10 minutes.

Ans:

find /home/david -amin -10 -name "*.c"

/home/david searches from directory /home/david

-amin -10 used to specify files that have been accessed in the last 10 minutes

*.c Search for all files with .c extension

5. Give a command that searches within the directory /mp3-collection for files that have their names beginning with ’Metallica’ and whose size is greater than 10000 kilobytes (> 10 MB).

Ans:

find /mp3-collection -name "Metallica*" -and -size+10000K

/mp3-collection searches from directory /mp3-collection

Metallica* for names beginning with word Metallica

-and to specify and condition

-size+10000K for resulting the files with size greater than 10000 kilobytes

6. Give a command that searches in the same directory as above case but only for files that are greater than 10MB, but they should not have ’Metallica’ as the starting of their filenames.

Ans:

find /mp3-collection -size+10000K ! -name "Metallica*"

/mp3-collection searches from directory /mp3-collection

-size+10000K for resulting the files with size greater than 10000 kilobytes

! to specify not condition

-name Search for files with specified name( case sensitive)

Metallica* for names beginning with word Metallica


Related Solutions

1. Give a command using find to search from the root directory the file program.f and...
1. Give a command using find to search from the root directory the file program.f and redirect any errors to the file myerrors.txt 2. Give a command for finding files having the letters index as the beginning of the file name and located in your home directory (provide the absolute path) 3. Give a command for finding within a directory called /mp3collection, only those mp3 files that have a size less than 5000 Kilobytes (< 5MB). 4. Give a commmand...
Linux 1. Give a command line (one command) for displaying the files lab1, lab2, lab3, and...
Linux 1. Give a command line (one command) for displaying the files lab1, lab2, lab3, and lab4. Can you give another command lines that do the same thing by making use of the file name similarities? What is the command line for displaying the files lab1.c, lab2.c, lab3.c, and lab4.c? (Hint: use shell metacharacters.) 2. How to determine the number of users who are logged on to Linux server system at this time? What command did you use to discover...
In MongoDB using Linux how do you Execute the command to find the size of a...
In MongoDB using Linux how do you Execute the command to find the size of a single document of your choosing from the enron database Execute the command to find the size of the collection of documents in the enron database
Ubuntu Linux HW2: 1. Give one line of the Linux command to see your (your login...
Ubuntu Linux HW2: 1. Give one line of the Linux command to see your (your login ID) credential data from the passwd file. Use a pipe and grep command. 2. Give one line of the Linux command to calculate the following and save it in the hex to a file calcOut. Use bc and <<<. 3+2*4 Submit Screenshots HW3: Permission Show the result clearly after each of the following commands are executed. 1. Create a subdirectory, “HW3”. Write the Linux...
linux: Become the root user for this exercise. What command did you use to do this...
linux: Become the root user for this exercise. What command did you use to do this again? $ Now that you are root, create a new user on your system called labsevenuser. What is the command you used to create this user? # Set a new password for the new user you just created in step 2 above. What is the command you used to do this? # Create a new group called awesomepeople. Add the user you created in...
linux: Become the root user for this exercise. What command did you use to do this...
linux: Become the root user for this exercise. What command did you use to do this again? $ Now that you are root, create a new user on your system called labsevenuser. What is the command you used to create this user? # Set a new password for the new user you just created in step 2 above. What is the command you used to do this? # Create a new group called awesomepeople. Add the user you created in...
C program for copying data from one directory to another using multi threading for linux using...
C program for copying data from one directory to another using multi threading for linux using command line arrangement. Program will take two arguments: 1: Source 2: Destination it will copy all the files from source to destination recursively Deadline: 4 hours from now.
a) you can see a program for using bisection search to find the square root of...
a) you can see a program for using bisection search to find the square root of x: x = 25 epsilon = 0.01 low = 0.0 high = max(1.0, x) guess = (low + high) / 2 numberofguesses = 1 while abs(guess ** 2 - x) > epsilon : print('low =', low, 'high = ', high, 'guess = ', guess) if guess** 2 > x : # the guess is too high, so move high down to guess high =...
Given the Linux shell command descriptions, please write down the corresponding shell commands in a terminal...
Given the Linux shell command descriptions, please write down the corresponding shell commands in a terminal window.             a) list the current directory contents with the long format             b) print the name of the working directory             c) change directory to the root directory             d) change the permissions of file "myfile" (owned by yourself) so that (1)you can read/write, but cannot execute; (2) all other users cannot read/write/execute this file.             e) make a new directory called “mydir”
unix/Linux Create a tar command using the man command and the link referred to in To...
unix/Linux Create a tar command using the man command and the link referred to in To Practice and Explore: Text File Utilities #9. Preliminaries Use the man pages to learn more about tar Review the links referred to in To Practice and Explore: Text File Utilities #9 to see examples of using tar command Perform Use tar "to stuff" three files and then "unstuff" them into a new directory. Include the -v option. Task ll to show the original 3...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT