Untitled document

docx

School

University of North Georgia, Dahlonega *

*We aren’t endorsed by this school

Course

3800

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

2

Uploaded by MegaDanger12769

Report
CSCI 3800 D1 – Introduction to UNIX 1. Give a command using find to search from the root directory the file demo.py and redirect any errors to the text file errors.txt. ┌──(kali kali)-[~] └─$ sudo find / -name "demo.py" 2> errors.txt 2. Give a command for finding files having the letters index as the beginning of the filename and located in your home directory (provide the absolute path). ┌──(kali kali)-[~] └─$ find /home/kali -type f -name "index*" 3. Give a command that searches for those files that end in .py that are present in the directory /home/user/Program_Files and its subdirectories and have been accessed in the last 45 Minutes. ┌──(kali kali)-[~] └─$ find user/program_files -type f -name "*.py" -amin -45 4. Give a command that searches within the directory /pictures for files that have their names beginning with ’Louvre’ and whose size is less than 1000 kilobytes (< 1 MB). ┌──(kali kali)-[~] └─$ find Pictures -type f -name "Louvre*" -size -1000k 5. Give a command that searches in the directory /Movies for files that are less than 2000 MB but they should not have ’Fast’ at the starting of their filenames. ┌──(kali kali)-[~] └─$ find Movies -type f -size -2000M -not -name "Fast*" 6. Give a command that searches in the directory /Music for files that are greater than 5 MB (> 5 MB). ┌──(kali kali)-[~] └─$ find Music -type f -size +5M 7. Explain what the following commands do. What is the difference between their outputs? a) chmod -R 766 . - This means the owner has full permissions, the group has read and write permissions, and others have read permissions. b) chmod -R 766 - * the ‘*’ means that it expands to all the files and directories in the current directory. It won't affect hidden files thats start with a ‘*’ c) chmod -R 766 /
- This command changes the permission for all files and directories on the entire file system If this command is executed with root privileges it can potentially change permissions of critical systems. 8. Explain the output of the following command: pr -n -d -o 5 game - The output of this command would be the content of the file “game” The output of the command would be the content of the file "game" The lines in the output will be numbered ‘-d’ This option adds an extra line between each line of the input file, effectively double-spacing the output. ‘-o’ sets the page offset to 5. The page offset determines the number of lines that are left blank at the beginning of each page If "game" is not a valid file or does not exist in the current directory, the command will likely produce an error 9. Study the cut and paste commands and describe what are their functions, provide at least two examples of the cut and paste commands with options (i.e., 2 examples for each command). The ‘cut’ and ‘paste’ commands are usually used to manipulate text data The cut command is used to extract sections from each line of input. It can be used to cut parts of a line by byte position, character, and field. The ‘paste’ command is used to merge lines of files. It concatenates the corresponding lines of the given input files. Example 1: CUT - cut -d',' -f1,3 file1.txt Example 2: - cut -c3-7 file2.txt Example 1: PASTE - paste file1.txt file2.txt Example 2: - paste -d';' file1.txt file2.txt 10. What is the output of the following command? sort -t: -k4,4 -n /etc/passwd - The command ‘sort -t: -k4,4 -n /etc/passwd’ sorts the lines in the /etc/passwd file based on the numerical value of the fourth user ID assuming that the fields are separated by colons (:). Note: answers to the questions should be submitted (or uploaded to D2L) in a Word or PDF file.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help