Notes: Linux Fundamentals Part 1 | THM
- solbergtonje
- 25 dec. 2024
- 2 min läsning
Linux
- operating system
- based on UNIX
- open-source
- various variants/versions/distributions of Linux (distros)
- lightweight: Ubuntu Server can run on systems with only 512MB or RAM
Linux common uses:
- websites
- car entainment/control panels
- Point of Sale (PoS) systems: checkout tills and registers in shops
- Critical infrastructure: traffic light controllers or industrial sensors
Common distributions of Linux:
- Ubuntu
- Debian
Terminal
- possible to interact with the system without a GUI
- text-based
Commands
echo: output text
whoami: output which user are you currently logged in as
Commands to interact with filesystem
ls - listing
cd - change directory
cat - concatenate
pwd - print working directory
Command searching for files:
find
Search for filename:
find -name passwords.txt
Search for a file without knowing the name:
find -name *.txt
* is a wildcard (https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm)
Search contents of files:
grep
Search for an IP address in an access log file:
grep "81.143.211.90" access.log
Linux Operators
& - run commands in background
&& - combine multiple commands together in one line
> - redirector = take output from command and direct it elsewhere
>> - same as >, but appends output rather than replacing/overwrite
Operator &
- execute commands in background
Operator &&
- run several commands
F.ex: command1 && command2
Command2 will only run if command1 ran
Operator >
- output redirector (overwrites content)
- take output from a command and send it to somewhere else
f.ex:
command: echo hey > welcome
command: cat welcome
output reading the file welcome:
hey
Operator >>
- output redirector (put content at the end)
f.ex:
command: echo hello >> welcome
command: cat welcome
output reading the file welcome:
hey
hello





