Basic Commands
What is needed to copy a directory's contents in PowerShell?
-Recurse
What is the one option for rmdir?
-p which tells it to remove parent directories if they're also empty.
Example of a path in Linux:
/home/cindy/Desktop
How do you use tab completion?
After entering the command, type the first letter of the file or directory you wish to go to. Then press the tab button until you get what you are looking for.
-a flag
All option. This flag shows all the files in the directory including the hidden files.
--help
Allows you to view what options are available for a command by adding this flag.
What is a nickname for a command called?
An alias
Where does a path start?
At the root directory of a drive and continues to the end of the path.
Tab completion
Built in feature on a shell that allows you to use the tab key to auto-complete file names and directories.
touch command
By default, this is used to change the modification and access times of a file. If the file doesn't exist, this command is used to create a file with default permissions.
How do you hide a file or directory?
By pre-pending a dot to it. Ex: .I_am_hidden
How do you specify a flag?
By using a hyphen then the flag options.
Example of a path in Windows:
C:\Users\Cindy\Desktop
What are two CLIs available in Windows?
Command Prompt or cmd.exe and PowerShell or powershell.exe
man command
Command in Linux that is used to show manual pages. Gives the same info as --help but with a little more detail.
rmdir
Command in Linux used to remove empty directories only. Must use rm to remove a non-empty directory.
cp command
Command in PowerShell used to copy a file.
-Recurse
Command parameter that lists the contents of a directory.
-Verbose
Command parameter that tells you what has been done.
pwd (print working directory) command
Command that displays which directory you're currently in.
Get-Help ls
Command that will give a brief summary of the command's parameters
Get-Help ls -Full
Command that will give a description of each of the parameters and some examples of how to use the command.
cd ..\'name of directory'
Command that will take you to the level above your current directory and then to the directory that you type after the slash.
cd ~
Command used as a shortcut for the path of your home directory.
cd .. command
Command used as a shortcut to get to the level above your current directory.
cd (change directory) command
Command used to change the current directory. To use this command, you'll need to specify the path that you want to change to.
/bin
Directory that stores essential binaries or programs in Linux.
/etc
Directory that stores important system configuration files in Linux.
What are file systems assigned to in Windows?
Drive letters which look like C: or D: or X: Each drive letter is a file system.
-p
Flag in Linux; allows mkdir to create parent directories if they don't exist.
subdirectories
Folders stored within the root or other folders. In Windows, separated by backslashes; in Linux, separated by forward slashes.
Ctrl+R
History command shortcut.
What is different about tab completion on Linux?
Instead of allowing you to scroll through the options, it will show all options at once.
/proc
Linux directory that contains information about currently running processes.
/user
Linux directory that contains user installed software.
/var
Linux directory used to store system logs and any file that constantly changes.
mv command
Move command let's us rename files as well as move files from one directory to another. You can also move multiple files using wildcards.
How do you discover if there are hidden files in a directory?
Once in the directory, click View at the top, then check the hidden items checkbox.
-r
Recurse flag in Linux. Lists the contents of a directory.
rm command
Remove command is used to remove a file or folder. Does not move items to Recycle bin, deletes permanently.
-m
Stands for mode; flag in Linux used to set permissions of directories during creation.
Bash
The Bourne again shell (Bash) is a common application to offer a shell command line; other common shell applications are the C shell, the Bourne shell, and the Kern shell.
mkdir (make directory) command
The command used to create directories.
If the root folder of a drive is called a parent directory, then what is considered child directories?
The contents inside the drive root folder.
paths
The location of files and directories in a file system.
Relative path
The path from your current directory.
/home
The personal directory for users in Linux. Similar to Windows users directory.
root directory
The top of the file management structure. Also known as the parent for all other directories in that file system. In Windows, for C: would be written C:\
How do you prevent the touch command from making a new file?
The touch command can take the -c option to prevent a new file from being created.
-l flag
This flag shows detailed information about files and folders in the format of a long list.
What is the shortcut for the history command on an older version of PowerShell?
Use # followed by some part of your old command and then use Tab completion to cycle through the items in your history.
. command
You can also use a "dot" to copy or move files to the current directory.
What is the escape character in Linux?
backslash (\)
Example of using a "dot" to copy or move files to the current directory:
cd /home/user/Pictures mv /home/user/Images/Vacation.JPG . In the directory /home/user/Images, we can move the file "Vacation.JPG" into the Pictures directory. To do that, we change into the Pictures directory, then add a "dot" to the mv command as the target.
clear command
clears the output on the screen in PowerShell
How do you copy a file in PowerShell?
cp then the file you want to copy and then the path of where you want to copy it to
What are the file types are indicated by the first letter of the field in ls -l output?
dash (-) : regular file d : directory l : symbolic link, means its a link to another file b : block device file c : character device file n : network file p : FIFO, named pipe, which connects the output of one process to the input of another. s : socket, file that enables communication between two processes. D : door, file used for inter-process communication between client and server.
history command
history of all commands given in a program
ls
list directory command
An example of two different flags appended together:
ls -l -a / = ls -la /
When creating a new directory, what are two ways to add spaces to the name of that directory?
mkdir 'my cool folder' or mkdir my` cool` folder
Example of mv command to move multiple files:
mv *_document.txt ~\Desktop This will move all the files with _document.text in the name.
Example of mv command to move multiple files in Linux:
mv *_documents.txt ~/Desktop
Example of mv command to rename a file in Windows:
mv blue_document.txt yellow_document.txt
Example of mv command to move a file in Linux:
mv blue_document.txt ~/Documents
Example of mv command to rename a file in Linux:
mv red_document.txt blue_document.txt
Example of mv command to move a file in Windows:
mv yellow_document.txt ~\Desktop
Example of rm to remove a directory in Linux:
rm misc_folder You will receive a message making sure you want to delete the folder. You can also use the Recurse flag to avoid this message. rm -r misc_folder
Example of rm to remove a file in Linux:
rm text1.txt
Example of rm to remove a directory in Windows:
rm ~\misc_folder You will receive a message asking you to confirm because it will also delete all of the files within the folder as well. You can also use the Recurse parameter to avoid this message. rm ~\misc_folder -Recurse
Example of rm to remove file in Windows:
rm ~\text1.txt
How do you use the man command?
run man then the command you want to look up. Ex: man ls
Example of the c flag with the touch command in Linux:
touch -c empty_file
Example of the touch command in Linux:
touch empty_file This creates an empty file called 'empty_file' in the current directory.
Wildcard
A character (*) that's used to help select files based on a certain pattern.
escape character
A character that invokes an alternative interpretation on the following characters in a character sequence. The back tick (`) is the escape character in PowerShell.
Command Line Interface (CLI)
A graphic-free user interface, such as the Command Prompt program in Windows, where technicians can enter commands more quickly and with more flexibility than in a GUI (graphical user interface) environment.
-Force
A parameter for the ls command that will show hidden and system files that aren't normally listed with just ls. The Recycle Bin will be found here.
Absolute path
A path that starts from the main directory.
What is the CLI in Linux called?
A shell
Graphical User Interface (GUI)
A user interface which displays images and pictures that allows a computer user to interact with a computer easily.
command parameter
A value that's associated with a command.
command flag
A way to specify additional options for a command, similar to Windows command parameters.