- .txt etc. means nothing
Don't use spaces/files in a driectory
man ls = view bash manual mv <file.type> <file.newtype> = changes file type ll = long list ls * = list of files and shows files in directories nicely nl = number of lines head - = shows first lines tail - = shows last lines grep = shows text that contains
Things a user can do: Read(r) Write(w) Execute(x)
Users that exist:
- owner
- Typically the person/user who creates the file, however, it can be changed.
- group
- Every file belong in a single group. Group have many users in it and give acces to mulitple people
- others
- Everyone else not in a group or the owner
chmod <path/file>
- STDIN
- Standard input
- STDOUT
- Standard output
- STDERR
- Standard error
Means we can join all these amazing commands together
ls > list_of_ls.txt
wc words.txt > word_count.txt
cat words.txt >> word_count.txt
wc -w < words.txt
ls missing_directory 2> ls_log.txt
- will log the error into the file ls_log.txt, the error here is the directory does not exist so cannot be listed (you need the 2 to log the error)
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 🥓 We use | to join programs sort words.txt | head -4
ls | head -3
ls | tail -5
cat example.txt | grep it
- this will return back all lines that contain 'it' in it
running the instance of a program is called the process, we can do multiple processes at the same time
top = shows top processes in order of cpu and memory usaage ps = shows user processes ps = shows all processes
kill
sleep 100 = will sleep your machine for 100 seconds (foreground)
sleep 100 & = will send this to the background (basically wont do anything but can be viewed by ps aux)