Title: 544
Tags: lec2

Q: what is a program you can use to run shell programs on another machine?
A: ssh

Q: what is the technical term for "folder"?
A: "directory" -- "d" shows up in many acronyms/commands for this reason (pwd, cd, etc)

Q: What Linux command tells you see what directory you're in?
A: pwd

Q: What Linux command shows you all the contents of a directory?
A: ls

Q: How do you create a new empty file, file.txt?
A: touch file.txt

Q: What Linux command do you use to install software on Ubuntu?
A: apt

Q: What is a Linux command you can use to download from a URL to a file on your computer?
A: wget SOME_URL
(curl is a similar tool)

Q: What Linux command lets you rename a file?
A: mv name1.txt name2.txt
It also lets you move a file, like this:
mv name.txt somedir

Q: How can you copy from file A to file B?
A: cp A B

Q: What Linux command lets you copy files between computers?
A: scp

Q: What Linux command lets you see everything in a file?
A: cat

Q: What Linux commands let you see just the start or end of a file?
A: head file.txt
tail file.txt

Q: What Linux command creates a new directory?
A: mkdir somedir

Q: What command lets you see entries in the Linux manual?
A: man SOMECOMMAND

Q: How do you navitage to a new directory?
A: cd SOMEDIR

Q: How do you run commands as the root user?
A: sudo COMMAND

Q: What Linux command lets you change the access permissions on a file?
A: chmod

Q: Given a program name, how can you find where it is on your computer?
A: which PROGRAMNAME

Q: How can you see an environment variable (for example, PATH)?
A: echo $PATH

Q: How can you pipe the standard output of A to the standard input of B?
A: A | B

Q: How do you redirect the standard output of A to file.txt, creating file.txt (or replacing any prior content)?
A: A > file.txt

Q: How do you redirect the standard output of A to file.txt, creating file.txt (or appending to the end of any prior content)?
A: A >> file.txt

Q: How do you send BOTH standard output and standard error to a file?
A: myprogram &> file.txt

Q: What programs counts lines, words, and characters?
A: wc

Q: What program filters standard input, writing matching lines to standard output?
A: grep

Q: What program recursively finds directories and files?
A: find

Q: How can you run a program asyncronously?  (meaning you can type other things on the prompt while waiting for it to finish)
A: longprogram &

Q: How can you see running programs and their PIDs?  (process IDs)
A: ps
To see more:
ps ax
a=other users
x=not just processes attached to a terminal

Q: How do you kill a process by its PID number?
A: kill PID

Q: How do you kill a process by its name?
A: pkill NAME

Q: How can you see CPU and memory usage on your machine?
A: htop

Q: What Linux command shows you disk utilization?
A: df
("df -h" shows human readable)

Q: What command shows you disk usage by everything in the current directory?
A: du -hs .

Q: How can you see most port numbers being used by processes on your machine?
A: sudo lsof -i tcp -P