Linux Fundementals Flashcards
When was linux released ?
1991
To output simple text we use ?
Echo
To check name of machine we use ?
whoami
Command to find a file on linux ?
find -name file_name
find -name *.format_type
What shell operators are there ? And what does each do ?
- & - run cmd in the background, can also use CTRL + Z for scripts.
- && - combine multiple commands
- >
- redirect output
- > >
- redirect output without overwriting
Commands that we use regularly ?
Touch - create file
mkdir - create folder
cp - copy
mv - move
rm - remove
file - determine type
How do we check what permissions files in a directory have ?
ls -l
Switching to another user in linux command ?
su username
su -l username
What are the 4 common directories ? What do they do ?
/etc - stores system files that OS uses, also stores “shadow” and “passwd” which has password storing method in sha512 encryption.
/var - accessed by running apps and services, has /var/log that stores variable data about these apps and services
/root - home directory of the root user
/tmp - like ram, stores data until shudown
How to download files from a website ? via what ?
wget via HTTP
Securely trasnfering files via SSH protocol command ? Syntax for sending and receiving to and from a remote server ?
scp - secure copy
scp file_name remote_user_name@remote_ip:path - to send
scp remote_user@remote_ip:path_to_file
What command opens a running server via python ?
python3 -m http.server - to serve files
Command to get from a server after python server deployment ?
wget http://machine_ip:port/file_name
What are processes, what are they managed by ? How do they identify ?
Processes are programs ran on machine, managed by the kernel. They identify by their PID’s, and incremented in order i.e 60th process’s PID = 60
How do we check the list of processes ?
ps command
Command to check which user is running what process and processes that don’t run in that session ?
ps aux
what does the top command do ?
gives real time stats of processes
what does ps command do ? what does ps aux command do ?
ps command shows the processes ran in the session. ps aux shows users that run them and also processes not ran in the session
How do we eliminate a process ?
kill “PID”
what are other commands like kill what do they do ?
sigterm - kill the process but do cleanup beforehand
sigkill - kill without cleanup
sigstop - stop suspend a process
What is the method of splitting resources up for specific processes called ? what is it good for and what is it’s specificity ?
Method is called namespaces, it is good for security since only the processes assigned the same resource (cpu, ram,etc..) can see each other.
What is the first process when booting linux ?
systemd
how do we communicate with systemd ?
systemctl [option] [service]
options : start, stop, enable, disable.
What are the two states that processes can run in ? Give an example for both.
Foreground and background
If we take command “echo”
echo “hi” -> returns hi
if we do
echo “hi” & -> returns the ID for echo