Commands - Review Flashcards
Search which subdirectories are in a directory that match a word.
Linux
ls -la /locationtosearch | grep wordtomatch
Find files with a specific word.
Linux
grep -rw /home/user/Downloads -e “vacation”
How do you search for a word in multiple files
L
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 do you search for a word in a file. L
grep oranges fruit.txt
To create a new file with default permissions L
touch test_file.txt
How do you create/modify a text file using the popular text editor that can be found on nearly all Linux distributions?
nano my_file
Can create and modify a text file in the command line
To make a text file in Linux with a redirector
cat > (name of file)
ENTER key, then type text, then save file with CTRL + D
Find files with a specific word L
grep -rw /home/user/Downloads -e “vacation”
**having issues with this one, it won’t find my “file” files in a subdirectory
What’s the main way I should use to search for which subdirectories or files match a word? L
ls -la /locationtosearch | grep wordtomatch
L: options available for a command
(command) –help
extra information about commands - manual pages
Linux
man (command)
long list format (something is too long, make it readable and organized with this command, more detail)
Linux
-l
show all files in a directory and hidden files flag
Linux
-a
hide a file or directory
Linux
.(in front of file or directory)
current directory
pwd
change directory 3 ways
cd
cd ..
cd ~
make a new directory
mkdir
copy a file/directory 3 ways
cp filename.ext location
pattern copies: cp *.png ~/Desktop
directory copies (inside contents): cp -r ‘Cat Pictures’ ~/Desktop
moving a file
mv filename.txt locationtomoveto
to make a text file with a redirector and enter text right away
cat > (name of file)
ENTER, type text, save with CTRL +D
view text files 2 ways
l/w
cat
less
-g
-G
-/word_search
-q
more (windows)
flags/parameters that can be used with cat when to view certain lines? 2
-Head Line#
-Tail Line#
modifying text file (create a new one with nano) and enter text right away
nano my_file
how do you search for a word in one file?
linux
grep word filename.ext
how do you search for a word in multiple files? 3 ways
linux
grep word *_filename.extension
grep word *.extension
grep word filename filename filename
How do you filter the standard error output into a linux black hole?
shows just the output, no errors
/dev/null
less /var/log/syslog 2> /dev/null
search which subdirectories are in a directory that match a word
la -la /directorytosearch | grep wordtomatch
command line and shortcut to copy/move files to current directory
mv (path to file to move) .
find files with a specific word
linux
grep -rw /home/user/Downloads -e “vacation”
create a new file with default permissions no typing text
linux
touch filename.txt
how to open a file with nano (or creates a new one)
nano path/to/existing/file or nano filename.txt
run a command that requires root privilege
sudo (command) file/path
sudo su -
then re-do command after getting root powers
view memberships for all groups - who can access run sudo
cat /etc/group
(4 fields separated by colons)
view user information on our local machine
linux
/etc/password
two ways to search for a word in a file (and filename) in a specific directory
linux
grep -rw /file/location -e “word”
ls /file/location | grep word -r
how to get detailed listing directories? w
Get-Help ls
Get-Help ls -Full
how to show hidden files in a directory? w
ls -Force (directory or drive name)
how to show what directory you’re in?
pwd
how to change your directory up one level and up one level to a specific directory?
up one level:
cd ..
a specific directory:
cd ../directoryabove on linux
cd ..\directoryabove on windows
What’s a shortcut to change to the home folder in windows?
cd ~
What’s a shortcut to change to the Desktop? both
~/Desktop
~\Desktop
What does the tilde ~ mean? What about ~\?
tilde ~ means the user’s home directory
~/ means a directory path below the home directory
~\
What are the escaped commands for windows and linux that replace special character such as spaces and brackets?
windows: ` back tick
spaces: single quotes, underscores
Linux: \ backslash
see a list of previously entered commands
how to search through results shortcut?
history
ctrl + r to search through previous commands
whats an alternative to older powershells to search through previous commands lists in history?
+tab to cycle
to copy a file
cp file filedestination
how do you copy multiple files? both
use a wildcard asterisk to select multiple files that match a pattern
cp *.jpg copydestinationpath
how do you copy a directory? windows
cp ‘directoryname’ targetdestination -Recurse -Verbose
how to rename a file?
mv .\filename newfilename
the .\ tells it that you don’t want to move the file in the current directory, just rename it
How to move a file?
mv filename filelocation
How to move multiple files?
wildcard * to select multiple
mv *filename targetlocation
ex:
mv *_document.txt ~\Documents
How do you remove a file
rm or remove
How do you remove a system file and bypass warning?
add the -Force flag at the end
rm importantfilelocation -Force
How do you remove a folder?
use -recursive
rm ~\foldername -recursive
removing a file, folder… whats a shortcut to the file path instead of the absolute?
rm ~\filename
add -recursive flag if removing a folder
how to view contents of a file? 2
linux and windows
cat filename
auto changes to cat .\filename
windows: more largedocument
linux: less largedocument
on windows using cat, what 2 parameters can we use to see only first and last few lines of text?
-Head #oflines
-Tail #oflines
How to view large output text files on Windows in pages and how do you navigate?
more largedocument
ENTER advance by line
SPACE advance by page
Q exit
how to open a text editor program and create a file
windows
start texteditor filename
example: start Notepad++ filename
how do you see what the actual powershell command of a command is?
Get-Alias
what’s the cmd.exe version of Get-Help?
\?
how do you search for words in a file, a type of file, or a directory on the entire computer?
windows
sls or Select-String
Select-String word filename.txt
Select-String word *.txt
how do you search for a pattern within a specific directory?
windows
ls ‘directorypath’ -Recurse -Filter *pattern
ls ‘D:\Program Files' -Recurse -Filter *.exe
how do you change standard output to display in a new or existing file by overwriting?
windows
echo outputcontentforfile > filename.txt
How to change the standard output to add onto an existing file, no overwriting?
windows
> > -Append
echo outputcontentforfile»_space; existingfilename.txt
How to send the output of one command into the input of another?
windows
cat filetosearch | Select-String wordtosearchfilefor
takes output of cat, inputs it to sls to search for the word
pipe
How do you search for a word in one file?
windows
cat filetosearch | Select-String wordtosearchinfile
how to use pipe operator to save standard output of a word search of a file to a new file or overwrite one?
windows
cat filetosearch | Select-String wordtosearchfor > filename
How to redirect standard error stream to a text file?
2>
rm secure_file.txt 2> filenameforerror.txt
How to filter out standard error stream messages?
Windows (redirect error stream to a black hole)
$null
example:
rm securefile.txt 2> $null
How do you get input from a file and not the keyboard?
< less than
example:
cat < fileinput.txt
same as cat fileinput.txt
how do you see a list of users and groups on the computer?
Windows
- Get-LocalUser
- Get-LocalGroup
- Get-LocalGroupMember
What’s the alias for cat?
Get-Content
How do you change your password on Linux?
passwd
How to make the user change their password on next logon linux
sudo passwd -e username
To remove a user on Linux?
sudo userdel username
To add a user on Linux?
sudo useradd username
How do you remove a user on Windows? 2 ways
net user username /del
Remove-LocalUser username
How to create an acct that requires logon password change in same command line windows?
net user username pa5sw0rd /add /logonpasswordchg:yes
How do you add a new user? windows
net user username * /add
net user username ‘some_password’ BUT THIS IS NOT SECURE do not use this
How do you require a next logon password change? windows
net user username /logonpasswordchg:yes
How do you view file permissions in Linux?
ls -l ~/my_file
for me it worked like this:
ls -l dog.txt
How do you see ACL assigned to a file/permissions? Windows
icacls filefolderpath
icacls /? for help
How do you modify a file/folder permission in the CLI? Windows
icacls ‘C:\Vacation Pictures\’ /grant ‘Everyone:(OI)(CI)(R)’
How do you only let non-guest users see a file or folder? w
icacls ‘filepath’ /grant ‘Authenticated Users: (OI)(CI)(R)’
How do you remove file permissions for a group? w
icacls ‘filepath’ /remove Everyone
How do you change permissions in Linux?
- Pick which permission you want to change (owner is u, group is g, other users is o )
- 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 do you remove a permission to a file?
chmod u-x filename
How do you add multiple permissions to a file? Read and Exec Linux
chmod u+rx filename
How do you set numerical permissions for 3 permission sets for a file in Linux?
chmod 746 filename
combination of adding up permissions: r,w,x = 4,2,1
How do you change the owner of a file? Linux
sudo chown username filename
How do you change the group a file belongs to? Linux
sudo chgrp groupname filename
To view special permissions for a file in the CLI
w
icacls filelocation
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
Do a setuid special permission
sudo chmode 4441 filename
sudo chmode u+s filename
(the first 4 is the setuid)
How do you see user/group permissions for when you would run the passwd command?
ls -l /usr/bin/passwd
What are two ways to implement the setgid Linux permission for a file?
- sudo chmod g+s filename
- sudo chmod 2551 filename
(2 is the setgid)
How would you look at the permissions for the temp directory, and how to make it display just the directory not the contents?
Linux
ls -ld /tmp
How to list permissions for a folder but only show directory info, not contents
Linux
ls -ld /tmp
What are the symbolic and numerical versions of the special permissions for a sticky bit?
Symbolic - t
Numeric - 1
How do you create a file not a folder in PowerShell? 2 ways
start Notepad++ filename.txt
Notepad filename.txt
How do you force PS to bypass warning and delete the directory?
rm filename -Force
What’s the position of Get-Alias in a command line?
Get-Alias commandname
What command do you use to search for a pattern in a specific directory?
ls
example:
ls ‘filename’ -Recurse -Filter *patterntosearch
How do you modify the ACL in PS to allow read access to a single user?
icacls filename /grant ‘Username:(R)’
What’s the difference between chmod and chown?
chmod is for modifying permissions
chown is for modifying owner
What is the name of the privileged file on Linux that stores scrambled passwords?
/etc/shadow
Name 3 ways an Admin can remove users on PS
- net user username /del
- Remove-LocalUser username
- GUI > Local Users and Groups in Computer Management > Right click user > Del
In Windows, when setting basic permissio n “Read” which special permissions are enabled? 3
- Read data
- Read Permissions
- Read attributes
What’s the easiest way to make a document public/accessible to everyone?
Add the desired permission (read) to the “Everyone” group
icacls filename /grant “Everyone:(r)”
How to add a file permission to a specific user windows?
icacls filename /grant “username:(r)(w)(x)”
How to remove a file permission for a specific user Windows?
icacls filename /remove “username”
How to grant everyone (owner, group, other users) all permissions using symbolic format and numerical?
sudo chmod a+rwx filename
or
sudo chmod 777 filename
To install an executable file from PS?
type in the absolute path OR change directory to file and type in filename
What are the 7 commands for self-extracting executables?
- /extract:[path] extracts the content of package to the path folder. If no path provided, Browse box appears
- /log:[path to log file] enables verbose logging (more detailed info recorded in log file) for the update installation
- /lang:lcid sets user interface to specified locale when multiple locales are in the package
- /quiet runs package in silent mode
- /passive runs update without any interaction from user
- /norestart prevents prompting user when a restart is needed
- /forcerestart forces a restart of the computer as soon as the update is finished
What’s the command to install a debian package on Ubuntu?
sudo dpkg -i filepath
-i for install
How to remove a program from Ubuntu?
sudo dpkg -r programname
How to list debian packaged installed on machine
dpkg -l
- -l for list
Search for a program you installed ubuntu
dpkg -l | grep atom
or
dpkg -s packagename
Force an update of the package manager (for a program)
after using dpkg -s programname if its out of date:
sudo apt-get install -f
Update program repositories
sudo apt-get update
Install a program from the Linux repository
sudo apt-get install program/packagename
To remove a program Linux
sudo apt-get remove programname
Command to extract and compress files Windows
Compress-Archive -Path C:\Users\cindy\Desktop\CoolFiles\ ~\Desktop\CoolArchive.zip
Extract file using 7 Zip Linux
7z e filepath
- she said to use e as a flag but there’s no -e for this command
To compress all files in directory Linux
7z a test *
Windows command to extract a zip file?
Expand-Archive filename
How to create an archive with 7zip Linux
7z a folder.7z filename.txt filename.awk
How to create an archive with Zip Linux. How do you do it with a file and then a folder?
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
How to see what’s inside a Zip file? Linux
zipinfo filename.zip
How to create an uncompressed tar archive?
tar -cvf filename.tar filetoadd/
How to create a tar archive AND compress it?
tar -cvzf filename.tar fileNametocompress/
-the -z uses the Gzip default zip tool on Linux
tar -xvIf archiveName.tar fileNametocompress/
-the -I uses bz2
How to extract files using Gzip or Bz2?
tar -xvzf archiveName.tar.gz
tar -xvIf archiveName.tar.bz2
- he also used
gunzip
for gzip
How to view group information on Bash?
cat /etc/group
create an archive file called file.tar from the three files named file1, file2 and file3
tar -cf file.tar file1 file2 file3
With what options are tar files created?
-c and -f
How to create an uncompressed tar file?
tar -cf file.tar file1 file2 file3
List files included in the archive when creating tar file
tar -cvf file.tar file1 file2 file3
(the -v verbose command)
How to create tar files from 1+ directories
tar -cvf dir.tar dir1 dir2
How to create a tar file of every object in current directory (*wildcard)
tar -cf *
How to remove files being tar archived instead of being copied
add
–remove-files
Compress a new tar file upon creation
3 ways
-j for bzip2
-z for gzip
-Z for compress
example
tar -cvjf files.tar.bz2 file4 file5 file6
How to unpack a tar file (different from decompress)
tar -xvf file.tar
How to decompress a tar file (bzip2 for this example)
tar -xjvf files.tar.bz2
(needs both extract command and the program to decompress it’s command)
How to add files to an existing tar archive
tar -rf file.tar file7
-r and -f are necessary (f to indicate the following string is the name of the archive)
Delete specified files from a tar file
tar -f file.tar –delete file1 file2
How to list contents of an uncompressed tar archive
tar -tf file.tar
List options available for tar command
- help
How to locate software and its dependencies on Windows?
find-package -Name
Find-Package -Name packagename -IncludeDependencies
How to add a package source? W
Register-PackageSource
Register-PackageSource -Name chocolatey -ProviderName chocolatey -Location http://chocolatey.org/api/v2
How to verify package source? W
Get-PackageSource
Install a package
Windows
Install-Package -Name packagename
Alternate:
Install a package Linux
sudo dpkg - -install packagename
Update package saved locally Linux
sudo dpkg - -update-avail packagename
to remove a package Linux
sudo dpkg - -remove packagename
to purge a package and contents linux
sudo dpkg - -purge packagename
to get a list of packages installed linux
sudo dpkg - -list
get a list of all files belonging/associated with a package linux
sudo dpkg - -listfiles packagename
Windows:
Uninstall a package
Uninstall-Package -Name packagename
How to install a package with apt?
Linux (apt is for Ubuntu)
sudo apt install packagename
Remove a package with apt
sudo apt remove packagename
How to update list of packages in your repository? L
apt update
How to install/upgrade packages in your repository? L
Use apt update first
then use apt upgrade
How to learn more about commands with apt?
apt - -help
How to install millsoftware package from the chocolatey software source?
Windows
Install-Package -Name millsoftware -Source chocolatey
How to list more detailed contents of uncompressed tar archive?
tar -tvf file.tar
the -v gives us more information than just “filename”
On Windows, how do you verify that a package was installed?
Get-Package -Name packagename
How do you check what kernel version you have? L
uname -r
How to check system information? L
uname
How to update kernel and other packages? L
sudo apt full-upgrade
(run sudo apt update first)
What are 2 ways to update the Ubuntu distribution?
- Update Manager GUI - checks automatically
- apt - check for updates manually
apt-get update
apt-get upgrade
How would you install “awesomesoftware” from the chocolatey software source? PowerShell
Install-Package -Name awesomesoftware -Source chocolatey
Linux: Before installing software, always run this command to get an updated version of software
sudo apt update
How do you install a software package named “boo” on Ubuntu?
apt-get install boo
How do you verify that a software package was installed on PS?
Get-Package -Name TestPackage
Which command will show you what Linux kernel version you have?
uname -r
PS: How do you install a package called “TestPackage”?
Install-Package -Name TestPackage
What command will update your Linux application sources?
sudo apt update
How do you install a new version of the Linux Kernel?
sudo apt full-upgrade
What command will update your Linux application sources?
sudo apt update
What are the 8 steps to partition/reformat a disk on Windows?
- Diskpart
- list disk
- select disk 1
- clean
- create partition primary
- select partition 1
- active
- format FS=NTFS label=my-usb-drive
What command do you use to partition a disk on Linux?
parted
How do you see what disks are connected to a computer using Linux?
sudo parted -l
(el)
How do you select the /dev/sdb USB drive to start the partition?
sudo parted /dev/sdb
enters interactive mode
How do you get out of interactive mode in parted?
quit
How do you set a disc label while partitioning on Linux?
mklabel (partition table name)
In Interactive Mode, how do you see disk information on Linux?
What are the 8 steps to partition and format a FS on Linux? (Not mounted yet)
(sudo parted -l to see disks available)
- sudo parted /dev/sda
- mklabel (partition table we want)
- mkpart primary ext4 1MiB 5GiB (partition disk in 2)
- quit
- sudo mkfs -t ext4 /dev/sda1 to format partition with FS
- sudo parted -l
In Linux, how do we select the partition table we want in interactive mode?
mklabel (partition table)
In Linux, how do we partition a disk that’s already been assigned a partition table in interactive mode?
mkpart (partitiontype) (FS) (Start) (End)
In Linux, how do we format a filesystem on a disk that’s already been partitioned?
Out of interactive mode:
sudo mkfs -t (FS type) /dev/sda1
How do you unmount a filesystem in Linux?
sudo umount (directory name)
or
sudo umount /dev/(name)
What command shows us the UUID of block devices on Linux?
sudo blkid
What are 2 ways to update the Ubuntu distribution via CLI?
sudo apt-get update
sudo apt-get upgrade
The apt command is for which Linux distribution?
Ubuntu
What command is used to mount/unmount file systems in Linux? Manually and Automatically
Unmount Manually:
sudo umount directory
sudo umount /dev/sdb1
Mount/Unmount automatically:
fstab
What does fstab mean? Linux
File system table
Command to check fstab manual page for the file system in use? Linux
man fstab
When combined with fdisk, what command do you use to find the list of block devices connected to the system? Linux
lsblk
How do you make a swap space/swap partition? Linux 7 steps
How to make swap space/swap partition (manual)
- select target device with sudo parted /dev/sdb
- mkpart primary linux-swap 5GiB 100%
- quit
- specify it’s a swap space with sudo mkswap /dev/sdb2
- enable swap on device with sudo swapon /dev/sdb2
- auto mount swap space will need an entry in the fs table
How do you create a symbolic link for file_1.txt? What program do you use? W
use mklink and add symlink
mklink file_1_symlink file_1.txt
use command prompt cmd.exe
How do you make a hard link for file_1.txt? What program do you use? W
use mklink /H
mklink /H file_1_hardlink file_1.txt
command prompt cmd.exe
How do you create a soft link/sim link on Linux?
ln -s important_file important_file_softlink
- -s for soft link
How do you create a hard link on Linux?
ln important_file important_file_hardlink
- no -s this time
- ls -l filename to check hard link count
What command on Windows allows us to print out disk usage, how many files it has?
disk usage
can also go to disk management
make sure to download the DU tool
How to run disk cleanup from command line? W
c:\windows\SYSTEM32\cleanmgr.exe /dDrive
Drive = enter drive here
How to view disk usage on Linux?
du -h
- if no directory is specified, it defaults to the current one
- -h means in human-readable form
How to view free disk space with command on Linux?
df -h
shows you the free space available in your entire machine
How to check the status of NTFS self-healing feature?
command prompt
fsutil repair query C:
How to run the check disk utility tool (serious disk corruption)
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
On Linux, what command to repair a file system?
make sure the file system isn’t mounted (it’ll damage the file system)
sudo fsck /dev/sda
An important command-line data recovery tool offered in the Linux operating system
fsck
for data corruption repair USE CAUTION look at notes
What command displays disk volume, and can be paired with other tools for disk repair?
chkdsk
How to display an output in human-readable format? Linux
-h flag
What are two ways to see disks mounted on a system? Linux commands
- df -h
- disk free, usually used to see how much free space in the file system. -h for human readable format. - lsblk
- lists block devices
Two ways to display partition information on Linux?
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
With what command do you stop a process in Windows?
taskkill /pid ####
we use the process ID to specify which process
What command enables you to get the PID of a process? Windows
tasklist
What’s the shortcut to open the task manager? Windows
CTRL-SHIFT-ESC
2 ways to show all running processes in Windows through commands?
- tasklist
- Get-Process
How to view running processes on Linux? 2 ways
Explain what the flags mean
- ps -x
- 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
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
ls -l /proc
More info:
cat /proc/PIDnumber/status
What command do you use to search through the process output for a particular process?
Linux
ps -ef | grep Firefox
How do you send a signal to a running process? Windows + Linux
CTRL + C
How do you terminate a running process in Linux? 2 ways
- 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)
- kill -KILL PID#
kill command with -KILL SIGKILL signal will overkill terminate process (doesn’t let it clean up resources it was using)
How do you pause/suspend a process in Linux? 3 ways
- kill -TSTP PID#
- CTRL + Z
- CTRL + C
With what command do you resume the execution of a process? Linux
kill -CONT PID#
How do you display the top 3 processes using the most CPU? Windows command
Get-Process | Sort CPU -descending | Select -first 3 -Property ID,ProcessName,CPU
What command for Linux lets us see the top processes that are using the most resources?
top
What’s another resource monitoring tool for Linux that shows us the load average of the machine?
uptime
With what command do you list open files and what processes are using them in Linux?
lsof
How would you search for a process with a partial match, and a specific match? Windows
Specific Match:
Get-Process -Name “pname”
Partial Match:
Get-Process -Name “pname”
How do you terminate a specific process in Linux?
ps -aux | grep “processname”
How do you start PuTTY from PowerShell?
putty.exe -ssh vanes@ipaddress port#
you input the ip address and user name you want to connect to
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
cd ..\Desktop
When copying over a directory in Windows with a command, what parameter should you use to make sure you copy the contents as well?
-Recurse parameter used with cp
copies contents of the directory over
What’s a shortcut to change directories to another directory in the current directory? Windows
cd .\nameofthedirectoryinthesamedirectory
What’s the recursive flag for Linux?
-r
example
cp -r ‘filename’ filelocation
What’s a shortcut when renaming a file to keep it in the same directory? Windows
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)
How do you move multiple files?
using the asterisk wildcard character
When copying a file or directory what needs to go around the filename?
single quotes (when copying a directory)
On Windows, how do you remove a file and bypass not having permission to remove it?
-Force parameter
rm C:\Users\vanes\important_system_file -Force
On Windows, how do you remove an entire directory?
rm ~\foldername -recursive
or can use
What flag/parameter for Windows and Linux do you use to see a text output of the actions being taken?
-v for Linux
-Verbose for Windows
What’s the Linux equivalent of the more command on Windows?
less
q to exit
g to go to the beginning
G to go to the end
/word_search
How do you open a program and create a file in one command line?
Windows
start programname filename.ext
How would you open notepad and Notepad ++ and create a new file in the same line? Windows
start Notepad++ textfile.txt
notepad filename
With what command and flag would you be able to see file ownership and permissions on Linux?
ls -l
(ls el)
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?
scp (filename want to transfer) (useracc/hostname want to send to)@IPaddress:
scp /home/cindy/Desktop/myfile.txt cindy@104.131.122.215:
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?
pscp.exe ~\Desktop\my_file.txt cindy@101.43.11.892:
What command lets you share folders on Windows?
net share
Show an example of using the folder share command on Windows to share a folder called ShareMe with everyone, giving them full permissions
net share ShareMe=C:\Users\cindy\Desktop\ShareMe /grant:everyone,full
Besides transferring files, what else does the net share command show us? Windows
Shows us what folders are currently being shared on your computer
What’s the Linux command to copy files from a storage device? (imaging a machine)
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
How do you run Error Checking (check disk) from the command line on Windows?
chkdsk /f
/f means to fix any issues that come up
How do you format a drive from the command line on Windows?
format drive [/v:label]
format p: /fs:exfat /v:my_thumb_drive
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]
Start-Transcript
What’s the command to install an SSH client on a machine you’re connecting from? (for remote connection on Linux)
sudo apt-get install openssh-client
What’s the command to install an SSH server on the machine you’re connecting to to establish a remote connection on Linux?
sudo apt-get install openssh-server
In Linux, how do you ping a website to check your internet connection?
ping www.google.com
How do you access a local host file on Linux?
sudo /etc/hosts
In Linux, how do you get the name server of a host or domain name?
nslookup www.google.com
How do you check if a daemon is running on the machine? Linux
service ntp status
ntp = network time protocol for this example
How do you stop, start, and restart a daemon/service in Linux?
sudo service ntp stop
sudo service ntp start
sudo service ntp restart
ntp = network time protocol
Windows: How do you get the status of a running service?
Get-Service wuauserv
windows update service in this example
Windows: To get more information on a service (type, configuration)
Get-Service wuauserv | Format-List *
windows update service in this example
Windows: How to stop a service (admin)
Stop-Service wuauserv
windows update service in this example
Windows: How to start a service (admin)
Start-Service wuauserv
windows update service in this example
Windows: How to list all services that are registered in the system (admin)
Get-Service
windows update service in this example
How do you install a service on Linux?
sudo apt install servicename
How to query the status of a service in Linux?
service servicename status
How do you connect to an ftp server with the lftp client on Linux?
lftp localhost
How do you edit the configuration file for a service in Linux?
sudo vim /etc/vsftpd.config
the service is vsftpd (a simple FTP server)
How do you join a computer to AD via PowerShell?
Add-Computer -DomainName ‘example.com’ -Server ‘dcl’
How do you get the AD version of DA via PowerShell?
Get-AdForest
then
Get-AdDomain
How do you open GPMC via CLI on Windows? (Group Policy Management)
gpmc.msc