Final (Unix) Flashcards
Using the cd command, write a command to go up one level from the current directory, then into a directory there called DestinationDirectory
cd ../DestinationDirectory
What does the -i option of the mv command do?
Prompt before overwriting
What does the -u option of the mv command do?
Move only if the source file is newer than the destination file
Explain what the -r, -i, and -f options do in the rm command
-r: Recursively removes directories and their contents
-i: Prompt before removing each file or directory
-f: Forcefully remove files without prompting
The chmod command has which three user groups for the syntax: <usergroup>+x, -x, +r, -r, +w, -w, etc.?</usergroup>
User (u), Group (g), Others (o)
In chmod octal notation, what is the value of Read(r)?
4
In chmod octal notation, what is the value of Write(w)?
2
In chmod octal notation, what is the value of Execute(x)?
1
If you want to give a particular group permissions in chmod octal notation, how do you determine the correct number to use?
Add the numbers of the octal representation of those permissions up.
For example, read is 4, write is 2, and execute is 1, so if you wanted to give a group read and write permission, that group would get a 6.
The order is ugo in the notation, so to give r, w, x to user, rw to group, and r to others, it would be: 764
What do the / and ? keys do when reading a file with the less command?
Search forward (/) or backward (?)
(You can also use spacebar to scroll down and b to scroll up)
What do the :n and :p commands do when looking at files with the less command?
:n - Next file
:p - Previous file
-w option in the cal command
Displays the week number (in terms of the entire year) at the beginning of each week in the calendar display. So..
cal -w 8 4 1983
Displays the calendar for april 1983 showing that the first week is the 14th week of the year (and so on).
-j option in the cal command
Shows the number of days since january 1st of the calendar year being displayed (instead of the day of the month).
For example, cal -j 2 4 1975 would display a calendar of April 1975 in which the first day of the month is 91, and the last day is 120.
-n option in the cal command
The number of months to display (starting with the current month).
If it’s May 2024, cal -n 5 would display a calendar for May, June, July, August, and September of 2024
What’s the difference between a Shell and a Machine?
A shell is a program that provides the command-line interface to interact with the Unix operating system
A machine is physical hardware – a machine can be used to execute commands through the shell