This requires inotify to be installed
while true; do inotifywait -r -e MODYFY dir/home/user/test runme.sh; done;
This requires inotify to be installed
while true; do inotifywait -r -e MODYFY dir/home/user/test runme.sh; done;
Sometimes we have to adjust the locales of Debian, e.g. when apt issues error messages. This can be done quickly.
localectl set-locale LANG=en_US.UTF-8
That’s it.
Search your history
ctrl + r
Write something in a file
printf 'This is a test\n' > test.txt
Do this 10 times
printf 'This is a test\n' > test{1..10}.txt
quickly rename a file
mv filename.{old,new}
You can use loops in bash
for i in *.txt
do
convert $i $i.jpg
done
But maybe you want to use braces {}
Create 10 text files
touch test_{1..10}.txt
Create 3 text files
touch test_{1,3,10}.txt
$( ) gives the output of a command to previous command
touch file-$(date -I).txt
Remove all .txt files in a directory
rm $(ls *.txt)
Delete all files in a folder that don’t match a certain file extension
rm !(.foo|.bar|*.baz)
$( ) can be nested very easily
program1 $(program2 $(program3))
this command lists all containers with it’s numeric IDs:
docker ps -a -q
We add some command line magic, to stop them all:
docker stop $(docker ps -a -q)
After we’ve stopped all the containers, we can delete them. Docker only deletes stopped containers:
docker rm $(docker ps -a -q)
docker image rm $(docker images -a -q)
mkisofs -J -allow-lowercase -R -V "isoname" -iso-level 4 -o yourName.iso ~/your/directory
This requires arp-scan to be installed
arp-scan -I eth0 192.168.1.0/24