update: 2019-02: everything was fine… until you decided to update because of the EthernalBlue exploit THAT ALSO AFFECTS OPEN SOURCE IMPLEMENTATIONS OF SMB 1.0! (WTF!? WHY?), samba now miss behaves on Debian and CentOS. (scroll down for details) EternalBlue, sometimes […]
1. install ffmpeg or avconv (debian alternative) 2. put all *.ts* files in one folder (they should have the same encoding, resolution etc. etc.) 3. and while you are in this directory fire this line: ffmpeg -i “concat:$(ls -1 *.ts* […]
in a script you can specify to save output to a file with current date/time like: LOGFILE=/path/to/logfiles/$(date ‘+%Y-%m-%d’)_task.log echo “this script was run” >> $LOGFILE; to cleanup regularly is important in order to ensure the harddisk does not fill up. […]
sometimes the scripts that used to work perfectly well – suddenly start to miss behave – but you HAVE NOT altered them! look closely to the directory they reside in… maybe something in the dir has changed! make sure: your […]
bc is cool, but it can not access shell variables directly, but you can pass them with <<< also there is no “pi” constant in bc that you could use in interactive mode. let one assume you would like to […]
update: safety first! when it comes to important files: safety comes first thus recommend to the user that wants to go pro the following backup system: have two complete backups at two different places: backupA: at the company, USB 3.0 […]
display ip and ip only of the host computer the script is running on. ifconfig eth0|grep inet| awk ‘{print $2}’ | cut -d: -f2 172.20.0.8 root@debian9:~# IP=$(ifconfig eth0|grep inet| awk ‘{print $2}’ | cut -d: -f2); echo $IP; 172.20.0.8
there are some special automatically set environment variabels that might be interesting to know… echo $$; # PID of currently running shell echo $?; # return error code of last run program (before echo) echo $0; # return /path/and/way the […]
for debugging problems with your system it might be interesting to know what is happening in real time in your log files (unfortunately there are also binary and packed old logs.gz files in /var/log) this command will follow all file […]
naming why is a shell called a shell? after all it’s just a program 😀 call it program then 😀 kernel = core, shell = surrounding the core, interaction with the core. a shell is also a runtime-environment – a […]
return value: any exit/return/result value other than 0 is considered an error. you can output the return value of the last command like this: echo $? 0 inside a script you can exit and return an exit code like this: […]
vi countdown.sh; # create a new file with those lines #!/bin/bash COUNT=10 while (( COUNT > 0 )) do echo -e “$COUNT \c” sleep 1; (( COUNT — )) done echo -e “\n\nWe have lift off!!” ESC […]
iconv.man.txt – allows (file?) conversion between charsets / encodings all available encodings: iconv_debian8_convertable_charsets.txt example: iconv -f UTF-8 -t ISO-8859-15 file.input -o file.output file file.output file.output ASCII text iconv -f ASCII -t UTF-8 file.input -o file.output file.output: ASCII text
# all these commands will modify /etc/passwd su – root # disable login for user usermod -s /usr/sbin/nologin username # change login-shell of username to bash usermod -s /bin/bash username # change login-shell of username to sh usermod -s /bin/sh […]
stat /etc/hosts File: ‘/etc/hosts’ Size: 249 Blocks: 8 IO Block: 4096 regular file Device: 801h/2049d Inode: 5506941 Links: 1 Access: (0644/-rw-r–r–) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2017-06-06 15:37:06.896148382 +0200 Modify: 2017-06-06 15:37:04.728130437 +0200 Change: […]
about package.deb & apt Apt is a mainly-online-repository-based (“AppStore”) software installation & package management system used by Debian, Ubuntu and Mint (and other apt based distributions). But – it is possible to manually download a package.deb and install it with: […]
one practical usage example of xargs: … to process every file that find found further # this would backup/pack all jpg files on your system into all.jpg.tar.gz find / -name “*.jpg” | xargs tar -czvf all.jpg.tar.gz # delete all jpg […]
lvm2 concept: tested on: debian 8-9 and compatible, manpages from centos7/rhel7 in general backup! backup! backup! before fiddeling with partitions and the filesystem… logical volumes basically allow you to span partitions over several disks/partitions as well as resize those partitions. […]
article was merged with: https://dwaves.de/2017/05/16/linux-bash-terminal-howto-string-text-processing-examples/
what is umask? umask defines what what access rights newly created files “are born”. we are all supposed to be created equal – but depending if you are a son of Rothchild, Rockefeller or born in Namibia – your previleges […]
update: 2021-1 yum -> dnf hostnamectl; # tested on Virtualization: kvm Operating System: CentOS Linux 8 CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 5.4.11 Architecture: x86-64 ll /usr/bin/yum -> dnf-3 all those yum commands still work with dnf (nice work!) DNF […]
reboot [cc lang=”bash” escaped=”true” width=”600″] reboot; # simply reboots the system 😉 init 6; # does the same telinit 6; # shutdown -r now; # “standard” way shutdown -r +1 “the system is going to reboot in one minute”; # […]
Table 4-1. Regular expression operators Operator Effect . Matches any single character. ? The preceding item is optional and will be matched, at most, once. * The preceding item will be matched zero or more times. + The preceding item […]
lsb_release -a; # tested on Description: Debian GNU/Linux 10 (buster) # output all lines that containt KEYWORD grep KEYWORD file.txt # output all lines that DO NOT containt KEYWORD (search inverted) grep -v KEYWORD file.txt # -v, –invert-match # […]
Some people think it is ridiculous to measure the power consumption of computers. Imho it is important for servers but also if workstation uses 50 Watts idle or 10 can also make a difference when it is used a lot […]
if you want to send mail from a client not from a server – you will need: some client software valid account on an external mail server warning! Sendemail is unable to accept self-signed SSL certificates… so you will need […]
cool apt-get install fortune cowsay; # will have to be installed first then you can let your dinosaur speak 😀 /usr/games/cowsay -f stegosaurus “Hello World” _____________ < Hello World > ————- \ . . \ / `. .’ ” […]
[cc lang=”bash” escaped=”true” width=”600″] man -k bash; # search for bash in all man-pages bash (1) – GNU Bourne-Again SHell bash-builtins (7) – bash built-in commands, see bash(1) bashbug (1) – report a bug in bash builtins (7) – bash […]
for good overview it makes sense to label the harddisk partitions according to functionality (what is their purpose?) GNU Linux bash – how to label partitions tune2fs (xfs & ext4) uname -a; # tested with Linux debian 3.16.0-4-686-pae #1 SMP […]
these commands are equally valid, both commands add “content” to the end of file – if file does not exists it will be created. ls -l . /ect > listing.txt #send the output from ls -l to a file called […]