Chapter 3: Basic Unix Commands Flashcards

1
Q

What is the Computer Command Prompt?

A

eos%

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

These pages contain documentation on the UNIX commands, including how they are executed, associated options, and what the command does

A

man

Example

man input:

eos% man commandname

If you receive “No manual entry found for commandname,” it means that the command you typed is not recognized on the NCSU system.

To advance in the document, use the UP and DOWN arrow keys, use “Q” to exit the manual

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

used to determine your location in the file system

A

PWD (Print Working Directory)

Example:
eos% pwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

used to navigate through the file tree. It changes your location to a location specified by the pathname that you input

A

cd (Change Directory)

Example

To move from the EosLabs directory to your home directory (~/).
eos% cd~/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

To see the contents of a directory or confirm that a file you requested has moved to the location you wanted

A

ls (list directory)

eos% ls

OR

eos% ls pathname

dash options (can be used in any order):

  • l list the contents in long format (all information, size, date, owner, etc.)
  • a list ALL files, even “.” (dot) files and hidden files
  • al lists ALL files in long format
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To create a directory for storing and organizing other files

A

mkdir (Make Directory)
eos% mkdir directory_path
Example

To create a directory called MyE115 in your home directory:

If you are in your home directory: eos% mkdir MyE115

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In the AFS system, you only have editing (write) access to files located in your account space. Therefore, you must ___ any files that you wish to work with into your home directory (or a sub-directory of your home directory) before attempting to edit it.

A

cp (copy)
eos% cp source_path destination_path
Example

To copy INLAB2 to your home directory, while you are in the lab-2 directory:

eos% cp INLAB2 ~/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

the desired file in a specified location. However, the mv command essentially copies the file and simultaneously deletes the original. The mv command is also used to rename files.

A

mv (move)

eos% mv source_path destination_path
Example

How would you rename the file oldstuff.txt to junk.txt while in your home directory?

eos% mv oldstuff.txt junk.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To remove unwanted files and directories from your AFS space, which is limited, you can use the remove (rm) command. Removed files are permanently deleted. The rm command will ask if you are sure that you want to remove the file. Type “y” if you want to remove it, and “n” if you do not.

A

rm (remove)
eos% rm filename

Dash options:
-r recursively (go into every subdirectory)
-f forced (stops computer from asking your permission for every single file or directory that is removed)
-rf does not ask permission for all files and directories and works recursively. Required for removing directories.
Example:

How would you remove INLAB2.txt from your MyE115 directory, if you are in your home directory?

eos% rm MyE115/INLAB2.txt

rm: remove MyE115/INLAB2.txt (yes/no)? y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

creates a log file of every command executed, and its output, during that terminal session

A

script (create a log file)
eos% script -f logfilename

Script has two associated options. The –f is required for this course. It forces the script to start recording immediately. The other option is –a (append) which allows the user to continue recording on a previously created log file.

To close the log file, type “exit” into the terminal window. For this course, DO NOT exit a log file until instructed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly