Working with the Command Line Interface

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

How do you copy or move files to a thumb drive in Linux?

(cp or mv) (name of file(s)) (name of folder)

What is an .exe file? What are they an example of?

.exe files are preset lists of commands that contains machine code which is executed by the computer's processor These exe files are compiled code

What extension do PowerShell scripts use?

.ps1

What extension do Visual Basic programs use?

.vbs

What are the 3 switches available with xcopy (svh)?

/s copies all subdirectories /v verifies copies /h copies hidden and system files

What is a batch file? What is the extension?

A batch file is a script file containing a series of commands that can be executed by the command-line interpreter of an operating system For example, Autoexec.bat is a batch file.

What is the Bash shell? What is the extension of a bash file?

A command line interpreter that processes Linux commands They create bash files - not to be confused with batch files. Bash scripts are used to automate tasks, perform system administration tasks, and execute commands more quickly than typing them manually into a terminal End with the extension .sh

What does nano do in Linux?

A command-line text editor in Linux. It is a simple and easy-to-use editor that allows users to edit text files from the terminal. It includes features such as syntax highlighting, search and replace, and undo/redo.

What can we put at the end of a command line?

A switch/flag

What is an interpreted program? What is an interpreter?

An interpreted program is like Javascript and Python. Built into every different OS is an interpreter. These interpreters work on Mac, Windows, Linux. To run the program, its never turned into an exe. We just run the program through the interpreter

What is man used for in the Linux bash shell?

Brings up a list of switches for a command you are interested in You type "man (name of command)"

Does capitalization matter in Windows? What about Linux?

Capitalization matters in Linux

What is important to remember with cmd and users?

Certain commands can only be done as a super-user/administrator. OSs have ways to protect you. Right click and run as administrator - this will let you run very powerful commands you otherwise couldn't

What does the cls command do?

Clears your screen

What is pathping in Windows?

Combines ping and tracert Like ping, pathping sends ICMP echo request messages to the specified destination to determine if it is reachable and to measure the response time. However, unlike ping, pathping also performs a traceroute-like operation by sending multiple ICMP echo requests to each router along the path to the destination, and then calculating the statistics for each hop.

What are super copy commands? When would you use one?

Copy commands that have greater functionalities than the normal copy commands The regular copy command is inconvenient for copying directory trees

What can dd, cpio, rysnc, tar, and dump do in Linux?

Create backups

What does diskpart do?

Creating, deleting, formatting, and resizing partitions, assigning drive letters, and setting disk attributes With Diskpart, you can perform a variety of tasks related to disk management, including creating and deleting partitions, extending or shrinking partitions, assigning drive letters, converting disks between different partition styles (e.g. MBR to GPT), and more.

What would del *.* do? What is this known as?

Del *.* will delete everything in the directory. This is known as a wildcard

What would del *.txt do?

Del *.txt would delete anything that is a .txt file in the directory Can use this with any extension

What does df do in Linux?

Display the amount of used and free disk space on the file system

What does hostname do in Windows?

Displays the name of the current computer a user is connected to

What are environment variables? How do you reach these? How are they useful?

Environment variables are dynamic values that can affect the behavior of processes and programs running in an operating system. These variables are stored in the operating system's environment and can be accessed by programs and scripts to retrieve information, such as the location of system files or the user's home directory. Windows = set Linux = printenv We can use them in batch files to reach everyone's computers, not just the local user: %homepath% reaches whoevers homepath that is active at the moment

How do you copy files in Windows? What does the /y flag do?

Get to the directory of interest The command is: copy <source_file> <destination> Example: copy hi.txt k: /y will suppress the confirmation prompt that appears if the file already exists in the destination location. If the /y switch is used, the command will automatically overwrite the file in the destination location without prompting for confirmation.

What is ls -l?

Gives more information on your files and folders

What is ifconfig? What is iwconfig?

In summary, ifconfig is used to configure and view the network interfaces in general, while iwconfig is used specifically for wireless network interfaces.

What does the apt-get command do? What are 4 examples of its use?

It is used to install, update, upgrade, and remove software packages from a Debian-based Linux system update = local package index upgrade = all packages To update the package list: sudo apt-get update To install a package: sudo apt-get install <package-name> To upgrade all installed packages: sudo apt-get upgrade To remove a package: sudo apt-get remove <package-name>

What does the chmod command do in Linux? What is RWX?

Lets you change file permissions on the chmod program RWX is read write execute. Any letter with a - next to it means that permission is turned off. Rwxrwxrwx: first 3 are for owner, then group, then other

What does the chown command do in Linux?

Lets you change ownership sudo chown timmy fred will transfer the owner from Timmy to Fred.

What does dig do in Linux?

Like nslookup

What does the dir command in Windows do?

Lists files/folders alongside the date and time they were created, and their byte size, which are in the directory

Which of the commands can be ran with standard privileges?

Navigation commands (dir, cd, ..) netstat nslookup (depending on network configuration) format (depending on the drive being formatted) copy, xcopy, robocopy (depending on the source and destination paths) net use (depending on the network share being accessed and the user's permissions)

Does Linux use drive letters?

No

What is ps aux |? What would ps aux | grep "libre" do?

Ps aux | - the | is a pipe. This tells the system to funnel the output to whatever you type after the pipe ps aux | grep "libre" would run ps aux, take all the output, give it to grep (only works with text files) and bring out any line with the word libre

What is the rd /s command?

Remove a directory and all of its contents, including any subdirectories and files it contains.

What does the robocopy command do? How do you run it?

Robocopy is pretty identical to xcopy, but it can handle with more speed, efficiency and verification. This makes it faster and safer robocopy is basically the new xcopy and is included on newer Windows OSs Robocopy (name of folder) (location to copy) Switches: /s or /xa:h /xa:h means do not copy any hidden files

What should you do after running DISM?

Run sfc again to ensure all is well

What does the kill command in Linux do?

Same as taskkill. Kill 13482 kills a process with PID 13482 and any dependencies

What is the alternative to the cmd? What does Linux have?

Shells like PowerShell. Most OSs provide multiple shell choices In Ubuntu, you can start a tool called a bash shell

What does the shutdown command do in Windows and Linux? What are the 4 switches in Windows (/s, /r, /a, /t)? What are the 2 switches in Linux (/s, /c)?

Shuts down the computer On Windows: /s means to simply shut down /r means shut it down and restart the system /a means to abort You can also use timers: shutdown /s /t 30 shutdown /r /t 120 On Linux: You get one minute. /c to cancel and /r to reboot and shutdown now to shut it down immediately

What is dd?

Stands for data duplicator. It is commonly used for low-level copying and converting data, such as creating disk images, copying the contents of a disk to another disk or file, and making backups of storage devices.

What is sudo? Is it temporary?

Sudo stands for either "substitute user do" or "super user do". Sudo allows a user to run a program as another user (most often the root user) to achieve "best practice security" on Linux. Sudo access is temporary, and lasts only on a per-command basis. In Linux's bash shell, you can't open shells as an administrator like in Windows. Instead, we use the command sudo Example: sudo apt-get update May need to enter a password. The password needs to be entered for every command you enter

What does the -b netstat parameter do (move this to the other deck)?

The -b netstat parameter in Microsoft Windows allows to display the name of an application involved in creating each connection or listening port.

What does chkdsk do? What do the /f and /r flags do?

The equivalent of going into the drive properties and selecting error checking Chkdsk /f would actually fix errors on the drive chkdsk /r would locate bad sectors and recover readable information, and also fix errors on the drive

What is the rm -r command?

The equivalent of rd /s

What does the format command do? What are the /q, /c and /x switches?

The format command is used to format a disk or a partition in a specified file system format, such as NTFS or FAT. format <drive letter>: [/FS:<file system>] [/V:<volume label>] [/Q] [/A:size] [/C] [/X] /Q is the quick format switch /C searches for bad sectors /X forces the volume to dismount if it's in use Example: format E: /FS:NTFS

What does the gpupdate command do? What do the /force and /target switches do? What does the gpresult command do? Do we usually run these manually?

The gpupdate command in Windows updates group policy settings on the local computer from the domain controller. It is typically used when changes are made to group policy and you want to ensure that those changes are applied immediately. By default, gpupdate updates both the user and computer Group Policy settings. the /force switch forces an immediate update of all Group Policy settings (normally applied upon restart), while the /target switch allows you to specify a remote computer to update. gpresult will tell you what the changes are We usually do not run these manually. They are embedded into scripts that run at particular times

What directory do you start in when you load the command prompt?

The home directory

What does the ps command do in Linux? What is ps aux?

The ps command in Linux is used to display information about running processes, giving PIDs and names Comes with many flags, but the most famous is ps aux - displays a detailed list of all processes currently running on the system, including those owned by other users

What if a file has <DIR> next to it after you use the dir command?

This isn't a file - it is a folder/directory

What does dir /p do?

This option displays the results one page at a time, interrupted with a Press any key to continue... prompt

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

To change a user's password from the Linux command line, you can use the passwd command followed by the username of the user whose password you want to change. sudo passwd johndoe You will be prompted to enter and confirm the new password for the user. Once you have confirmed the password, the user's password will be updated.

What do System File Checker (sfc) and dism do? What order do you run them in?

Two command-line tools in Windows that are used to repair corrupted or missing system files SFC checks and replaces any corrupted or missing system files with the correct ones from the Windows installation media. Dism (Deployment Image Servicing and Management) is a command-line tool that is included in Windows operating systems since Windows Vista. It is used to manage and prepare Windows images, including creating, modifying, and deploying images. If you need to run both tools to repair your system files, it is recommended to run SFC first, as it is less intrusive and faster. If SFC is unable to repair the system files, it stores the issues in a log file. You can then run DISM to perform more advanced repairs. sfc /scannow DISM /Online /Cleanup-Image /RestoreHealth The standard rule is to then run DISM, which goes online to Microsoft, find the version of Windows you're running, and compare your system store to what is known and good at Microsoft

How can you get to another drive in the command prompt?

Type the drive letter followed by a colon For example - D:

What does the <command name> /? or <command name> help command do?

Use the help switch with the dir command to show details about the above options directly in the Command Prompt window. Executing dir /? is the same as using the help command to execute help dir.

What does top do in Linux?

Used to display system resource usage, such as CPU, memory, and disk usage, in real-time. It shows a list of running processes and their resource usage, sorted by various criteria, such as CPU usage or memory usage.

What does 'echo' mean in a bash file?

Used to display text on the standard output. It takes the text that follows the echo command as an argument and prints it to the console. echo "Hello, World!" name="John" echo "Hello, $name!"

What does cat do in Linux?

Used to display the contents of a file on the terminal cat filename It can be used to concatenate multiple files into a single file or to create a new file cat file1 file2 > outputfile cat > newfile.txt

What is winver in Windows?

Used to display the version number and build number of the operating system installed on the local computer. You can also see the account the OS is licensed to It is a quick way to check which version of Windows you are running, and to verify whether you have the latest updates installed.

What is yum in Linux?

Used to install, update, and manage software packages. It is used primarily in Red Hat-based Linux distributions, such as CentOS and Fedora, although it can be used in other distributions as well. apt-get is used in Debian Linux

What does ip do in Linux?

Used to manage and display network configurations It can be used to configure network interfaces, routing tables, and tunnels, among other things.

What is nslookup?

Used to query the DNS to obtain domain name or IP address mapping, or other DNS records nslookup www.google.com This will obtain the IP address for google.com nslookup 8.8.8.8

What does find do in Linux?

Used to search for files and directories in the file system It can search for files based on various criteria, such as file name, file type, size, and modification time.

What does grep do?

Used to search plain-text data sets for lines that match a regular expression pattern. It can be used to search a single file, multiple files, or the output of another command For example, suppose you have a file called "example.txt" that contains a list of names, one per line: John Jane Jack Jill You can use the grep command to search for lines that contain a specific pattern. For instance, to search for all names that contain the letter "J", you would type: grep "J" example.txt

What does the vi command do in Linux?

Vi is a very old text editor you can use to create and edit files When you run the vi command, it opens a new file or an existing file in the text editor. You can then make changes to the file and save it when you are finished vi ___ would create a text file in the bash shell with the name

What is a major benefit to an interpreter?

We can run one piece of code and it will run on any OS. The OS just needs to have the right interpreter

Are xcopy and robocopy network aware?

Yes. They can copy files and folders over a network

What does xcopy do? Can it verify data? How do you run it?

allows you to copy files and directories, including subdirectories It also has added functionalities over the regular copy command, like verifying data xcopy (name of directory to copy) (location to copy to) xcopy "C:\path\to\file.txt" "D:\destination\folder" xcopy "C:\source\folder" "D:\destination\folder" /E

How do you go deeper into the directories in Windows?

cd *(file path) or chdir (file path) Example: cd C:\Users

How do you ascend into directories?

cd .. or cd ../ (or with chdir)

How do you get to the root directory in Linux?

cd /

How do you get to the main desktop folder in Linux?

cd Desktop/

How do you return to the main directory? (There are 2)

cd \ or chdir \ C:

How do you get to your home directory in Linux?

cd ~

What is another command line utility in Windows that allows for directory traversals?

chdir

How do you use chmod?

chmod u+rwx example.txt chmod g+rwx example.txt chmod a+rwx example.txt To assign permissions to all types of users at once: chmod 777 example.txt Rwxrwxrwx: first 3 are for owner,group, and other 4 for R, 2 for W, 1 for E

What command clears a Linux screen?

clear

How do you get to the command line interface?

cmd

What does PowerShell use?

cmdlets

How do you delete a file in the cmd of Windows?

del (name of file including the extension)

Which of the commands can only be ran by admins?

ipconfig • ping • tracert • netstat • nslookup • shutdown • dism • sfc • chkdsk • diskpart • taskkill • gpupdate • gpresult • format • copy • xcopy • robocopy • net use • net use

Which two ipconfig flags are used for resetting the DHCP configuration settings for all adapters in Windows?

ipconfig /release ipconfig /renew

What are some commands you can use with diskpart?

list disk: Displays a list of all the disks currently connected to the system. select disk <disk_number>: Selects a disk to work with by specifying its disk number. clean: Removes all partition or volume formatting from the selected disk. create partition primary size=X: Creates a new primary partition on the selected disk with the specified size (replace "X" with the size in MB). delete partition: Deletes the selected partition. extend: Extends the size of the selected volume. shrink desired=<size_in_MB>: Shrinks the size of the selected volume by the specified amount in megabytes. assign letter=<drive_letter>: Assigns a drive letter to the selected partition. format fs=<filesystem> quick: Formats the selected partition with the specified filesystem (e.g., NTFS) and performs a quick format. exit: Exits the Diskpart utility.

What is the Linux equivalent of dir?

ls

How can you create a folder in the Windows cmd? (There are 2 commands)

md (name you want) and mkdir (name you want) Windows does not look at capitalization. Can't make two folders called mike and Mike, for example. You could do this in Linux, though

How do you make a directory in Linux?

mkdir (name you want)

How do you rename files and folders in Linux?

mv The mv command can be used to move files and folders to a new location OR to rename them. mv file1.txt newfile.txt

How can you see what directory you are in with Linux?

pwd

How can you delete a folder in the Windows cmd?

rd (name you want to delete) or rmdir (name you want to delete)

How do you rename files and folders in Windows?

ren ren <current_name> <new_name>

How do you delete a file in Linux? What is the wildcard in Linux?

rm (name of file with extension) Wildcard: rm * would wipe out everything in the directory

How can you delete a directory in Linux?

rmdir (name)

What do the tasklist/taskkill commands in Windows do?

tasklist lists all the processes running on your system with names, PID, and more taskkill lets us kill any of these processes by their name or PID


Set pelajaran terkait

BLAW, CH. 10: Nature and classification

View Set

AP Psychology Modules 74-80 Vocabulary

View Set

NSG 203 CH 78 NERVOUS SYSTEM DISORDERS, Neurology NCLEX questions, NCLEX style neuro Exam 3, neuro 2, Neurologic NCLEX Questions, Neurologic 2, MS exam#4 neuro stuff, Cerebrovascular Disorders (PrepU Ch 67), prepu chapter 38, Neurology NCLEX question...

View Set

Buyer Behavior CH11 part 1 (ch09) 26-50

View Set

Midterm: Ch 27, 32, 35, 38, 40, 68

View Set

NCIV Acid Base and Mechanical Ventilator CoursePoint Quiz - Exam 1

View Set