1. Navigate to your home directory by typing cd. Now type ls and
notice that there is a subdirectory called Downloads. Now navigate
to the root of the file system by typing cd /. From here, which
single command would you use to navigate directly to the Downloads
folder that is located in your home directory? The output of the
command would be as follows:
2. From the Downloads directory which single command would you use
to navigate back up one directory and then back down into the Music
directory?
Which command can you use to ensure you are located in the
home/sysadmin/Music directory?
3. Navigate back to your home directory. Which single command would
you use to get a listing of all the files in that directory,
including the hidden files, that also lists additional information
about the files such as the time they were last modified and the
files permissions? Partial output of the command would appear as
follows:
4. Navigate to your Documents directory and type touch myfile. Now
navigate back to your home directory. From here what command would
you use to get a listing of all the files in the Documents
directory? The output of this command would appear as
follows:
5. Navigate to the /home directory. From here what command would
you use to get a listing of the contents of this directory, as well
as all the contents of all the subdirectories? The output of this
command would appear as follows:
6. Navigate to your home directory. From here what single command
would you use to display all the files that begin with “Pi” or
“Vi”? The output of this command would appear as follows:
7. What command would you use to make a copy of the passwd file
in the /etc directory and save it in your home directory as a file
called mypasswd? When you do a file listing after the command you
should see something similar to the following:
8. What command would you use to copy all the files in the /etc
directory that start with the letter “s” and end with the letter
“s” to your home directory? When you do a file listing after the
command you should see something similar to the following:
9. What command would you use to delete all the files in your home
directory that consist of exactly eight (8) characters? When you do
a file listing after the command you should see something similar
to the following:
10. What command(s) would you use to copy all the files in the /etc
directory, including all the files in subdirectories underneath
/etc, to a new directory in your home directory called MyEtc while
also telling you what is being done as it happens? When you do a
file listing after the command you should see something similar to
the following:
11. In your home directory, create a file called thefile by
entering the command touch thefile. What command would you use to
rename thefile to afile? When you do a file listing after the
command you should see something similar to the following:
12. What single command would you use to make a duplicate copy of
afile called yourfile? When you do a file listing after the command
you should see something similar to the following:
13. What single command would you use to delete both afile and
yourfile at the same time? When you do a file listing after the
command you should see something similar to the following:
ANSWER:
1. Navigate to your home directory by typing cd. Now type ls and notice that there is a subdirectory called Downloads. Now navigate to the root of the file system by typing cd /. From here which command would you use to navigate directly into the Downloads folder that is located in your home directory?
cd home/
ls
cd Downloads/
2. From the Downloads directory which single command would you use to navigate back up one directory and then back down into the Music directory?
cd ..
cd Music/
Which command can you use to ensure you are located in the Music directory?
pwd
3. Navigate back to your home directory. Which single command would you use to get a listing of all the files in that directory, including the hidden files, that also lists additional information about the files such as the time they were last modified and the files permissions?
cd
ls –la | more
4. You should still be in your home directory. From here what command would you use to get a listing of all the files in the Documents directory?
ls –la /home/Documents
5. Navigate into the /home directory. From here what command would you use to get a listing of the contents of this directory, as well as all the contents of all the subdirectories?
cd
ls -R /home/
6. Navigate to your home directory. From here what command would you use to display only the files that begin with “Mi” or “Pi”?
cd
ls Mi*
ls Pi*
7. What command would you use to make a copy of the passwd file in the /etc directory and save it in your home directory as a file called PasswordFile?
cp /etc/passwd home/PasswordFile
8. What command would you use to copy only the files in the /etc directory that start with the letter “l” and end with the letter “e” into your home directory?
cp /etc/I*e /home/
9. What command would you use to delete only the files in your home directory that consist of exactly 9 characters?
rm /home/?????????
10. What command would you use to copy all the files in the /etc directory to a new directory in your home directory call MyEtc while also telling you what is being done as it happens?
cp /etc/* /home/MyEtc/
11. Create a file called “myfile” by entering the command touch myfile. What command would you use to rename this file to “yourfile”?
touch myfile
mv myfile yourfile
12. What command would you use to make another copy of “yourfile” called “ourfile”?
cp yourfile ourfile
13. What command would you use to delete both “yourfile” and “ourfile” at the same time?
rm –rf yourfile ourfile
1. Navigate to your home directory by typing cd. Now type ls and notice that there...
Open Command Prompt typing CMD command in your Search window. Change the directory from current to root (C:). Make a new directory called CIS165_Your Last Name (example: CIS165_Nossa). Within this directory, make subdirectories called Can1 and Can2. Verify the created directory and subdirectories using particular command. Under Can1 subdirectory creates three files called Jam.txt, Milk.txt and Juice.txt. Verify that you created these files using particular command. Move Jam.txt file from the Can1 subdirectory to the Can2 folder. Compare using special...
1) Copy bother10.sh from /home/ghoffman/course_files/it244_files to your hw6 directory. Run this program in the background redirecting output to /dev/null. Be sure you copy and run bother10.sh, NOT bother.sh. 2) Run a command that shows the job number of the process running bother10.sh. 3) Run a command that shows the process ID of the process running bother10.sh. 4) Copy the script make_foo.sh from ~ghoffman/course_files/it244_files to your current directory. Run this script. Using touch, create the file foo.txt. Perform a long listing...
Write a C program countFiles.c to be executed on the command line as follows: countFiles <directory> The program should count the (regular) files in the specified directory as well as all subdirectories and output the total number on the console. Files and subdirectories whose names .start with should be ignored! To do this, define a function int countFilesRec(char* dirName)that dirName returns the number of (regular) files in the directory and all the subdirectories. Call the function recursively to count the...
QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory. Select the correct find command string below that will accomplish this. find /etc -name 'resolv.conf-cat f} \; find /etc -name 'resolv.conf' -exec cat {} \; find . -name 'resolv.conf' -exec cat {} \; O find / -name 'resolv.conf' -exec...
QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory Select the correct find command string below that will accomplish this. find /etc-name 'resolv.conf -cat D find /etc-name 'resolv.conf -exec cat 0 find. -name 'resolv.conf -exec cat 0\ find /-name 'resolv.conf' -exec cat 0 QUESTION 2 What find command...
Using Ubuntu OS... help is greatly needed! Thank you. Create an alias called "home" that does two things... returns you to your home directory, then does a long listing of all files found there Create a file called "Output.txt" that contains the output of the "ls /etc" command Using "cat", create a file called "poem.txt" where you enter at least one line of text ("Mary had a little lamb" will do...) Using "cat", pipe the contents of poem.txt into the...
Select your answer from here. absolute pathname to the file called xyz changes the directory to the parent of the current directory. lists current directory files including the invisible files sends xyz file to the line printer deletes the directory called xyz displays the content of the file called xyz displays the current directory pathname cancels the printing job on the 1p 1 printer confirms the deletion of the xyz file before deleting it lists the current directory in long...
I need help with this. 22. Show a command that will create a file named "etc.tar" in your home directory from recursively going through all of the files in the "/etc" directory. In other words, the "etc.tar" file will include the files in the "/etc" directory as well as all of its subdirectories. IMPORTANT: This command must work for any user as well as work from any directory. 23. In bash, multiple commands can appear on a single command line...
Write a Java program that lists all the files in a directory and their subdirectories, that mimics the Unix ls command or the Windows dir command. Note that when a directory is encountered we do not immediately print its contents recursively. Rather, as we scan each directory, place any subdirectory in a List. After the directory entries are printed then process each subdirectory recursively. For each file that is listed, include the modification time, the file size, and if it...
Question 1) Copy file called sortfile from my home directory. The file contains three columns of information : username, uid number and group name respectively, separated by a field separator. Will the following command sort the file on the group name field? sort -t! -k3 sortfile A) Yes B) No Question 2) Copy the file called sortfile from my home directory. The file contains three columns of information : username, uid number and group name respectively, separated by a field...