Commands - Review Flashcards

1
Q

Search which subdirectories are in a directory that match a word.
Linux

A

ls -la /locationtosearch | grep wordtomatch

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

Find files with a specific word.
Linux

A

grep -rw /home/user/Downloads -e “vacation”

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

How do you search for a word in multiple files

L

A

grep study *_notes.txt

grep fruit *.txt (search for fruit in a group of text files)

grep fruit apple.txt banana.txt orange.txt

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

How do you search for a word in a file. L

A

grep oranges fruit.txt

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

To create a new file with default permissions L

A

touch test_file.txt

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

How do you create/modify a text file using the popular text editor that can be found on nearly all Linux distributions?

A

nano my_file

Can create and modify a text file in the command line

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

To make a text file in Linux with a redirector

A

cat > (name of file)

ENTER key, then type text, then save file with CTRL + D

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

Find files with a specific word L

A

grep -rw /home/user/Downloads -e “vacation”

**having issues with this one, it won’t find my “file” files in a subdirectory

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

What’s the main way I should use to search for which subdirectories or files match a word? L

A

ls -la /locationtosearch | grep wordtomatch

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

L: options available for a command

A

(command) –help

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

extra information about commands - manual pages

Linux

A

man (command)

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

long list format (something is too long, make it readable and organized with this command, more detail)

Linux

A

-l

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

show all files in a directory and hidden files flag
Linux

A

-a

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

hide a file or directory

Linux

A

.(in front of file or directory)

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

current directory

A

pwd

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

change directory 3 ways

A

cd
cd ..
cd ~

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

make a new directory

A

mkdir

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

copy a file/directory 3 ways

A

cp filename.ext location
pattern copies: cp *.png ~/Desktop
directory copies (inside contents): cp -r ‘Cat Pictures’ ~/Desktop

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

moving a file

A

mv filename.txt locationtomoveto

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

to make a text file with a redirector and enter text right away

A

cat > (name of file)

ENTER, type text, save with CTRL +D

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

view text files 2 ways

l/w

A

cat

less
-g
-G
-/word_search
-q

more (windows)

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

flags/parameters that can be used with cat when to view certain lines? 2

A

-Head Line#
-Tail Line#

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

modifying text file (create a new one with nano) and enter text right away

A

nano my_file

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

how do you search for a word in one file?

linux

A

grep word filename.ext

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

how do you search for a word in multiple files? 3 ways
linux

A

grep word *_filename.extension
grep word *.extension
grep word filename filename filename

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

How do you filter the standard error output into a linux black hole?

shows just the output, no errors

A

/dev/null

less /var/log/syslog 2> /dev/null

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

search which subdirectories are in a directory that match a word

A

la -la /directorytosearch | grep wordtomatch

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

command line and shortcut to copy/move files to current directory

A

mv (path to file to move) .

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

find files with a specific word

linux

A

grep -rw /home/user/Downloads -e “vacation”

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

create a new file with default permissions no typing text

linux

A

touch filename.txt

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

how to open a file with nano (or creates a new one)

A

nano path/to/existing/file or nano filename.txt

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

run a command that requires root privilege

A

sudo (command) file/path

sudo su -
then re-do command after getting root powers

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

view memberships for all groups - who can access run sudo

A

cat /etc/group

(4 fields separated by colons)

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

view user information on our local machine

linux

A

/etc/password

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

two ways to search for a word in a file (and filename) in a specific directory

linux

A

grep -rw /file/location -e “word”
ls /file/location | grep word -r

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

how to get detailed listing directories? w

A

Get-Help ls
Get-Help ls -Full

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

how to show hidden files in a directory? w

A

ls -Force (directory or drive name)

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

how to show what directory you’re in?

A

pwd

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

how to change your directory up one level and up one level to a specific directory?

A

up one level:
cd ..

a specific directory:
cd ../directoryabove on linux
cd ..\directoryabove on windows

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

What’s a shortcut to change to the home folder in windows?

A

cd ~

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

What’s a shortcut to change to the Desktop? both

A

~/Desktop
~\Desktop

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

What does the tilde ~ mean? What about ~\?

A

tilde ~ means the user’s home directory

~/ means a directory path below the home directory
~\

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

What are the escaped commands for windows and linux that replace special character such as spaces and brackets?

A

windows: ` back tick
spaces: single quotes, underscores

Linux: \ backslash

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

see a list of previously entered commands

how to search through results shortcut?

A

history

ctrl + r to search through previous commands

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

whats an alternative to older powershells to search through previous commands lists in history?

A

+tab to cycle

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

to copy a file

A

cp file filedestination

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

how do you copy multiple files? both

A

use a wildcard asterisk to select multiple files that match a pattern

cp *.jpg copydestinationpath

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

how do you copy a directory? windows

A

cp ‘directoryname’ targetdestination -Recurse -Verbose

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

how to rename a file?

A

mv .\filename newfilename

the .\ tells it that you don’t want to move the file in the current directory, just rename it

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

How to move a file?

A

mv filename filelocation

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

How to move multiple files?

A

wildcard * to select multiple

mv *filename targetlocation

ex:
mv *_document.txt ~\Documents

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

How do you remove a file

A

rm or remove

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

How do you remove a system file and bypass warning?

A

add the -Force flag at the end

rm importantfilelocation -Force

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

How do you remove a folder?

A

use -recursive

rm ~\foldername -recursive

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

removing a file, folder… whats a shortcut to the file path instead of the absolute?

A

rm ~\filename

add -recursive flag if removing a folder

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

how to view contents of a file? 2

linux and windows

A

cat filename

auto changes to cat .\filename

windows: more largedocument
linux: less largedocument

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

on windows using cat, what 2 parameters can we use to see only first and last few lines of text?

A

-Head #oflines
-Tail #oflines

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

How to view large output text files on Windows in pages and how do you navigate?

A

more largedocument

ENTER advance by line
SPACE advance by page
Q exit

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

how to open a text editor program and create a file

windows

A

start texteditor filename

example: start Notepad++ filename

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

how do you see what the actual powershell command of a command is?

A

Get-Alias

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

what’s the cmd.exe version of Get-Help?

A

\?

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

how do you search for words in a file, a type of file, or a directory on the entire computer?

windows

A

sls or Select-String

Select-String word filename.txt
Select-String word *.txt

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

how do you search for a pattern within a specific directory?

windows

A

ls ‘directorypath’ -Recurse -Filter *pattern

ls ‘D:\Program Files' -Recurse -Filter *.exe

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

how do you change standard output to display in a new or existing file by overwriting?

windows

A

echo outputcontentforfile > filename.txt

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

How to change the standard output to add onto an existing file, no overwriting?

windows

A

> > -Append

echo outputcontentforfile&raquo_space; existingfilename.txt

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

How to send the output of one command into the input of another?

windows

A

cat filetosearch | Select-String wordtosearchfilefor

takes output of cat, inputs it to sls to search for the word

pipe

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

How do you search for a word in one file?

windows

A

cat filetosearch | Select-String wordtosearchinfile

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

how to use pipe operator to save standard output of a word search of a file to a new file or overwrite one?

windows

A

cat filetosearch | Select-String wordtosearchfor > filename

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

How to redirect standard error stream to a text file?

A

2>

rm secure_file.txt 2> filenameforerror.txt

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

How to filter out standard error stream messages?
Windows (redirect error stream to a black hole)

A

$null

example:
rm securefile.txt 2> $null

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

How do you get input from a file and not the keyboard?

A

< less than

example:
cat < fileinput.txt

same as cat fileinput.txt

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

how do you see a list of users and groups on the computer?

Windows

A
  1. Get-LocalUser
  2. Get-LocalGroup
  3. Get-LocalGroupMember
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

What’s the alias for cat?

A

Get-Content

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

How do you change your password on Linux?

A

passwd

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

How to make the user change their password on next logon linux

A

sudo passwd -e username

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

To remove a user on Linux?

A

sudo userdel username

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

To add a user on Linux?

A

sudo useradd username

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

How do you remove a user on Windows? 2 ways

A

net user username /del
Remove-LocalUser username

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

How to create an acct that requires logon password change in same command line windows?

A

net user username pa5sw0rd /add /logonpasswordchg:yes

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

How do you add a new user? windows

A

net user username * /add

net user username ‘some_password’ BUT THIS IS NOT SECURE do not use this

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

How do you require a next logon password change? windows

A

net user username /logonpasswordchg:yes

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

How do you view file permissions in Linux?

A

ls -l ~/my_file

for me it worked like this:

ls -l dog.txt

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

How do you see ACL assigned to a file/permissions? Windows

A

icacls filefolderpath

icacls /? for help

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

How do you modify a file/folder permission in the CLI? Windows

A

icacls ‘C:\Vacation Pictures\’ /grant ‘Everyone:(OI)(CI)(R)’

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

How do you only let non-guest users see a file or folder? w

A

icacls ‘filepath’ /grant ‘Authenticated Users: (OI)(CI)(R)’

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

How do you remove file permissions for a group? w

A

icacls ‘filepath’ /remove Everyone

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

How do you change permissions in Linux?

A
  1. Pick which permission you want to change (owner is u, group is g, other users is o )
  2. Add/remove permissions with + or - to indicate who it affects

chmod u+x filename

(this example we want to give executable access to the owner)

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

How do you remove a permission to a file?

A

chmod u-x filename

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

How do you add multiple permissions to a file? Read and Exec Linux

A

chmod u+rx filename

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

How do you set numerical permissions for 3 permission sets for a file in Linux?

A

chmod 746 filename

combination of adding up permissions: r,w,x = 4,2,1

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

How do you change the owner of a file? Linux

A

sudo chown username filename

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

How do you change the group a file belongs to? Linux

A

sudo chgrp groupname filename

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

To view special permissions for a file in the CLI
w

A

icacls filelocation

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

How do we enable files to be run by the permissions of the owner of the file (for other users to access without root priv?) Linux

A

Do a setuid special permission

sudo chmode 4441 filename
sudo chmode u+s filename

(the first 4 is the setuid)

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

How do you see user/group permissions for when you would run the passwd command?

A

ls -l /usr/bin/passwd

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

What are two ways to implement the setgid Linux permission for a file?

A
  1. sudo chmod g+s filename
  2. sudo chmod 2551 filename

(2 is the setgid)

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

How would you look at the permissions for the temp directory, and how to make it display just the directory not the contents?

Linux

A

ls -ld /tmp

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

How to list permissions for a folder but only show directory info, not contents

Linux

A

ls -ld /tmp

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

What are the symbolic and numerical versions of the special permissions for a sticky bit?

A

Symbolic - t
Numeric - 1

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

How do you create a file not a folder in PowerShell? 2 ways

A

start Notepad++ filename.txt
Notepad filename.txt

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

How do you force PS to bypass warning and delete the directory?

A

rm filename -Force

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

What’s the position of Get-Alias in a command line?

A

Get-Alias commandname

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

What command do you use to search for a pattern in a specific directory?

A

ls
example:
ls ‘filename’ -Recurse -Filter *patterntosearch

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

How do you modify the ACL in PS to allow read access to a single user?

A

icacls filename /grant ‘Username:(R)’

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

What’s the difference between chmod and chown?

A

chmod is for modifying permissions
chown is for modifying owner

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

What is the name of the privileged file on Linux that stores scrambled passwords?

A

/etc/shadow

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

Name 3 ways an Admin can remove users on PS

A
  1. net user username /del
  2. Remove-LocalUser username
  3. GUI > Local Users and Groups in Computer Management > Right click user > Del
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
108
Q

In Windows, when setting basic permissio n “Read” which special permissions are enabled? 3

A
  1. Read data
  2. Read Permissions
  3. Read attributes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
109
Q

What’s the easiest way to make a document public/accessible to everyone?

A

Add the desired permission (read) to the “Everyone” group

icacls filename /grant “Everyone:(r)”

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

How to add a file permission to a specific user windows?

A

icacls filename /grant “username:(r)(w)(x)”

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

How to remove a file permission for a specific user Windows?

A

icacls filename /remove “username”

112
Q

How to grant everyone (owner, group, other users) all permissions using symbolic format and numerical?

A

sudo chmod a+rwx filename

or

sudo chmod 777 filename

113
Q

To install an executable file from PS?

A

type in the absolute path OR change directory to file and type in filename

114
Q

What are the 7 commands for self-extracting executables?

A
  1. /extract:[path] extracts the content of package to the path folder. If no path provided, Browse box appears
  2. /log:[path to log file] enables verbose logging (more detailed info recorded in log file) for the update installation
  3. /lang:lcid sets user interface to specified locale when multiple locales are in the package
  4. /quiet runs package in silent mode
  5. /passive runs update without any interaction from user
  6. /norestart prevents prompting user when a restart is needed
  7. /forcerestart forces a restart of the computer as soon as the update is finished
115
Q

What’s the command to install a debian package on Ubuntu?

A

sudo dpkg -i filepath

-i for install

116
Q

How to remove a program from Ubuntu?

A

sudo dpkg -r programname

117
Q

How to list debian packaged installed on machine

A

dpkg -l

  • -l for list
118
Q

Search for a program you installed ubuntu

A

dpkg -l | grep atom

or

dpkg -s packagename

119
Q

Force an update of the package manager (for a program)

A

after using dpkg -s programname if its out of date:

sudo apt-get install -f

120
Q

Update program repositories

A

sudo apt-get update

121
Q

Install a program from the Linux repository

A

sudo apt-get install program/packagename

122
Q

To remove a program Linux

A

sudo apt-get remove programname

123
Q

Command to extract and compress files Windows

A

Compress-Archive -Path C:\Users\cindy\Desktop\CoolFiles\ ~\Desktop\CoolArchive.zip

124
Q

Extract file using 7 Zip Linux

A

7z e filepath

  • she said to use e as a flag but there’s no -e for this command
125
Q

To compress all files in directory Linux

A

7z a test *

126
Q

Windows command to extract a zip file?

A

Expand-Archive filename

127
Q

How to create an archive with 7zip Linux

A

7z a folder.7z filename.txt filename.awk

128
Q

How to create an archive with Zip Linux. How do you do it with a file and then a folder?

A

zip NewfolderName.zip fileName.txt fileName.txt

zip -r folderName.zip fileName.txt folderName
this can overwrite a current zip file and also can use -r to include files in a directory

129
Q

How to see what’s inside a Zip file? Linux

A

zipinfo filename.zip

130
Q

How to create an uncompressed tar archive?

A

tar -cvf filename.tar filetoadd/

131
Q

How to create a tar archive AND compress it?

A

tar -cvzf filename.tar fileNametocompress/

-the -z uses the Gzip default zip tool on Linux

tar -xvIf archiveName.tar fileNametocompress/

-the -I uses bz2

132
Q

How to extract files using Gzip or Bz2?

A

tar -xvzf archiveName.tar.gz

tar -xvIf archiveName.tar.bz2

  • he also used gunzipfor gzip
133
Q

How to view group information on Bash?

A

cat /etc/group

134
Q

create an archive file called file.tar from the three files named file1, file2 and file3

A

tar -cf file.tar file1 file2 file3

135
Q

With what options are tar files created?

A

-c and -f

136
Q

How to create an uncompressed tar file?

A

tar -cf file.tar file1 file2 file3

137
Q

List files included in the archive when creating tar file

A

tar -cvf file.tar file1 file2 file3

(the -v verbose command)

138
Q

How to create tar files from 1+ directories

A

tar -cvf dir.tar dir1 dir2

139
Q

How to create a tar file of every object in current directory (*wildcard)

A

tar -cf *

140
Q

How to remove files being tar archived instead of being copied

A

add
–remove-files

141
Q

Compress a new tar file upon creation
3 ways

A

-j for bzip2
-z for gzip
-Z for compress

example
tar -cvjf files.tar.bz2 file4 file5 file6

142
Q

How to unpack a tar file (different from decompress)

A

tar -xvf file.tar

143
Q

How to decompress a tar file (bzip2 for this example)

A

tar -xjvf files.tar.bz2

(needs both extract command and the program to decompress it’s command)

144
Q

How to add files to an existing tar archive

A

tar -rf file.tar file7

-r and -f are necessary (f to indicate the following string is the name of the archive)

145
Q

Delete specified files from a tar file

A

tar -f file.tar –delete file1 file2

146
Q

How to list contents of an uncompressed tar archive

A

tar -tf file.tar

147
Q

List options available for tar command

A
    • help
148
Q

How to locate software and its dependencies on Windows?

A

find-package -Name

Find-Package -Name packagename -IncludeDependencies

149
Q

How to add a package source? W

A

Register-PackageSource

Register-PackageSource -Name chocolatey -ProviderName chocolatey -Location http://chocolatey.org/api/v2

150
Q

How to verify package source? W

A

Get-PackageSource

151
Q

Install a package

Windows

A

Install-Package -Name packagename

152
Q

Alternate:

Install a package Linux

A

sudo dpkg - -install packagename

153
Q

Update package saved locally Linux

A

sudo dpkg - -update-avail packagename

154
Q

to remove a package Linux

A

sudo dpkg - -remove packagename

155
Q

to purge a package and contents linux

A

sudo dpkg - -purge packagename

156
Q

to get a list of packages installed linux

A

sudo dpkg - -list

157
Q

get a list of all files belonging/associated with a package linux

A

sudo dpkg - -listfiles packagename

158
Q

Windows:
Uninstall a package

A

Uninstall-Package -Name packagename

159
Q

How to install a package with apt?

Linux (apt is for Ubuntu)

A

sudo apt install packagename

160
Q

Remove a package with apt

A

sudo apt remove packagename

161
Q

How to update list of packages in your repository? L

A

apt update

162
Q

How to install/upgrade packages in your repository? L

A

Use apt update first

then use apt upgrade

163
Q

How to learn more about commands with apt?

A

apt - -help

164
Q

How to install millsoftware package from the chocolatey software source?
Windows

A

Install-Package -Name millsoftware -Source chocolatey

165
Q

How to list more detailed contents of uncompressed tar archive?

A

tar -tvf file.tar

the -v gives us more information than just “filename”

166
Q

On Windows, how do you verify that a package was installed?

A

Get-Package -Name packagename

167
Q

How do you check what kernel version you have? L

A

uname -r

168
Q

How to check system information? L

A

uname

169
Q

How to update kernel and other packages? L

A

sudo apt full-upgrade

(run sudo apt update first)

170
Q

What are 2 ways to update the Ubuntu distribution?

A
  1. Update Manager GUI - checks automatically
  2. apt - check for updates manually

apt-get update
apt-get upgrade

171
Q

How would you install “awesomesoftware” from the chocolatey software source? PowerShell

A

Install-Package -Name awesomesoftware -Source chocolatey

172
Q

Linux: Before installing software, always run this command to get an updated version of software

A

sudo apt update

173
Q

How do you install a software package named “boo” on Ubuntu?

A

apt-get install boo

174
Q

How do you verify that a software package was installed on PS?

A

Get-Package -Name TestPackage

175
Q

Which command will show you what Linux kernel version you have?

A

uname -r

176
Q

PS: How do you install a package called “TestPackage”?

A

Install-Package -Name TestPackage

177
Q

What command will update your Linux application sources?

A

sudo apt update

178
Q

How do you install a new version of the Linux Kernel?

A

sudo apt full-upgrade

179
Q

What command will update your Linux application sources?

A

sudo apt update

180
Q

What are the 8 steps to partition/reformat a disk on Windows?

A
  1. Diskpart
  2. list disk
  3. select disk 1
  4. clean
  5. create partition primary
  6. select partition 1
  7. active
  8. format FS=NTFS label=my-usb-drive
181
Q

What command do you use to partition a disk on Linux?

A

parted

182
Q

How do you see what disks are connected to a computer using Linux?

A

sudo parted -l

(el)

183
Q

How do you select the /dev/sdb USB drive to start the partition?

A

sudo parted /dev/sdb

enters interactive mode

184
Q

How do you get out of interactive mode in parted?

A

quit

185
Q

How do you set a disc label while partitioning on Linux?

A

mklabel (partition table name)

186
Q

In Interactive Mode, how do you see disk information on Linux?

A

print

187
Q

What are the 8 steps to partition and format a FS on Linux? (Not mounted yet)

A

(sudo parted -l to see disks available)

  1. sudo parted /dev/sda
  2. print
  3. mklabel (partition table we want)
  4. print
  5. mkpart primary ext4 1MiB 5GiB (partition disk in 2)
  6. quit
  7. sudo mkfs -t ext4 /dev/sda1 to format partition with FS
  8. sudo parted -l
188
Q

In Linux, how do we select the partition table we want in interactive mode?

A

mklabel (partition table)

189
Q

In Linux, how do we partition a disk that’s already been assigned a partition table in interactive mode?

A

mkpart (partitiontype) (FS) (Start) (End)

190
Q

In Linux, how do we format a filesystem on a disk that’s already been partitioned?

A

Out of interactive mode:

sudo mkfs -t (FS type) /dev/sda1

191
Q

How do you unmount a filesystem in Linux?

A

sudo umount (directory name)
or
sudo umount /dev/(name)

192
Q

What command shows us the UUID of block devices on Linux?

A

sudo blkid

193
Q

What are 2 ways to update the Ubuntu distribution via CLI?

A

sudo apt-get update
sudo apt-get upgrade

194
Q

The apt command is for which Linux distribution?

A

Ubuntu

195
Q

What command is used to mount/unmount file systems in Linux? Manually and Automatically

A

Unmount Manually:
sudo umount directory
sudo umount /dev/sdb1

Mount/Unmount automatically:
fstab

196
Q

What does fstab mean? Linux

A

File system table

197
Q

Command to check fstab manual page for the file system in use? Linux

A

man fstab

198
Q

When combined with fdisk, what command do you use to find the list of block devices connected to the system? Linux

A

lsblk

199
Q

How do you make a swap space/swap partition? Linux 7 steps

A

How to make swap space/swap partition (manual)

  1. select target device with sudo parted /dev/sdb
  2. print
  3. mkpart primary linux-swap 5GiB 100%
  4. print
  5. quit
  6. specify it’s a swap space with sudo mkswap /dev/sdb2
  7. enable swap on device with sudo swapon /dev/sdb2
  • auto mount swap space will need an entry in the fs table
200
Q

How do you create a symbolic link for file_1.txt? What program do you use? W

A

use mklink and add symlink

mklink file_1_symlink file_1.txt

use command prompt cmd.exe

201
Q

How do you make a hard link for file_1.txt? What program do you use? W

A

use mklink /H

mklink /H file_1_hardlink file_1.txt

command prompt cmd.exe

202
Q

How do you create a soft link/sim link on Linux?

A

ln -s important_file important_file_softlink

  • -s for soft link
203
Q

How do you create a hard link on Linux?

A

ln important_file important_file_hardlink

  • no -s this time
  • ls -l filename to check hard link count
204
Q

What command on Windows allows us to print out disk usage, how many files it has?

A

disk usage

can also go to disk management
make sure to download the DU tool

205
Q

How to run disk cleanup from command line? W

A

c:\windows\SYSTEM32\cleanmgr.exe /dDrive

Drive = enter drive here

206
Q

How to view disk usage on Linux?

A

du -h

  • if no directory is specified, it defaults to the current one
  • -h means in human-readable form
207
Q

How to view free disk space with command on Linux?

A

df -h

shows you the free space available in your entire machine

208
Q

How to check the status of NTFS self-healing feature?

A

command prompt

fsutil repair query C:

209
Q

How to run the check disk utility tool (serious disk corruption)

A

chkdsk /F D:
in the command prompt

  • by default runs in read-only mode, no changes made
  • can tell it to fix any problems it finds with /F flag
210
Q

On Linux, what command to repair a file system?

A

make sure the file system isn’t mounted (it’ll damage the file system)

sudo fsck /dev/sda

211
Q

An important command-line data recovery tool offered in the Linux operating system

A

fsck

for data corruption repair USE CAUTION look at notes

212
Q

What command displays disk volume, and can be paired with other tools for disk repair?

A

chkdsk

213
Q

How to display an output in human-readable format? Linux

A

-h flag

214
Q

What are two ways to see disks mounted on a system? Linux commands

A
  1. df -h
    - disk free, usually used to see how much free space in the file system. -h for human readable format.
  2. lsblk
    - lists block devices
215
Q

Two ways to display partition information on Linux?

A

You can display partition information using the fdisk command.
OR
You can also use the -l option to list partitions in the block. You can pass a device name to the fdisk command to list the partitions contained in that device.

To list all partitions, use fdisk -l

216
Q

With what command do you stop a process in Windows?

A

taskkill /pid ####

we use the process ID to specify which process

217
Q

What command enables you to get the PID of a process? Windows

A

tasklist

218
Q

What’s the shortcut to open the task manager? Windows

A

CTRL-SHIFT-ESC

219
Q

2 ways to show all running processes in Windows through commands?

A
  1. tasklist
  2. Get-Process
220
Q

How to view running processes on Linux? 2 ways

Explain what the flags mean

A
  1. ps -x
  2. ps -ef

-x gives you a snapshot of all the processes running
-e gives you all processes, including ones started by other users
-f gives you the full details about a process

221
Q

What command do you use to view files that correspond to processes on Linux? How do you get more detailed information about the status of a process?

2 answers

A

ls -l /proc

More info:
cat /proc/PIDnumber/status

222
Q

What command do you use to search through the process output for a particular process?
Linux

A

ps -ef | grep Firefox

223
Q

How do you send a signal to a running process? Windows + Linux

A

CTRL + C

224
Q

How do you terminate a running process in Linux? 2 ways

A
  1. kill PID#

kill command without any flags sends a termination signal SIGTERM. Kills process but gives it time to clean up resources it was using (prevents file corruption)

  1. kill -KILL PID#

kill command with -KILL SIGKILL signal will overkill terminate process (doesn’t let it clean up resources it was using)

225
Q

How do you pause/suspend a process in Linux? 3 ways

A
  1. kill -TSTP PID#
  2. CTRL + Z
  3. CTRL + C
226
Q

With what command do you resume the execution of a process? Linux

A

kill -CONT PID#

227
Q

How do you display the top 3 processes using the most CPU? Windows command

A

Get-Process | Sort CPU -descending | Select -first 3 -Property ID,ProcessName,CPU

228
Q

What command for Linux lets us see the top processes that are using the most resources?

A

top

229
Q

What’s another resource monitoring tool for Linux that shows us the load average of the machine?

A

uptime

230
Q

With what command do you list open files and what processes are using them in Linux?

A

lsof

231
Q

How would you search for a process with a partial match, and a specific match? Windows

A

Specific Match:
Get-Process -Name “pname”

Partial Match:
Get-Process -Name “pname

232
Q

How do you terminate a specific process in Linux?

A

ps -aux | grep “processname”

233
Q

How do you start PuTTY from PowerShell?

A

putty.exe -ssh vanes@ipaddress port#

you input the ip address and user name you want to connect to

234
Q

You’re in vanes\Documents, you want to get to the Desktop which is up one level. What command can you use instead of cd.. then cd Desktop?
Windows

A

cd ..\Desktop

235
Q

When copying over a directory in Windows with a command, what parameter should you use to make sure you copy the contents as well?

A

-Recurse parameter used with cp

copies contents of the directory over

236
Q

What’s a shortcut to change directories to another directory in the current directory? Windows

A

cd .\nameofthedirectoryinthesamedirectory

237
Q

What’s the recursive flag for Linux?

A

-r

example

cp -r ‘filename’ filelocation

238
Q

What’s a shortcut when renaming a file to keep it in the same directory? Windows

A

mv .\bluefile.txt yellowfile.txt

(blue being renamed to yellow but staying in the same directory and also indicating that the file name we want to change is in the same directory)

239
Q

How do you move multiple files?

A

using the asterisk wildcard character

240
Q

When copying a file or directory what needs to go around the filename?

A

single quotes (when copying a directory)

241
Q

On Windows, how do you remove a file and bypass not having permission to remove it?

A

-Force parameter

rm C:\Users\vanes\important_system_file -Force

242
Q

On Windows, how do you remove an entire directory?

A

rm ~\foldername -recursive
or can use

243
Q

What flag/parameter for Windows and Linux do you use to see a text output of the actions being taken?

A

-v for Linux
-Verbose for Windows

244
Q

What’s the Linux equivalent of the more command on Windows?

A

less

q to exit
g to go to the beginning
G to go to the end
/word_search

245
Q

How do you open a program and create a file in one command line?

Windows

A

start programname filename.ext

246
Q

How would you open notepad and Notepad ++ and create a new file in the same line? Windows

A

start Notepad++ textfile.txt

notepad filename

247
Q

With what command and flag would you be able to see file ownership and permissions on Linux?

A

ls -l

(ls el)

248
Q

What is the command you use in Linux to copy files between computers on a network? What’s an example of this command in use?

A

scp (filename want to transfer) (useracc/hostname want to send to)@IPaddress:

scp /home/cindy/Desktop/myfile.txt cindy@104.131.122.215:

249
Q

What’s an example command of using PuTTY’s secure copy client to transfer the desktop file my_file.txt to cindy’s Linux workstation from Windows?

A

pscp.exe ~\Desktop\my_file.txt cindy@101.43.11.892:

250
Q

What command lets you share folders on Windows?

A

net share

251
Q

Show an example of using the folder share command on Windows to share a folder called ShareMe with everyone, giving them full permissions

A

net share ShareMe=C:\Users\cindy\Desktop\ShareMe /grant:everyone,full

252
Q

Besides transferring files, what else does the net share command show us? Windows

A

Shows us what folders are currently being shared on your computer

253
Q

What’s the Linux command to copy files from a storage device? (imaging a machine)

A

dd

sudo dd if=/dev/sdd of=~/Desktop/my_usb_image.img bs=100M

This just says that she’s going to copy the contents of /dev/sdd (the USB drive) and save it to the desktop in an image file

254
Q

How do you run Error Checking (check disk) from the command line on Windows?

A

chkdsk /f

/f means to fix any issues that come up

255
Q

How do you format a drive from the command line on Windows?

A

format drive [/v:label]

format p: /fs:exfat /v:my_thumb_drive

256
Q

How do you record a group of commands as they’re being issued along with the output on Windows from the command line?

[Documents your steps and process in order to revert any changes and when you’re not sure how exactly you’ll be fixing an issue]

A

Start-Transcript

257
Q

What’s the command to install an SSH client on a machine you’re connecting from? (for remote connection on Linux)

A

sudo apt-get install openssh-client

258
Q

What’s the command to install an SSH server on the machine you’re connecting to to establish a remote connection on Linux?

A

sudo apt-get install openssh-server

259
Q

In Linux, how do you ping a website to check your internet connection?

A

ping www.google.com

260
Q

How do you access a local host file on Linux?

A

sudo /etc/hosts

261
Q

In Linux, how do you get the name server of a host or domain name?

A

nslookup www.google.com

262
Q

How do you check if a daemon is running on the machine? Linux

A

service ntp status

ntp = network time protocol for this example

263
Q

How do you stop, start, and restart a daemon/service in Linux?

A

sudo service ntp stop
sudo service ntp start
sudo service ntp restart

ntp = network time protocol

264
Q

Windows: How do you get the status of a running service?

A

Get-Service wuauserv

windows update service in this example

265
Q

Windows: To get more information on a service (type, configuration)

A

Get-Service wuauserv | Format-List *

windows update service in this example

266
Q

Windows: How to stop a service (admin)

A

Stop-Service wuauserv

windows update service in this example

267
Q

Windows: How to start a service (admin)

A

Start-Service wuauserv

windows update service in this example

268
Q

Windows: How to list all services that are registered in the system (admin)

A

Get-Service

windows update service in this example

269
Q

How do you install a service on Linux?

A

sudo apt install servicename

270
Q

How to query the status of a service in Linux?

A

service servicename status

271
Q

How do you connect to an ftp server with the lftp client on Linux?

A

lftp localhost

272
Q

How do you edit the configuration file for a service in Linux?

A

sudo vim /etc/vsftpd.config

the service is vsftpd (a simple FTP server)

273
Q

How do you join a computer to AD via PowerShell?

A

Add-Computer -DomainName ‘example.com’ -Server ‘dcl’

274
Q

How do you get the AD version of DA via PowerShell?

A

Get-AdForest
then
Get-AdDomain

275
Q

How do you open GPMC via CLI on Windows? (Group Policy Management)

A

gpmc.msc