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
How do pipes (|) work, generally?
The command or operation on the left of the pipe becomes input for the command on the right of the pipe. Multiple such combinations can be chained together and occur in order from left to right.
What is an absolute path?
Complete location of a file or directory from the root directory of the file system.
Always begins with a forward slash /
What is a relative path?
The location of a file or directory relative to the current working directory. Doesn’t start from the root directory, and does not begin with a forward slash /
If we’re in /home/user and user contains the directory /documents with the file file.txt, the relative path of file.txt from the current directory is: documents/file.txt
What is a foreground process?
A running process which the user is currently directly interacting with. When a process runs and need some type of interaction from the user, it’s in the foreground.
What is a background process?
A process that runs independently of the terminal or shell from which it was started. Typically does not need the user’s interaction or input after initialization.