CompTIA A+ (220-1002) Cert Prep 4: Command-Line Interface and Scripting Languages

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What do all Linux script files begin with?

#! /bin/bash

What are 3 of the switches that can be used with the xcopy command?

/s will copy the directory and all of its subfolders. /v will verify each file or folder is properly copied. /h will ensure that no hidden files are copied.

What is the different switch syntax used by robocopy to not copy any hidden files?

/xa:h after the robocopy command will ensure no hidden files are copied.

When navigating between folders in the command shell, what are 2 differences between Windows and Linux?

1. Windows uses back slashes (\), while Linux uses forward slashes (/). 2. You do not need a leading slash when navigating between folders in Linux, but you do have to in Windows.

What is a .vbs file?

A file written in the Visual Basic scripting language has a .vbs extension.

What are the results of the kill -l command in Linux?

A list of all running processes, along with their process IDs. In addition, if a process name is followed by a negative number, that means that process is in a group. If you kill that process, you will kill every process running in that group.

What is a function?

A set of code that does something very specific, and each function can be run over and over again instead of rewriting it each time it is needed.

What is a Batch file?

A simple text file that has one command per line, and then a hard return. This is done to simulate typing those commands on the command line, and then executing them one at a time, but then automatically moving on to the next command after the previous one has finished. Batch files have a .bat extension. *

How do you format a partition using diskpart?

After using the list partition command, select the partition in question with the select partition 1 command, or whatever the partition number is. Then format it with the command format FS=NTFS to use the NTFS file system on that partition. You can also end the command with the word quick if you only want a quick format.

What is a "switch" when using the CLI?

Anything that is put on the end of a command, such as /p following the dir command to only show one page of results at a time for the dir command.

What does the echo command mean in a Linux script?

Basically, to just display on the screen whatever follows the echo command. If you put the echo command on a line by itself and then hit Enter, it will display a blank line. If you use the command echo "Show me this" and hit Enter, the words "Show me this" will display without the quotation marks.

What does chkdsk do?

Chkdsk performs error correction on any drive that it is run on. It does not actually fix any drive issues, but it does mark off any bad areas so they are not used.

What does the clear command do?

Clears the screen of all recent activity in Linux.

What does the cls command do?

Clears the screen of all recent activity in Windows.

What is Javascript the most effective tool for writing code for?

Client-side applications. All javascript files have a .js extension.

What are Windows executable files made up of?

Compiled code that is written by programmers in languages such as C and C#.

What are "if/then" statements called in Visual Basic?

Conditional statements.

What is Deployment Imaging Servicing and Management, or DISM?

DISM works with the System File Checker, or SFC, to check and repair, if necessary, the backup copies of all critical system files. SFC, is run first to check backup files against the working copy. If any errors are found, SFC will try to replace damaged files with files from the backups. If that doesn't work, DISM is run to get fresh copies online.

What are powershell scripts saved as?

Files called cmdlets and they can be edited in a special editor that make it easier to write and edit the commands. The editor is called the Integrated Scripting Environment. *

How do you initiate the vi text editor?

From the command line, type the command vi followed by the name of the file that you want to create or edit. Once in the file, type the letter I to get into insert mode.

What is the first thing you should do after copying or moving files from the command line?

Go to the destination to ensure the copy or move was successful. If you assume it worked, but didn't, it will cause problems later when you try to find or work with those files.

Describe the concept of a group policy.

If a local computer or network has local security policies in place, those policies govern every computer on that network. However, if that network is part of a domain that is controlled by a domain controller, the domain's Group Policy overrides any local computer or local network policies.

How are Linux script files saved?

In Bash shell files that end with the extension .sh. *

Name 4 types of shells - or Command Line Interfaces - available today.

In Windows you have the command prompt and also Windows Powershell. In Linux, you have the Bash shell. On a MAC, the shell is very similar to the shell used in Linux.

What does the -l switch do in Linux when using the ls command?

It brings up the same list of files and folders, but with details. Those details include the permissions, the owner, the group, the size, and the last date and time they were edited.

Without using the ls command, how can you visually see in a Linux command shell if you are in the root directory or in a user's home directory?

It is a very slight difference, but the home directory command prompt will have a tile (~) while the root directory command prompt will have a forward slash (/).

What does the Windows xcopy command do?

It is built for larger scale copying on the command line, such as copying entire directories and subfolders.

What does the dd command do?

It is the Linux copying command used for bit-by-bit copying of large amounts of data.

What does the /? Switch do on the command line?

It tells you what options are available for whatever command that you typed prior to the /?. *

What does the %HomePath% variable do in a script?

It will insert the actual homepath of whatever user is logged in at that moment. For example, if the script was being used to delete the log files that are automatically put on each user's Desktop at night, the same script to delete those log files could be run on everyone's computer because of the %HomePath% variable.

How do you navigate to a different drive in the Windows command shell?

Just type the drive letter followed by a colon. For example, to go from the C drive to the D drive at the command prompt, just type d:.

What does the kill command do in Linux?

Kills any specified running process. To see a list of available processes to kill, type the kill -l command, and then to kill them, just type the kill command followed by the process ID.

What is different between Windows and Linux when using text on the command line?

Linux commands are case-sensitive, but Windows CLI commands are not.

What diskpart command will show the partitions of the selected disk?

List partition.

What does the tasklist command do?

Lists all tasks that are presently running on that system. It includes the process name and process ID number, which is useful to have if you want to turn a process off.

Do Linux systems have drive letters?

No, everything is done in folders and subfolders, so navigating a command shell is similar to Windows, but there are no drives to navigate to.

Can you only move up or down one folder at a time when using a command shell?

No, if you know the specific path that you want to go to, you can "jump" all the way to it. For example, to jump down from the root directory of c:\ to get into the Windows\tracing folder, just type cd, space, backslash, Windows, backslash, tracing. You can also jump all the way back to the root directory by typing cd c:\.

Is Visual Basic commonly run on MAC computers?

No, it is almost always run in the Windows environment.

Is written code ready to be executed?

No, the original code is a simple text file. It has to be compiled into an executable file before it can be run.

Are programs written in Interpreted Languages made into executable files?

No, they are "read" by an interpreter on whichever machine they are being run on, and the interpreter gives the operating system whatever it needs to properly run the program.

Can you delete directories in Windows that have contents in them?

Not using the rd command, no. Using the command shell, you can append the /s switch to the rd command, and you will be prompted whether or not remove a directory that has folders in it. Using Powershell, you can just use the rd command without the /s switch, and Powershell will give you a similar prompt.

When do you run DISM?

Only after you have run SFC, and SFC found some problems that it could not repair. If you do have to run DISM, you should run SFC again afterward to ensure everything was fixed.

Who can change the permissions of any given file or folder in Linux?

Only the owner.

How do you get around the problem of compiled executable files being specific to any given operating system or CPU?

Programs can be written in Interpreted Languages instead, such a Visual Basic, Python, and Javascript.

What does the ps aux command do?

Provides extremely detailed information about all processes running on the system, for all users.

What does the ps command do in Linux?

Provides information about the currently running programs, including their process IDs, for the present user. The 4 details included are PID, TTY, TIME and CMD. TIME is the amount of CPU (central processing unit) time in minutes and seconds that the process has been running. CMD is the name of the command that launched the process.

What is the most common scripting language that works on most operating systems?

Python works on almost every operating system, and it is popular because it is a lot easier to read than other scripting languages. All Python files have a .py extension.

How does the Linux command line handle switches?

Rather than using a forward slash like Windows does, Linux uses a dash followed immediately by whatever the switch is.

What is the first thing to do after starting the diskpart tool?

Run the list disk command to see the status of the system drives.

What does the taskkill command do?

Shuts down any given service that is running on a computer either by its process name or process ID number.

Why do you have to be extremely careful when using copy and move commands from the command line?

Since there are few warnings if you do something wrong, you can easily mess something up pretty badly without even realizing it until much later.

After running the ls -l command in Linux, what does the letter d mean at the beginning of the permissions string?

That line is describing a directory, not a file.

What is apt-get?

The *DEBIAN* software repository. Ubuntu is Debian, so apt-get is how you install Ubuntu updates. Apt-get is actually getting deprecated in favor of just apt, but for the CompTIA exam, apt-get is how to update Debian systems.

How do you copy or move files in Linux?

The CLI command for copy is cp, and the CLI command for move is mv.

What happens when you use the change directory command followed by 2 dots?

The Command prompt is taken up one directory above wherever it is at the time. For example, if the command prompt is in the C:\Windows\tracing folder, typing cd\ .. will put the command prompt in the C:\Windows folder.

What do operating systems need to have in order to use programs written in Interpreted Languages?

The OS must have the correct interpreters for whichever language was used to write that program, such as Visual Basic, Python, and/or Javascript.

How are Linux permissions configured using numbers?

The Read permission has a value of 4, the Write permission has a value of 2, and the Execute permission has a value of 1. In practice, this means that if a User, Group, or Other has permissions of 777, they have read, write, and execute permissions. 6 would mean just read and write, and 4 would just mean read.

How do wildcards work when moving or deleting files in Linux?

The asterick (*) is still used, but it can be used more freely. For example, to delete all filenames that start with the letter M, use the command rm M*. You could also delete all text files with filenames that ended with the letter M by typing rm *M.txt

How does the shutdown command work on Linux?

The command itself is the same as with Windows - just the word shutdown. In Linux, you can cancel the shutdown, however, by typing shutdown -c after you have initiated the shutdown. Shutdown /r reboots the computer, and shutdown now just shuts it down.

When running the "dir" CLI command in Windows, what 4 aspects of the files and folders will you see?

The data and time they were last accessed, the file size, and the file name. In the case of folders, you won't see any of that information, but you will see <DIR> instead. Directories and folders are the same thing in this regard.

How do you view what group policies are being applied to any given computer?

The gpresult /r command will include any group policies that were recently enacted on that machine, and it will also list the security policies that apply to that machine from the group level.

What command is used on the Windows command line to grant permissions to files or folders.

The icacls command. It has very complex switches, and is not on the CompTIA exam, but can be researched on the command line by typing help icacls.

What does the cd / (forward slash) command do in a Windows shell?

The is the Change Directory command and it will take the command prompt back to the root directory.

What other copy command is similar to xcopy, but is more powerful?

The robocopy command performs more verification and is also faster.

What are the Linux permission string definitions?

There are 3 sections, each with 3 permissions. In order, the sections are User, Group, and Everyone. In the same order in each section are the permissions Read, Write, and Execute, written as rwx. If there is a dash (-) in any of those columns, then no permissions have been set there.

What is one thing that both xcopy and robocopy can do that standard copy commands can't do?

They are both network-aware, which means you can put in a UNC address to copy files to a network share. The syntax for robocopy would be robocopy c:\backup "\\server\backup" to copy all of the files from the backup folder on the c drive to the backup folder on the server.

What is the problem with compiled executable files?

They are compiled for very specific operating systems and even specific CPUs. For example, the same compiled executable that opens Microsoft Word on a Windows machine will not open Microsoft Word on a MAC.

What do "for" statements do in Javascript?

They are conditional loops that tell the script to keep doing something as long as something else is happening.

What are Environment Variables?

They are locations or names of files, programs, folders, utilities, etc., that are used throughout a Windows operating system. By learning what these are using the set command on the command line, you can input needed information into scripts.

What do the pound signs in Linux scripts mean?

They are non-executable areas where remarks can be entered to help understand what is happening in that script.

When are gpupdates normally run?

They are often part of scripts that run outside of normal business hours in order to keep all computers in sync with the group policies without having to manually run the gpupdate command.

What is the diskpart CLI command used for in Windows?

To open up the interactive command line tool for partitioning hard drives.

How do you run commands as an administrator in Linux?

Type "sudo" prior to the command, i.e. - sudo ls which is the equivalent of running the dir command in Windows as an administrator.

How do you navigate to the actual root directory using the Linux command prompt, rather than navigating to the home directory of whichever user is logged on at the time?

Type cd, space, forward slash (/). That will take you to the actual critical folder directory for the entire Linux system.

At the Linux command prompt, how do you get back to the home directory?

Type cd, space, tilde (~).

How do you use the change directory command to go to a specific directory?

Type cd\ (backslash) followed immediately by the name of the directory, such as cd\Windows.

How do you use the chmod command to change permissions for a file or a folder?

Type chmod 777 filename.txt to change the permissions for filename.txt to be read, write, and execute for the user, the group, and other. Likewise, chmod 770 filename.txt would give the user and group read, write, and execute permissions, but other would have no permissions.

How do you close a shell when you are done with it?

Type exit, quit, or just close the window.

How do you create a folder at the Windows command prompt?

Type md followed by the name you want the folder to have, such as md Aaron, and then press enter.

How do you delete folders from the Windows command line?

Type rd followed by the folder name, such as rd Aaron to remove the Aaron directory.

How do you get help about any given command in Linux?

Type the "man" command followed by the command you want to learn about, such as "man ls" to get the manual on the ls command.

How can you get help with the available switches for any given command on the command line?

Type the command followed by the /? switch to get help about the switches for that particular command.

How do you run DISM from the command line?

Type the dism command followed by the /online switch, then the /cleanup-image switch to tell DISM to look at your backup files, and then the /restorehealth switch to tell DISM to fix any problems that it finds. Altogether, the command is dism /online /cleanup-image /restorehealth.

How can you tell chkdsk to fix any errors that it finds on a drive?

Use the /f switch after the chkdsk command.

What shortcut can be used to type commands in a Windows or Linux shell?

Use the Tab key to finish folder or subfolder names.

How do you copy files from the Windows command line?

Use the copy command followed by the name of the file, then the location where you want to copy it to.

How do you delete multiple files with the same file extensions from the Windows command prompt?

Use the del command followed by an asterick (*) as a wildcard, followed by the extension of the files you want to delete, such as del *.txt to delete all text files.

How do you delete all files in any given directory?

Use the del command followed by an asterick, a dot, and an asterick. In this case, Windows will prompt you if you want to delete all of those files.

How do you create folders from the Linux command prompt?

Use the mkdir command followed by the name of the folder, such as mkdir Aaron

How do you move files from the Windows command line?

Use the move command followed by the name of the file, then the location where you want to copy it to.

How do you delete files from the Linux command line?

Use the rm command followed by the filename.

How do you remove a directory in Linux that has contents in it?

Use the rm command with the -r switch.

How do you remove a directory in Linux?

Use the rmdir command followed by the folder name.

How do you tell diskpart which disk to partition.

Use the select disk 1 command, with 1 just being an arbitrary number. That will be whatever number the drive has that you want to partition.

How do you run the System File Checker from the command line?

Use the sfc command followed by the /scannow switch.

How do you uninstall a program on a Linux Debian system?

Use the sudo apt-get remove command

How do you upgrade the software on an entire Linux system from the command line?

Use the sudo apt-get upgrade command. You can also use the sudo apt-get upgrade programname to just upgrade a specific program.

What is the difference between server-side and client-side applications?

Using a web browser as an example, a server-side web page is created in its entirety on the web server, and then sent as a whole to the computer's web browser. In a client-side setup, the web server just sends raw code to the user's computer, and the computer then recreates it into a web page.

What is a danger with using the "su" command in Linux?

Using the "su" command basically makes you an administrator for every single command that you enter after that. As opposed to having to type "sudo" before doing any administrator level commands, if you use "su" to become an administrator, it can be easy to forget that you have the power to damage that computer's configuration.

How do you change ownership of a file or folder in Linux.

Using the chown command. If you own the file, you do not have to use sudo. Otherwise, the command is sudo chown aaron file.txt would change the ownership of file.txt to the username aaron.

When are server-side applications often used?

When accessing large stores of information that are kept on remote servers, such as database servers.

What happens if you try to execute a program from the command line that is available for your system, but is not installed at that time?

When you execute the command, Linux will tell you that it is not installed, but it will also give you proper apt commands to install it.

What is the Windows version of performing CLI commands as a Super User?

When you open up the Command Shell, or the Command prompt as it is commonly known, you can right-click on that executable file and run it as an Administrator.

What is important to remember about capitalization when creating folders from the Windows command prompt?

Windows does not care about capitalization like Linux does, so you can't have a directory called Aaron with a capital A, and another directory called aaron with a lowercase a. Windows will not let you create what it sees as a duplicate folder.

How do you delete files from the Windows command prompt?

With the del command.

How do local computers get the latest security policy updates from their domain controller?

With the gpupdate command run from the command shell. To see the results of the gpupdate command, run the gpresult /r command.

How do you use diskpart to assign a drive letter?

With the partition in question still selected, type the command assign letter=x to assign the drive as the letter x.

How do you change directory to get into a subfolder of the folder that the command prompt is in?

Without using a backslash, just type cd, then a space, then the name of the subfolder. For example, if the command prompt is in the Windows folder, to get into the subfolder called "tracing", just type cd, space, tracing.

When using the Windows command line, can you format drives?

Yes, but you have to be running the command shell as an administrator.

Can you use wildcards to move files on the Windows command line?

Yes, it works exactly as the copy command does, only the files are moved instead of copied.

Can you create images and bootable media using the Linux dd command?

Yes, just copy the information to a filename. For example, dd if=/div/source of=~/backup.img will put everything from the source directory into a file called backup.img.

Can you create a directory with subfolders from the command line?

Yes, just specify the entire path, such as mkdir Desktop/Aaron/sub to create a folder called sub in the Aaron folder that is on the Desktop.

Can you jump from a root directory into a subfolder using the Linux command prompt?

Yes, just type the exact path. For example, to get into the Dowload_subs folder inside the Downloads folder, type cd, space, Downloads/Download_subs.

Is it possible to run SFC in a mode that will not automatically fix damaged files?

Yes, there are options to only be notified of issues if you want to investigate problems rather that just letting SFC automatically fix them.

Does Javascript use conditional statements?

Yes, using terms like "if", "then", and "else".

Can you shut down a Windows computer using the command line?

Yes, with the shutdown command. It is not normally used without various switches, such as /s to just shut it down, or /r to restart the system. There are also switches to have all users logoff first, or to set a specific time to shut the computer down.

Can you use the Linux dd command to wipe a folder or directory?

Yes. By using the "zero" syntax in the source part of the command, you will tell Linux to write nothing but zeros to the destination, such as dd if=/dev/zero of=/dev/destination

Can you use the ps aux command to get detailed information about a specific program?

Yes. You can get the name of the process from the ps aux command, and then rerun the command for just that program. For example, ps aux | grep "libre"

What is the danger of deleting files using the command prompt?

You are not asked to confirm if you actually want to delete the file, and there is no recycle bin to recover it from if you delete something that you shouldn't have.

In addition to the /? Switch on the command line, what other tool can you use to find out what commands are available?

You can type the command "help" followed by the action you are interested in, such as help dir, or help del, to get help on the directory or the delete command, respectively. *

In Linux, what is an alternative to putting sudo prior to any command that you want to run as an administrator?

You can type the command "su" followed by an administrator username and password, and everything that is done after that is done as an administrator.

What is the first part of partitioning a hard drive in diskpart after you have selected it?

You have to create a primary partition with the command create partition primary.

What do you have to do when using variables in Visual Basic?

You have to declare variables as being a certain type of character, such as a number, a string, a letter, etc.

How do you view the contents of other drives, such a CD drive, using the Linux command prompt?

You have to go to the actual root directory first, where is a folder called media. Change directory into the folder, and any available media will be listed there as a directory. Change directory into that media, such as cd cdrom, and the contents of that media will be displayed on the screen.

How do you change a password from the Linux command line?

You must be logged in as the user that you want to change the password of. From the command line, type sudo passwd, and hit Enter. You will be prompted to enter the new password twice.

What is the syntax of the Linux dd command?

dd if=/dev/source of=/dev/destination will copy everything from the source directory and put it in the destination directory.

What command is used on the Windows command line to format a drive?

format e: /FS:filesystem - such as NTFS, FAT32, etc., where e is the drive letter that you are formatting and the file system name you choose is the file system you want the drive to be formatted with. You can alse use the /q switch along with that command to do a quick format.

What is the syntax of the robocopy command?

robocopy c:\backup x: will copy all files from the backup folder to the x drive.

What do all apt-get commands start with?

sudo apt-get so that you are executing that command as a super user.

What is the command to update a Debian-based system with apt-get?

sudo apt-get update.

What is the syntax for the taskkill command?

taskkill /pic 4908 would kill the task with the process ID number 4908.

In Linux, what is vi?

vi is a very old text-editor for the Linux operating system.

What is the syntax of the xcopy command?

xcopy c:\backup x: will copy everything in the backup folder to the x drive.


Ensembles d'études connexes

CH. 20 Management of Patients with Chronic Pulmonary Disease

View Set

MS Insurance Supplement License Exam Study Guide: Chapter 3 & 4

View Set

PNE 142 Chapter 37: Resuscitation

View Set

Biology, Cell Division and Reproduction, Q3

View Set

AP Chemistry - AP Classroom Unit 1 Progress Check: MCQ

View Set

PN NCLEX 6th Edition- Leadership/Ethical/Legal

View Set

Anatomy-somatic and special senses

View Set