UNIX: LISTING FILES Problem 4 (10 points): Answer the following questions about
ID: 3740866 • Letter: U
Question
UNIX:
LISTING FILES Problem 4 (10 points): Answer the following questions about the ls command:
a) What ls command line flags will display the sizes and file classifications?
b) What command line of the ls command will display the files in the /bin directory in a single column along with index number (inode) and file size in blocks?
c) The command ls -t displays the files sorted by _______ time, newest first.
d) The command ls -Rm / causes ls to ________ list all files and subdirectories in the root directory with the list of entries separated by commas.
e) Give a command for listing all of the files inside of the /opt directory (including hidden files), and sorted from least-recently modified to most-recently modified. f) The ls command can colorize the output it displays (yours may or may not be turned on by default, but the man page will instruct you on how to turn it on). Using color to ____________ file types allows the user to quickly locate files by type.
Explanation / Answer
NOTE: I have completed your assignment. Please check and let me know if you find any issues. I will revert back within 24 hours. thanks for your patience.
a) What ls command line flags will display the sizes and file classifications?
Expalnation:
1) To display the file sizes we can use -lh flag which will show file size in KB, MB, etc.
2) To display the file classification we can use -F flag which will mark executable files with * at end of the filename, display a slash (`/') immediately after each pathname that is a directory, an at sign (`@') after each symbolic link, an equals sign (`=') after each socket, a percent sign (`%') after each whiteout, and a vertical bar (`|') after each that is a FIFO.
b) What command line of the ls command will display the files in the /bin directory in a single column along with index number (inode) and file size in blocks?
Explanation:
1) We can use -1 to print the ls listing single column.
2) -i to print index number of each file.
3) -s to print size of file in blocks.
4) Overall ls -1 -is /bin will print files in /bin column wise along with index number and file size in blocks.
c) The command ls -t displays the files sorted by _______ time, newest first.
Explanation:
a) ls -t sort by time modified i.e. most recently modified first before sorting the operands by lexicographical order.
b) Hence the answer is "modified".
d) The command ls -Rm / causes ls to ________ list all files and subdirectories in the root directory with the list of entries separated by commas.
Explanation:
a) ls -Rm causes ls to recursively list files and directories with list of entries separated by commas.
b) Hence the answer is "recursively".
e) Give a command for listing all of the files inside of the /opt directory (including hidden files), and sorted from least-recently modified to most-recently modified.
Explanation:
a) -a in ls command will show hidden files
b) -tr shows file sorted by modifed time with least recently modifed to most recently modified.
c) Overall "ls -tra" command displays listing of files inside of the /opt directly from least recently to most recently modified file.
f) The ls command can colorize the output it displays (yours may or may not be turned on by default, but the man page will instruct you on how to turn it on). Using color to ____________ file types allows the user to quickly locate files by type.
Explanation:
a) -G option is used in ls command to colorize the output
b) Using color on ls listing helps to identify file types like executable and directory quickly
c) So the answer is "executables and directories".
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.