Write a command to display the contents of current directory


Assignment: UNIX/Linux- Command Line Review

1. Write a command to display the contents of your current directory; the listing should show the permissions on each entry and should include any ‘hidden' files in the directory:

2. Write the command to move to the etc directory, which is inside the root directory; use an absolute path in your answer:

3. What command could you issue to create a new system group called ‘jdoegroup' on your system:

4. What command could you use to install the lynx program on your system, assuming you had not yet downloaded any package files needed for the application:

5. Assume a file called ‘newdata' is in the /home directory while you are currently in the /home/myname directory. Using relative paths, write a single command to copy the file newdata to your current directory:

6. Write the command to display the contents of a file called ‘notes' so that you have forward and backward page control and the display shows line numbers on each line:

7. Write a command to display only the 22nd line of the ‘notes' file:

8. Assume there is a file called ‘errorlog' in the /root directory (i.e., a directory called ‘root' inside the actual system root directory) and you wish to display the contents, but do not have permission to read the file. You are, however, a member of the admin group. Write a command to display the file (while logged in as your current user):

9. You wish to set the permissions on a file called prog1 in your current directory to: -rwxr-x-wx. Write the chmod command to do this using ‘octal' syntax:

10. Assuming you have separate files called: file1, program2, and scriptC in your current directory, write a single command to put copies of each of these files in the directory: allfiles which is a subdirectory of the root directory (you have required permissions):

11. Assume you have two files called PartA and PartB in your current directory, and you wish to combine these files ‘vertically' (one after the other without a break) into a file called PartBA such that the contents of file PartB appear first followed by the contents of file PartA. Write the command for this:

12. After logon, what command do you issue to change to the system admin user (root user):

13. A file called ‘actionlog' is in the /boot directory (you are in your home directory) and you wish to display all lines from that file which have the word ‘linux' in them; write the command to do this without changing directories:

14. Write a command that will put you in your home directory, regardless of where you currently are in the file system:

15. You wish to add the contents of file notes (in your current directory) to the file allnotes (also in your current directory. Write a command to perform this using redirection of output:

16. Write a single command to create a new directory tree called ‘mystuff/old' which is to be a subdirectory of your current directory (neither of the new directories exist):

17. Write the command to run ‘top' in the background:

18. After running top in the background, you now type ‘ps' and receive the following result:

PID TTY            TIME CMD
13698 pts/3    00:00:00 bash
13742 pts/3    00:00:00 top
13744 pts/3    00:00:00 ps

Write the command to terminate the top process (make sure it will terminate, regardless of system status):

19. If you run the command vi against the file ‘todolist' and then position your cursor at the last line of the file, what command sequence would delete that last line (assume you are in vi command mode):

20. After deleting the last line of ‘todolist' from inside vi (the step above), what key sequence would you issue to exit vi, while at the same time saving your changes:

21. Assume that you wish to delete the directory called ‘garbage' and all its subdirectories, and that ‘garbage' is a subdirectory of your current directory, but you do not know if garbage has any other files in it. Write the command:

22. If you are in your home directory and you are the owner of a script called UpdateStats (also in your home directory) and you try to run the script but receive a ‘file not found' error message, write an alternate command which should work (assuming the file has read, write, and execute permissions):

23. Assume that you attempt to execute a script called ShowStats but receive the message ‘permission denied.' Write an alternate command that should work without actually changing permissions on the file (assume you have read permission on the file):

24. Write a command to copy the entire contents of directory ‘data' which is a subdirectory of your current directory; you wish to copy it to /home/backup (assume you have all needed permissions):

25. Write a command to extract the third field from each line of the colon delimited file ‘emppay':

26. After logon, write the command to check whether a service called ‘carpald' is running and active on your system:

27. You have a file called ‘bigspeech' in your current directory and wish to change every period in the sentences in the file to an exclamation point (i.e., "." to "!") Write the command to do this and to put the result in a new file called biggerspeech:

28. Write the command to display the available network interfaces on your machine including the current MAC and IP addresses:

29. Write the command to determine if any other users are currently logged in to your machine:

30. Write the command to combine the files Group1 and Group2, such that they appear side-by-side (i.e., first line of Group1 followed by first line of Group2, etc) except that they have a colon delimiter between the side-by-side lines:

31. Using relative paths, type the command to copy the file ‘somethingnew' which is in your current directory into your parent directory, but such that the command will warn you if you are about to overwrite an existing file:

32. Write the (combined) command such that script ‘adddata' will run only if the script ‘datacheck' runs successfully before trying to run adddata:

33. If you are in the directory: /home/me/scripts/source/processes write the command to move to the /etc directory - but using relative paths:

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also includes a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Request for Solution File

Ask an Expert for Answer!!
Operating System: Write a command to display the contents of current directory
Reference No:- TGS03011179

Expected delivery within 24 Hours