Lesson 7 - Chapter 2: Mastering Fundamental Commands Flashcards
What command in Windows and macOS/Linux show you the contents of the working directory? (2)
- Windows = dir
- macOS/Linux = ls
(DIRectory, Let’s See)
What does the “dir” command do? For what OS? (2)
- dir = shows the contents of the working directory
- for Windows
What does the “ls” command do? For what OS? (2)
- ls = shows the contents of the working directory
- For macOS and Linux
What does the command and syntax look like when trying to view another directory’s contents (Documents) from the root directory in Windows?
C:>dir C:\Users\vanes\Documents
(we include the desired location as an argument)
The default prompts in ____ don’t show the full path
Linux
scott@server:~$ ls
Desktop Downloads Public Videos
Documents photo.jpg timmy.doc
When you enter “dir” and a lot of text scrolls quickly down the screen, how can you pause it? (command)
type
dir /p
(notice that it’s a forward slash for Windows in this instance)
When you use dir /p to pause, how do you display the next screen?
spacebar
What command and short-form switch do you use when there are a lot of files and you don’t care about the details you just want to see the filenames arranged in 5 columns? (Windows)
(wide list format)
dir /w
(wide list format)
What short-form switch in Windows lets you see all the possible switches for the “dir” command?
dir /?
How do you use the switches /p and /w for the dir command simultaneously?
dir /w /p
What’s one of the most important switches that the ls command uses out of its more than 50 different switches? (Linux)
-l
What does the -l switch stand for?
long listing (gives detailed information about the files)
In what OS does the pipe command work in?
All 3
It’s incredibly powerful
When would you use the pipe command?
when telling the OS to take the output of one command and pipe it through a second command
What’s the Linux/macOS equivalent of Window’s dir /p?
ls | more
What’s the main help switch and command to learn for Windows? (2)
- /?
- help (by itself to show what commands you can use)
What’s the main help commands to learn for Linux? (2)
- help (by itself to show what commands you can use)
- man (followed by a command to view syntax documentation)
The “cd” command works in which OS?
All 3
To change to a directory that is beneath the current one in the hierarchy, you don’t have to do what?
specify the full path to it just its name (shorthand)
Since you can move more than one level of hierarchy at a time that’s below in hierarchy, how do you go from a C: root directory to C:\Obiwan\my\hope? (Type out prompt)
C:>cd obiwan\my\hope
(notice there is NO backslash in front of obiwan, if going in deeper in the current subdirectory don’t need a backslash in front)
In order to change to a directory that’s NOT below the current working directory, what do you include before the name?
Example:
C:\Users current working directory
Change to:
C:\Windows\System32
a \ in front (of Windows in this example)
backslash
C:\Users>cd \Windows\System32
How do you return to the root directory?
type cd \
How do you return to the root directory in Linux or macOS?
cd ~
In Linux/macOS and Windows, what types of slashes do they use? (2)
- Linux/macOS forward slash
- Windows backslash
On a Linux system, what directory should you not create files and directories in?
the root / directory
(so a user can’t break the OS)
Do you use the cd command to move between drives on Windows?
No
How do you move between Windows’ drive letters?
you type the drive letter and a colon
from C:\
to E:
it would look like C:>E:
to go back you just do the same and it returns you to the same directory you left
All media in macOS and Linux is mounted as…?
directories
In macOS, where is media mounted to?
/Volumes directory
In Linux Ubuntu, where are drives mounted to and where is removable media mounted to? (2)
- Drives = /mnt directory
- Removable Media = /media/username
What command do you use to make a directory in Windows? (2 options)
- md
- mkdir
What’s the difference between md and mkdir commands?
md has 1 required argument: the name of the directory to create and mkdir works on all 3 OS
How do you create multiple directory layers at once to make a files directory and a games directory inside the files directory under Scott? (Windows)
Working directory: C:\Users\scott
C:\Users\scott>md files\games
What command do you use to make a directory in macOS/Linux?
mkdir
(only)
What command do you use to remove an empty directory? 3 options. Which OS do they work on?
- rmdir = all 3 OS
- rd or rmdir = Windows
Can the rmdir or rd delete a directory that contains files/sub-directories?
No, it needs to be an empty directory
On Windows, what switch can you use to delete a directory with all its files and sub-directories?
rd /s
(remember files deleted from command line don’t go to the recycling bin)
What command and switch do you use to delete a directory with all its files and sub-directories in Linux/macOS?
rm -r
How do you run a program from the command line in Windows? (2 options)
- Change to the working directory it’s in, type the filename (like mmc), ENTER
- Type the complete path to the executable file from the current working directory
All files with extensions .exe and .com are…?
programs
How are macOS/Linux executable programs from the command line different from Windows? (2)
- Don’t rely on any kind of extension (like .exe)
- Any file (code, text file, etc) can be given the property of executable
Almost all versions of Linux come with what kind of coded command lines?
color-coded
What color might executable files be in Linux?
green
What are the 2 types of executable file types that Linux has?
- Built-in
- Executables
What’s the difference between built-in programs and executable programs in Linux? (2)
(2 different types of executable file types in Linux)
- built-in programs = like built-in commands [mkdir, ls, rm] or built-in programs you type the name in
- executable programs = not built-in, unzip program and add ./ to executable name to run it from command line
In Linux, can you type the name of the executable program in the command line to run it if you’re in the directory that holds it after unzipping it?
No, it needs more syntax to run the executable
What happens when you run a program from the Linux command line? What does Linux look through first?
A series of directories called the path (not like a command prompt path)
(it won’t run yet without additional syntax)
What do you add in front of an executable in Linux to make it run?
a dot and a slash ./
scott@server:~/$./runme
To create a directory in either Windows or Linux, use the command….?
mkdir
For a listing of the working directory’s content, use the ___ command in Linux or the ____ command in Windows.
- ls
- dir
To remove a directory in either Windows or Linux, use the ___ command.
rmdir
To change the working directory, use the ____ command in Linux or the ____ command in Windows.
- cd
- cd
To remove a directory in Windows without first deleting its content, use the ___ switch. (But be careful!)
/s