Add wip lab 3
This commit is contained in:
151
lab-1/LAB-REPORT.md
Normal file
151
lab-1/LAB-REPORT.md
Normal file
@ -0,0 +1,151 @@
|
||||
# Lab 1
|
||||
## Tasks
|
||||
|
||||
- [x] 1. **Connect**
|
||||
```
|
||||
I ran the commands from VirtualBox
|
||||
```
|
||||
- [x] 2. **Explore**
|
||||
```
|
||||
I ran the sample commands
|
||||
```
|
||||
- [x] 3. **Play**
|
||||
- [x] grep
|
||||
```sh
|
||||
vboxuser@ubel:~/lab-1$ vim extra/folders/example.txt
|
||||
vboxuser@ubel:~/lab-1$ grep -i "Error" syslog
|
||||
this is an error i am an error!
|
||||
yeah I am another error!
|
||||
vboxuser@ubel:~/lab-1$ grep -ir "Error" syslog
|
||||
this is an error i am an error!
|
||||
yeah I am another error!
|
||||
vboxuser@ubel:~/lab-1$ ls
|
||||
extra syslog
|
||||
vboxuser@ubel:~/lab-1$ ls
|
||||
extra syslog
|
||||
vboxuser@ubel:~/lab-1$ grep -r "error" syslog
|
||||
this is an error i am an error!
|
||||
yeah I am another error!
|
||||
vboxuser@ubel:~/lab-1$ ls
|
||||
extra syslog
|
||||
vboxuser@ubel:~/lab-1$ cat extra/folders/example.txt
|
||||
error I am a file
|
||||
hello world
|
||||
i am not an
|
||||
but this is an error!
|
||||
vboxuser@ubel:~/lab-1$ grep -r "error" .
|
||||
./extra/folders/example.txt:error I am a file
|
||||
./extra/folders/example.txt:but this is an error!
|
||||
./syslog:this is an error i am an error!
|
||||
./syslog:yeah I am another error!
|
||||
vboxuser@ubel:~/lab-1$ grep -rc "error" .
|
||||
./extra/folders/example.txt:2
|
||||
./syslog:2
|
||||
vboxuser@ubel:~/lab-1$ grep -ra "error" .
|
||||
./extra/folders/example.txt:error I am a file
|
||||
./extra/folders/example.txt:but this is an error!
|
||||
./syslog:this is an error i am an error!
|
||||
./syslog:yeah I am another error!
|
||||
vboxuser@ubel:~/lab-1$ grep -rb "error" .
|
||||
./extra/folders/example.txt:0:error I am a file
|
||||
./extra/folders/example.txt:48:but this is an error!
|
||||
./syslog:0:this is an error i am an error!
|
||||
./syslog:47:yeah I am another error!
|
||||
```
|
||||
- [x] tail
|
||||
Displays the end of the file -- if you add -f (for follow),
|
||||
you can display the contents indefinitely. It is fun to snoop
|
||||
on bots who are trying to log into my server, and this command is useful
|
||||
for that.
|
||||
```sh
|
||||
sudo tail -f /var/log/auth.log
|
||||
```
|
||||
|
||||
- [x] man
|
||||
Better than Google when you have no internet connection
|
||||
or access to chatGPT. Holds an exhaustive (I assume) list of
|
||||
available commands.
|
||||
```sh
|
||||
man grep
|
||||
man man
|
||||
```
|
||||
|
||||
- [x] history
|
||||
Shows command history. I would usually use zsh and, if I needed to run a
|
||||
command, I would just press the "up" arrow. That is very tedious if
|
||||
I need to run something that I did > 5 commands ago. This is very useful
|
||||
if I needed to run an obscure command. Or maybe to just figure out what I did.
|
||||
```sh
|
||||
history
|
||||
history | grep "tail"
|
||||
man history
|
||||
```
|
||||
|
||||
- [x] df
|
||||
Never used this command before. I randomly decided to check this on both MacOS
|
||||
(my computer is always running out of space for some reason or other)
|
||||
as well as on one of my linux boxes.
|
||||
|
||||
There are a lot of differences. Feels like more similarities than differences,
|
||||
but a lot of the important columns are the same. It's also a good command
|
||||
for keeping an eye on the mounted volumes on my linux box.
|
||||
|
||||
Also, since the two commands are so different, I don't think I'll ever be able
|
||||
to remember them!
|
||||
|
||||
Stands for "disk free".
|
||||
```sh (on Mac)
|
||||
df (display free disk space)
|
||||
df -h
|
||||
```
|
||||
```sh (on VM Ubuntu)
|
||||
df (report file system space usage)
|
||||
df -h
|
||||
```
|
||||
- [x] du
|
||||
Displays file usage. Should use this to investigate where all the space
|
||||
on my local Mac is going.
|
||||
|
||||
```sh
|
||||
man du
|
||||
du -hS
|
||||
du -s * | sort -nr > $HOME/user_space_report.txt
|
||||
```
|
||||
- [x] ps
|
||||
Showed me a list of running processes. By default it only shows you
|
||||
the processes that were started/were run personally by you on a terminal.
|
||||
|
||||
Also: the man for `ps` under the Ubuntu box mentioned you can use
|
||||
UNIX (?), BSD (default for mac os?), and GNU (what I assume are the usual default commands) options for ps, provided you use the flags in a specific way.
|
||||
|
||||
Once in a blue moon I have to use pkill some orphaned program, and without fail
|
||||
I have to google how to every time. Maybe I can just use the pids from here instead?
|
||||
```sh (on Mac)
|
||||
man ps
|
||||
ps -A
|
||||
```
|
||||
```sh (on Linux)
|
||||
man ps
|
||||
```
|
||||
- [x] top
|
||||
Looks similar to ps, but you get a whole dashboard. I could
|
||||
see how you could use this to monitor programs. This is the
|
||||
text version of what I'd use the activity monitor for.
|
||||
```sh
|
||||
top
|
||||
```
|
||||
- [x] htop
|
||||
Top, but **fancier**! It's keyboard navigable AND mouse navigable,
|
||||
and comes with a bunch of colors out of the box. Very cool!
|
||||
```sh
|
||||
htop
|
||||
```
|
||||
- [x] exit
|
||||
Exits you out of the current terminal session.
|
||||
|
||||
extra reading
|
||||
- [x] [The Linux Command Line](http://linuxcommand.org/tlcl.php)
|
||||
WIP still reading this
|
||||
- [x] [Grep mini-zine](https://wizardzines.com/comics/grep/)
|
||||
- [x] [reddit thread: bsd v gnu](https://old.reddit.com/r/linuxquestions/comments/vzmfye/differences_between_bsd_and_gnu_utilities/)
|
||||
* Most of this goes completely over my head. But this was interesting to look at.
|
||||
BIN
lab-1/LAB-REPORT.pdf
Normal file
BIN
lab-1/LAB-REPORT.pdf
Normal file
Binary file not shown.
BIN
lab-1/Lab 1 - First Linux VM.pdf
Normal file
BIN
lab-1/Lab 1 - First Linux VM.pdf
Normal file
Binary file not shown.
BIN
lab-1/✅ Checklist #1- AWS Free Tier Account Setup.pdf
Normal file
BIN
lab-1/✅ Checklist #1- AWS Free Tier Account Setup.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user