Terminal Flashcards

1
Q

cd

A

Change Directory, This command will change the directory that you’re currently working with in the Terminal in order to execute other commands on a different directory, view the contents of a different directory or open a file in a different directory. This is a very common command that will be used when working with the CLI. If you ever lose your place and which directory you’re in, type pwd (print working directory) and press Return to echo the current path.

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

ls

A

Listing Directory, Use this command after navigating into a directory using the cd command to view the contents (files and directories) inside of the current directory. Use the argument -l (ls -l) to get even more information about each of the files, including the permissions, owner and date created.

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

open “filename”

A

Open files, When browsing a directory, you may encounter a file that you wish to open on your Mac. That’s where the open command comes in. Typing this command followed by a space and the filename will open the file with the app that can open that file type on the Mac. When typing the filename, you don’t need to type the full name, partially type what you can, then press tab to autocomplete the remaining text.

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

cp “filename” “newfilename”

A

Copy a file to another directory , This command facilitates copying a file from one location to another, or just simply making a copy of the same file with a new name. When specifying the first argument, include the originating file that you wish to copy followed by a space and a full path, filename and extension of where you want the copy to be placed when the command is executed. The Terminal will return when the copy has been completed.

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

mv “filename” “path/to/new/file/location”

A

Move a file , When you don’t want to copy a file, but instead move it, use the same format of the cp command, but instead replace ‘cp’ with ‘mv’. This will perform a file move from one location to another, removing the file from the original location and putting it into the new location.

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

touch myfile.txt

A

The touch command allows you to create any type of file, but it’s blank. After you create the blank file, you can open it in a text editor by typing open [filename].

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

mkdir

A

This command will allow you to create a directory (folder) right from the CLI. When you need a place to store new files, just use this command to add a new directory in the current working directory, or specify a full path to the location where you want the new directory to be placed.

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

rmdir “path/to/directory”

A

When you’ve created a folder that has the wrong name, you can easily use the mv command to rename it, or if you want to remove a directory altogether, use the rmdir command followed by the path to the directory.

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

sudo “command”

A

sudo (or super user do) is a command that allows you to elevate your user privileges while executing the command to administrator privileges. This is required for some commands to run —for instance removing a file that is owned by another user. When you run this command, you will see a password field appear in the Terminal where you will need to type your user account password to finish the command execution.

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

top

A

List actively running computer processes , You’ll see the stats of your system updated in the Terminal window, including the memory, CPU and disk utilization. You’ll also see a running list of the top apps using the CPU and their state, ports used, memory per app and more, without needing to open the Activity Monitor app on your Mac. This command will execute until you close the Terminal window or press Control + C to return execution back to the CLI.

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

ditto -V MyFolder MyNewFolder

A

Copy contents of a folder to a new folder, The ditto command will execute a copy of all of the contents of one folder into another folder that you specify. This is great for when you need to start a new project and use an older project as a base, or just copy files in a folder from your computer to an external drive. Add a -V as in the example below to get verbose output for each file copied.

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

whatis “command”

A

Get one-line description for a command, When you want to get a short description of a command and what it does on your Mac, use this command to find out.

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

man “command”

A

Show manual page for a command, Most commands in the Terminal ship with a manual that allows you to get help or look up arguments and other information on what a command does. Use this man command when you want to find more information about a particular command.

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

nano “Document.txt”

A

nano command lets you open the specified file with nano editor which is an enhanced version of the Pico editor.

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