.txt means nothing!
- Read(r)
- Write(w)
- Execute(x)
- owner Typically the person who creates the file. however it can be changed.
- group Every file belongs a single group. Groups have many users in it and give access to multiple people
- others Everyone else not in a group or the owner.
chmod <path/file>
- STDIN
- Standard Input
- STDIN code is 0
- STDOUT
- Standard Output
- STDOUT code is 1
- STDERR
- Standard Error
- STDERR code is 2
Means we can join all of these amazing commands together 🌮
ls > list_of_ls.txt wc words.txt > word_count.txt cat words.txt >> word_count.txt
wc < words.txt
ls non_existing_directory 2 > ls_log.txt
the 2 is very important for logging the error.
(if the non_existing_directory doesn't exist, this will send the error to the log file)
We sent STDOUT and STDERR into files, but what we want is to be able to send outputs into other programs. This is very powerful and is called Piping 🌮
ls | head -3 ls | tail -3 | sort cat example.txt | grep When
Running an instance of a program is a process
- top: top processes
- ps: processes
- ps aux: processes auxiliary (all)
- ps aux | grep vagrant > ps_vagrant_logs.txt: gets only the processes with vagrant in them, inputs to log file for errors
- ps aux | grep vagrant sqjed 231 2 >> ps_vagrant_logerror.txt: gets the error (using 2) messages made by this command, appends it to a file
- kill (pid) (pid = process)
- We can store variables in bash with MY_VAR = ???
- We can call them with $MY_VAR, e.g. echo $MY_VAR, which will print whatever is stored in your variable to the command line.
- If the variables are called in a file/script, we cannot access them by running the file in bash, they will be identified as empty when this occurs.
- We need to export the variables first, then they become persistent enough for us to use.