for i in {5..7}; do for e in {5..7}; do echo "$i*$e=$(bc<<<$i*$e)" | spd-say -e ;sleep 2; done; done
watch -n 10 'mycommand && spd-say done || echo "no"'
# list partitions
fdisk -l
fdisk /dev/sdx
# touch d for delete partition
# touch n for new partition
mkfs.vfat /dev/sdx1
dd if=file.iso of=/dev/sdx bs=1M status=progress
Caption:
if: input fileof: output file here/dev/sdxbs: block size
xclip -sel c < input_file
Reference: https://stackoverflow.com/a/62168635
ss -ptulwn | grep LISTEN
Change the pager of man :
export PAGER=less
cat a | while read f; do curl -L -b 'cookie=value' -O -J "${f}"; done
# display bandwidth usage on an interface by host
# as root
iftop -s wlp0
# change to your interface
# lock your screen
slock
aspell -l en -c file.txt
# IPv4 addresses:
cat /proc/net/fib_trie
# hex-encoded port data:
cat /proc/net/tcp
su on Linux (Debian)The su command allows you to switch users for the duration of a session (after entering the password, if there is one). To use it, type:
su USERNAME
You can also use it to become root simply by typing:
su
To become a superuser on Linux, you can use the su command. However, sometimes this is not enough, and you still won't have the proper permissions. This is normal — you haven't loaded the superuser's environment variables.
To fix this, simply run:
su -l
# or
su -
Add a user to sudoers
# as root
adduser USERNAME sudo
# then reload session
Launch the last command with sudo
sudo !!
# should be root
# Turn swap off
swapoff -a
# Create an empty swapfile 10GB
dd if=/dev/zero of=/swapfile bs=1G count=10
chmod 0600 /swapfile
mkswap /swapfile # Set up a Linux swap area
swapon /swapfile # Turn the swap on
TO_ICONIFY=IMAGE.png
for i in 48 96 144 192; do convert -background none $TO_ICONIFY -resize ${i}x${i} favicon-${i}x${i}.png; done; convert -background none favicon-* favicon.ico
-background noneis used to keep the transparency withpng
apt install paps
paps file.txt | ps2pdf - file.pdf
exiftool -d '%Y-%m-%d_%H-%M%-S%%-c.%%e' '-filename<CreateDate' .
Reference https://blog.wxm.be/2024/07/26/exiftool-rename-from-date.html
convert image.png -background white -flatten -alpha off image.jpg
Reference https://stackoverflow.com/a/5280262
mkdir -p /mnt/ram
mount -t tmpfs tmpfs /mnt/ram -o size=4096M # create a (fast) in-ram folder of 4GB
# reboot and press `e` on grub
# add `init=/bin/bash` at the end of the line starting with `linux`
# press `F10` to boot
mount -no remount,rw /
passwd
# enter new password
You will need first need to ensure that the file /etc/nsswitch.conf is created
# /etc/nsswitch.conf
hosts: files dns
networks: files
Then you can create and use the file /etc/hosts to do a custom host resolution
# /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
192.168.1.45 my_server
# Create a file server, listening in port 7000
while true; do nc -l 7000 | tar -xvf -; done
# Then, at client side (router)
# Send file myfile to server
tar c myfile | nc localhost 7000
# Send directory mydir to server
tar c mydir | nc localhost 7000
# as root
tcpdump -i any
grep -oP '(http|https)://[^<"]+' rss.xml | uniq | xargs -n1 lychee -vv
# or without -n1