Question

In: Computer Science

Explore how to use various combinations of switches for the DIR command to find files/folders in...

Explore how to use various combinations of switches for the DIR command to find files/folders in C:\WINDOWS\SYSTEM32 directory.

Objective: List each search line by line and give then the command used to discover the following and include a small sample of your discovery.
(Example: How would you pause the display? DIR /P and give two files discovered) What switches would you use to find.
Example of structure:
#!/bin/bash
# EOQ-111.sh maw 2/24/20XX
# Archive class work and set all files to read only and make a list with a shell script

echo Starting archiving 111

mkdir ~/archives/EOQ-111
cp ~/CIS111/* ~/archives/EOQ-111
ls ~/archives/EOQ-111 > EOQ-111.txt
chmod 400 ~/archives/EOQ-111/*

echo End of program

(No screenshots please)

A) What's the oldest file?

B) What's the youngest file?

C) What's the largest file?

D) What's the smallest file?

E) How many .exe files there are?

F) How would you show only directories in lower case?

G) How would you show only files names by extension?

H) How would you show any hidden files?

Solutions

Expert Solution

A) What's the oldest file?

dir /o:d | head -n 1

/o Sorts the output according to sortorder, which can be any combination of the following values:n,e,g,s,d

/d By date/time, oldest first

B)What's the youngest file?

dir /o:d | tail -n 1

/o Sorts the output according to sortorder, which can be any combination of the following values:n,e,g,s,d

/d By date/time, oldest first

C)What's the largest file?

dir /o:s | tail -n 1

/o Sorts the output according to sortorder, which can be any combination of the following values:n,e,g,s,d

By size, smallest first

D) What's the smallest file?

dir /o:s | head -n 1

/o Sorts the output according to sortorder, which can be any combination of the following values:n,e,g,s,d

By size, smallest first

E)How many .exe files there are?

dir /s /b *.exe | findstr /e .exe

/s Lists the files in the folder and also the ones in the subfolders recursively.

/b Lists the subfolders/files names in bare format.

findstr /e : Matches the pattern .exe if at the end of a line

F)How would you show only directories in lower case?

dir /ad /L

d:Displays all directories in the current path

l:display lowercase

G) How would you show only files names by extension?

dir *.* /b /s

*.*=It will display all the files in the current directory with any extension.

/s=Lists every occurrence of the specified file name within the specified directory and all subdirectories.

/b=Displays a bare list of directories and files, with no additional information. The /b parameter overrides /w.

H) How would you show any hidden files?

dir /a:h /b /s

/a:h=displays hidden files

/s=Lists every occurrence of the specified file name within the specified directory and all subdirectories.

/b=Displays a bare list of directories and files, with no additional information. The /b parameter overrides /w.


Related Solutions

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...
1. In terms of security, why would you not use rm command to delete files? 2....
1. In terms of security, why would you not use rm command to delete files? 2. Shred and dd are tools used to securely delete files. Which is the best tool for securely deleting a file from a system and why? Consider the limitations of each tool when choosing your answer. 3. What encryption is used to encrypt HTTP traffic (HTTPS)? 4. The CIA triad , confidentiality, integrity, and availability represent the three goals for cybersecurity. Which goal(s) does/do encryption...
PART 5: Learn about commands used to view contents of files: use the cat command to...
PART 5: Learn about commands used to view contents of files: use the cat command to review the contents of the /home/test/passwd.bak type:   cat passwd.bak 2. now add the |more to the last command (see what happens when you push the up arrow curser key-it recalls the last command) 3. now try to cat the passwd.bak file but look at the first few lines and then the last few lines using the head and tail commands type:  head passwd.bak   and    tail...
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...
Name and describe the four sales compensation elements. What are the various compensation combinations, and how...
Name and describe the four sales compensation elements. What are the various compensation combinations, and how can they be used to achieve the company’s marketing objectives? 
Linux What is the tar command? a. Can you compress files using tar? Please explain how...
Linux What is the tar command? a. Can you compress files using tar? Please explain how and provide a brief example. b. How do you create a tar file? Please provide an example. c. How do you extract files in a tar format? Please provide an example.
1- Perform research on the Web and find how Cisco routers and switches can protect against...
1- Perform research on the Web and find how Cisco routers and switches can protect against DDOS. Give a specific example of a Cisco device model. Show the Cisco CLI commands that are used for this purpose 2- The Session Initiation Protocol (SIP) is an important protocol used in Voice over IP phones over the net. Give ONE detailed example of a security attack type of SIP. Explain how we can prevent or mitigate this specific type of attack. Can...
**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" <[email protected]> email = To: Mr Arlington Hewes <[email protected]> email = > From: Mr Arlington Hewes...
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
This lab will explore the password files. a) Open a terminal window and type less /etc/passwd....
This lab will explore the password files. a) Open a terminal window and type less /etc/passwd. Which line describes the root account? b) Type ls –l /etc/passwd. Who is the owner of the passwd file? What are the permissions? c) Type less /etc/shadow. What is in the password filed for most of these accounts? d) Type ls –l /etc/shadow. Who owns this file and how do the permissions differ from the /etc/passwd file? e) Type cat /etc/default/useradd. What is the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT