0% found this document useful (0 votes)
22 views

The Kernel Is What Allows The Hardware T

The document provides information about various Linux commands and concepts like shells, processes, filesystem structure, permissions and more. It explains commands like ps, top, lsof etc and concepts such as kernel, shells, users, groups and permissions.

Uploaded by

tidovex691
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

The Kernel Is What Allows The Hardware T

The document provides information about various Linux commands and concepts like shells, processes, filesystem structure, permissions and more. It explains commands like ps, top, lsof etc and concepts such as kernel, shells, users, groups and permissions.

Uploaded by

tidovex691
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

the kernel is what allows the hardware to talk to the software

🟩🟨🟥

🟩why are there so many linux distributions - because its easy and everyone who
wants to create one can
🟩whats shell - a program that takes the commands from the user and gives them to
the operating system
🟩can you copy several files/directories with cp - using wildcards (for example []
is used to represent any character within the brackets)
🟩can you copy several files/directories with mv - using wildcards (for example []
is used to represent any character within the brackets)
🟩how to check what shell i use now - ps -p $$
🟩how to know what shells i have - cat /etc/shells
🟩how do i switch between shells - just type the name of the shell you want to
switch to
🟩how to use find (how to find files in another directories) - find /DIRECTORY -name
FILENAME
🟩find /home -type d -name MyFolder

🟥cat -n vs nl (both do the same)


🟩where is the last location visited is saved (cd -) - $OLDPWD in env
🟩whats 1 stream - stdout
🟩how to use cut - cut -f 1 -d ";" sample.txt(-f cut by field)(-d which field)
🟩how to use the 10th command with history command - !10

uniq - shows unique values


wc - word count
nl - Number of Lines
grep - search for files/text in file (-i insensitive)

🟩how to see the 10 commanding without executing it - !10:p


🟩where is history saved - .bash_history
🟩how to delete all history - history -c
🟩how to delete a specific command in history - history -d <line>

🟩how to go to the end of the file in vim - :$


🟩how to go to the start of the file in vim - :0
🟩how to jump to the n'th line - :n
🟩how to go to the end/middle/start of a file in vim - H/M/L
🟩how to go to the end/start of a line in vim - $/0
🟩how to go to the end/start of a word in vim - w/b

🟩shortcut to clear - Ctrl + L


🟩whats C + k - delete the whole line after the cursor
🟩7 ways to show the contents of a file
head tail more less cat nl, grep '.' filename
🟩how to create a new directory - mkdir
🟩show current jobs - ps
🟩whats sid - session id - echo $$
🟩whats test - check if a command/expression is true or false
test -e filename: Checks whether the file exists or not
test -d filename: Checks whether the file is a directory or not.
test -x filename: Checks whether the file is executable or not.
🟩explain about ps -
tty - device associated
time - amount of cpu time used by the process
cmd - the command used to start the process

🟩ls to another path im not at - ls path (without /)


🟩2 ways to search with regex
ls *.txt
find -name '*.py'
🟩show more shortcuts -
C+A move the curser to the beginning of the line
C+E move the curser to the end of the line
C+U Erases the whole line
C+W Erases one word
C+Y Pastes all of the erased text
Arrow up
Arrow down
🟩tty meaning - TeleTYpewriter
its used so the kernel knows where to return the data requested by the "device"
🟩how many tty's are there - there would be as many as i open
🟩whats top - displays all the processes that are currently running
pid - process id
user - user
pr - process priority given by the system
ni - process priority given by the user
virt - amount of virtual memory(hard disk) used by the process
res - amount of resident memory(ram) used by the process
shr - amount of shared memory(multiple can access) used by the process
s - status of the process
cpu - the percentage of cpu used
mem - the amount of RAM
time - total cpu time used by the process

🟩where is the shared memory located


its a virtual address that refers to the same physical memory(RAM)
🟩how to sort in top - top -o +/-field (top -0 -%MEM)
🟩how to see a specific process in top - top -p PID
top | grep chrome
🟩whats ps -e - shows all of the processes and all their controlling terminals
🟩whats tty ? - it indicates there is no controlling terminal
🟩how to switch between users
sudo su - username
🟩whats sed - stream editor replaces a string in a file with another
sed 's/unix/linux/' banana.txt - replace string
sed 's/unix/linux/2' banana.txt - replace the nth occurrence
job vs process
a process is any running program with its own address space
a job is a process started by a shell.
🟩whats awk - searches for something in each line and if found action taken
awk '/.txt/ {print}' banan.txt - print where a match is given
awk '{print $1,$4}' employee.txt - split by whitespace each word goes to number
awk 'length($0) >24' employee.txt - print a line with more than 24 characters
🟩other type than tty
serial ports - actual devices connected to the pc.
pty - PseudoTeletYpe - it appears to the attached program like a terminal,
but instead of communicating directly with a "real" terminal,
it transfers the input and output to another program.

▶️◀️
🟩🟨🟥

🟩how to see what users i have


awk -F: '{ print $1}' /etc/passwd
🟩how to replace all of the occurrences with sed
sed 's/an/d/g' banan.txt - add g (global) in the end
🟩why didnt work with a slash in the file
because its an escape character and you need to add g(global) in the end
🟩awk - count the words in a line and the line number near it
awk '{print NR " - " NF}' employee.txt

🟩whats total in ls
the disk usage of listed files in blocks (1024 bytes) w/o subdirectories
🟩how to create a link file
ln -s {source-filename} {symbolic-filename} - by reference to filename
ln {source-filename} {symbolic-filename} - by pointer to data
🟩what types of files are there (d/- etc)
b - hardware files
s - socket files used to pass information between applications
l - link files used to link to Directory/Regular files.

🟥to what file i add a group with sudo permissions


you add groups to the file called sudoers found in /etc/sudoers
to read it type ▶sudo cat sudoers◀
🟩latin encoding - ISO/IEC 8859-1
🟩change default permissions command - umask
🟩t in ls -l - called sticky bit, only the owner can delete or modify
autonomous systems
border router
diffie hellman encryption
TLS versions and differences
TLS handshake
where ipv6 is used
0.0.0.0 address
how are addresses defined in an internal network
whats linux
touch an already existing file
whats a group in linux
whats sudo
how to add sudo permissions to a user
can you run commands on the kernel
how to delete current line vim
how ot delete all lines until the end in vim
copy paste current line vim
copy paste several lines vim
move between search results vim
why would i use :w!
search inside a file
vi vs vim
how is the password hash built
how is /shadow built
what is ! and * in shadow
how to use commands inside top
whats a zombie process
$ vs # and others (sudo su)
how sudoers file built
read about chown and chgrp again
whats a thread
thread vs process
print threads
how to find where is a command located
how does the shell decide where to take the executable from

🟩difference between apt and apt-get -


apt is a simpler version of apt-get and is more user friendly
🟩whats sudo apt update
used to update information about available packages and their versions
🟩gzip vs zip - gzip compresses only a single file, zip can compress several files
🟩how to check if a version exists with apt
🟩where is the directory of apt located - dpkg -L <package>

🟩find the keyboard and mouse in linux


they are supposed to be here: /sys/bus/usb/devices
on windows the are at ls /mnt/c/Windows/System32/drivers

🟩whats opt dir used for -


used when all of the files are supposed to be in the same directory by desing
whats run dir used for -
run is used for files that processes create like "im using pid 262"
and run is definitely deleted after reboot to not cause problems
df -T whats filesystem and types
🟩whats srv dir used for -
This is where you put the data for your servers, http, ftp
🟩whats var dir used for -
var contains things taht are prone to change, such as websites, temp files
and databases. hence the name var (variable)
🟩after how much time the tmp dir deleted -
the files live for up to 30 days, also deleted after reboot
🟩why are there so many dupes in the usr dir
they are not dupes, they are links to the usr directory
usr are system os installed programs and usr programs
options in /etc/fstab

🟩whats rom - read only memory, its where the bios is stored
🟩bios vs uefi
instead of being stored on the rom, the uefi is stored in an
.efi file in the EFI system partition (ESP) on the hard disk.
this provides more storage space for better user interfaces and mouse support
🟩how to add processes to start on startup
crontab -e
@reboot <executable file path>
🟩what system call does the kernel have?
process control
file manipulation
device Management
information maintenance
communications

🟩whats rsyslog - a central repository that devices/programs send logs to


for easy and centralized viewing and debugging
🟩whats unit in systemd unit file -
generic information about the unit that is not dependent on the type of unit
🟩whats FD in lsof - file descriptor, description for a file
FD is the File Descriptor number of the file or:
cwd current working directory;
Lnn library references (AIX);
err FD information error (see NAME column);
jld jail directory (FreeBSD);
ltx shared library text (code and data);
Mxx hex memory-mapped type number xx.
m86 DOS Merge mapped file;
mem memory-mapped file;
mmap memory-mapped device;
pd parent directory;
rtd root directory;
tr kernel trace file (OpenBSD);
txt program text (code and data);
v86 VP/ix mapped file;
🟩Whats ACCESS in fuser
The c character under ACCESS shows the type of access,
in this case meaning the Current directory.
Executable
Root directory,
open File,
Mapped file.
🟩whats TYPE in lsof - is the type of the file

or ``IPv4'' for an IPv4 socket;

or ``IPv6'' for an open IPv6 network file - even if its address is IPv4, mapped
in an
IPv6 address;

or ``ax25'' for a Linux AX.25 socket;

or ``inet'' for an Internet domain socket;

or ``lla'' for a HP-UX link level access file;

or ``rte'' for an AF_ROUTE socket;

or ``sock'' for a socket of unknown domain;

or ``unix'' for a UNIX domain socket;

or ``x.25'' for an HP-UX x.25 socket;

or ``BLK'' for a block special file;

or ``CHR'' for a character special file;

or ``DEL'' for a Linux map file that has been deleted;

or ``DIR'' for a directory;

or ``DOOR'' for a VDOOR file;

or ``FIFO'' for a FIFO special file;

or ``KQUEUE'' for a BSD style kernel event queue file;

or ``LINK'' for a symbolic link file;


or ``MPB'' for a multiplexed block file;

or ``MPC'' for a multiplexed character file;

or ``NOFD'' for a Linux /proc/<PID>/fd directory that can't be opened -- the


direc‐
tory path appears in the NAME column, followed by an error message;

or ``PAS'' for a /proc/as file;

or ``PAXV'' for a /proc/auxv file;

or ``PCRE'' for a /proc/cred file;

or ``PCTL'' for a /proc control file;

or ``PCUR'' for the current /proc process;


or ``PCWD'' for a /proc current working directory;

or ``PDIR'' for a /proc directory;

or ``PETY'' for a /proc executable type (etype);

or ``PFD'' for a /proc file descriptor;

or ``PFDR'' for a /proc file descriptor directory;

or ``PFIL'' for an executable /proc file;

or ``PFPR'' for a /proc FP register set;

or ``PGD'' for a /proc/pagedata file;

or ``PGID'' for a /proc group notifier file;

or ``PIPE'' for pipes;

or ``PLC'' for a /proc/lwpctl file;

or ``PLDR'' for a /proc/lpw directory;

or ``PLDT'' for a /proc/ldt file;

or ``PLPI'' for a /proc/lpsinfo file;

or ``PLST'' for a /proc/lstatus file;

or ``PLU'' for a /proc/lusage file;

or ``PLWG'' for a /proc/gwindows file;

or ``PLWI'' for a /proc/lwpsinfo file;

or ``PLWS'' for a /proc/lwpstatus file;

or ``PLWU'' for a /proc/lwpusage file;

or ``PLWX'' for a /proc/xregs file;


or ``PMAP'' for a /proc map file (map);

or ``PMEM'' for a /proc memory image file;

or ``PNTF'' for a /proc process notifier file;

or ``POBJ'' for a /proc/object file;

or ``PODR'' for a /proc/object directory;

or ``POLP'' for an old format /proc light weight process file;

or ``POPF'' for an old format /proc PID file;

or ``POPG'' for an old format /proc page data file;

or ``PORT'' for a SYSV named pipe;

or ``PREG'' for a /proc register file;

or ``PRMP'' for a /proc/rmap file;

or ``PRTD'' for a /proc root directory;

or ``PSGA'' for a /proc/sigact file;

or ``PSIN'' for a /proc/psinfo file;

or ``PSTA'' for a /proc status file;

or ``PSXSEM'' for a POSIX semaphore file;

or ``PSXSHM'' for a POSIX shared memory file;

or ``PTS'' for a /dev/pts file;

or ``PUSG'' for a /proc/usage file;

or ``PW'' for a /proc/watch file;

or ``PXMP'' for a /proc/xmap file;

or ``REG'' for a regular file;

or ``SMT'' for a shared memory transport file;

or ``STSO'' for a stream socket;

or ``UNNM'' for an unnamed type file;

or ``XNAM'' for an OpenServer Xenix special file of unknown type;

or ``XSEM'' for an OpenServer Xenix semaphore file;

or ``XSD'' for an OpenServer Xenix shared data file;

or the four type number octets if the corresponding name isn't known.
🟩print logs from the boot with journalctl
journalctl -D /var/log
not the full command but cant check if it works because i dont have logs
--file doesnt work

You might also like