Question

In: Computer Science

Linux Fundamentals part 4 final Below are questions related to the command line use of Linux....

Linux Fundamentals part 4 final

Below are questions related to the command line use of Linux.  You can use the videos, man pages, and notes to answer these questions. 

Remember that Linux is CASE SENSITIVE.  Rm and rm are NOT the same command.  I will count off totally for a question if you do not take this into account.

For each command give me the ENTIRE COMMAND SEQUENCE.  If I ask you  'What command would I use to move the file one.txt to the parent directory and rename it to two.txt?", the answer is NOT 'mv'. That is only part of the command. I want the entire command sequence.

16. Find all files under ~ whose content contain the keyword taco OR Taco OR taCo OR tacO. NOT all variations in case for 'taco', but just the variations listed meaning a keyword of tAco, tACO, tACo, etc, will not produce a result.


17. Find all files under the current directory which ends in '.txt' (just the .txt not the single quotes) and use -exec to create a listing of each files inode number. Since we're using -exec, this means we will call another command to produce the inode based on the results found. What command do we use to make listings? Now you just need to find how to make it produce an inode result. To the man page!


18. What command would I run to update the database of file names used by the locate command?


19. Find all files under the /var directory with a size less than 1 kilobyte. Use -exec and an appropriate command to copy those files to ~/Documents/FallFun/sep.


20. Find all files under the ~ directory that are named 'Picard' ignoring case.

Solutions

Expert Solution

Ans 16 :- This command will find all the files with the given keywords. (r is for recursive search, l is for showing only file name, w is used to search for an exact word.

grep -rlw 'taco\|Taco\|taCo\|tacO'

Ans 17: find command wil find all the txt files in the current directory (.) and will display the inode number for each file via exec command.

find . -name '*.txt' -exec ls -i \;

Ans 18: This command will update the database used to store files used by locate command. updatedb is usually run daily by cron to update the database.

sudo updatedb

Ans 19: This command will find all the files in /var directory less than 1kb size and will copy these files to ~/Documents/FallFun/sep directory via -exec command.

find /var -type f -size 1k -exec cp {} ~/Documents/FallFun/sep/ \;

Ans 20: This command will find recursively all the files with the name Picard. -iname is for ignoring the case while querying the name.

find ~ -iname 'Picard*'

Hope it helps. Thanks!


Related Solutions

Linux Fundamentals part 3 Below are questions related to the command line use of Linux. You...
Linux Fundamentals part 3 Below are questions related to the command line use of Linux. You can use the videos, man pages, and notes to answer these questions. Remember that Linux is CASE SENSITIVE. Rm and rm are NOT the same command. I will count off totally for a question if you do not take this into account. For each command give me the ENTIRE COMMAND SEQUENCE. If I ask you 'What command would I use to move the file...
LINUX In Linux command line write a shell script ex1.sh that uses IF THEN to Prompt...
LINUX In Linux command line write a shell script ex1.sh that uses IF THEN to Prompt the user to "Enter a number between 1 and 10". (Hint: Use the 'echo' and 'read' commands in the script. See the slide about the 'read' command) If the number is less than 5, print "The number is less than 5" (Hint: You will read input into a variable; e.g. read NUM. In the IF statement, enclose $NUM in quotes; e.g. "$NUM". Also, remember...
Introduction Write in C++ at the Linux command line a program that is the same as...
Introduction Write in C++ at the Linux command line a program that is the same as the previous collection app project but now uses a class to store the items and also can save the items to a file that can be read back into the array by the user when the program is re-started. You can use your project 1 submission as a starting point or you can do something new as long as it meets the listed requirements....
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...
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 use the command dmesg, use grep to filter and then redirect just the lines with...
linux use the command dmesg, use grep to filter and then redirect just the lines with the word Linux in them from the output generated by the dmesg command. redirect this output to a file at the path PutFileHere/Dmesgoutput.txt. What command did you use to do this, if there is no output choose a different word to grep for in the output of this command and substitute that word.
Using Linux in VirtualBox To display your system date: Type date in the command line, and...
Using Linux in VirtualBox To display your system date: Type date in the command line, and press Enter. What do you see?                                            You might see the abbreviation EDT (Eastern Daylight Time) instead of EST (Eastern Standard Time), or another time zone abbreviation, such as MDT (Mountain Daylight Time) or CST (Central Standard Time). Notice also that UNIX/Linux uses a 24-hour clock. Type Date in the command line, and press Enter. What error do you see?                                    The system error...
please use linux or unix to complete Diff command The diff command displays differences between two...
please use linux or unix to complete Diff command The diff command displays differences between two files on a line-by-line basis. It displays the differences as instructions that you can use to edit one of the files ( using the vi editor) to make it the same as the other. When you use diff, it produces a series of lines containing Append (a), Delete (d), and Change (c) instructions. Each of these lines is followed by the lines from the...
**Need to use awk command in putty (should be a ONE LINE COMMAND) Write the command...
**Need to use awk command in putty (should be a ONE LINE COMMAND) Write the command that would find all lines that have an email address and place a label email = before the line in the file longfile output will multiple lines similar to this one : using a good awk command the output would be something like this email = From: "Linder, Jann/WDC" <jlinder@CH2M.com> email = To: Mr Arlington Hewes <tpcadmin@info.tpc.int> email = > From: Mr Arlington Hewes...
Windows XP Command Line questions. a) What is the command to display all of the files...
Windows XP Command Line questions. a) What is the command to display all of the files on the disk in drive A:--do not use the DIR command or the CHKDSK command C:\> b) Display the contents of the PERSONAL.FIL file located in the root directory of drive A: one screenful at a time C) Display the contents of the PERSONAL.FIL file located in the root directory of drive A:, one screenful at a time, beginning with the 25th record, on...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT