Category: Bash / Terminal / Scripts

24.05.2017

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 […]

24.05.2017

What is yum? yum is the default package manager for RPM-based linux distributions (CentOS, Fedora, RHEL, Oracle). It’s written in python and it stands for “Yellowdog Updater, Modified”, as it was originally called “yup”, the package manager for Yellow Dog […]

22.05.2017

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 […]

22.05.2017

vim stresscpu.sh; # create new script file #!/bin/bash while true; do echo -n "+."; done; save and quit chmod u+x stresscpu.sh; # mark it runnable nohup stresscpu.sh & # run in background htop # streeeeeeessss! it is also a harddisk-stress […]

22.05.2017

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 >  ————- \                             .       .  \                           / `.   .‘ “   […]

21.05.2017

uname -a; # tested with Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.43-2 (2017-04-30) i686 GNU/Linux vim /scripts/partitions_overview.sh; # create new script #!/bin/bash PARTITIONS=/dev/sd* for f in $PARTITIONS do   echo "_______________________________________________________________________________"   blkid $f   hdparm -I $f | grep […]

19.05.2017

these commands are equally valid, both commands add „content“ to the end of file – if file does not exists it will be created. echo "content" >> file; >>file echo "content"; echo $?; # returns the error level (1 = […]

19.05.2017

yeah i know i sometimes make fun of distributions that have like a partition for every /root/folder but well yes it has it’s reasons. suse12 uname -a; # tested with Linux suse 4.4.21-69-default #1 SMP Tue Oct 25 10:58:20 UTC […]

19.05.2017

there are plenty 😀 debian8.8 uname -a; # tested with Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.43-2 (2017-04-30) i686 GNU/Linux find / -type d -iname bin /bin /usr/local/bin /usr/bin /usr/share/doc/libintl-perl/examples/simplecal/bin /usr/lib/klibc/bin suse12 uname -a; # tested with Linux suse 4.4.21-69-default […]

19.05.2017

rpm is a powerful Package Manager for Red Hat, Suse and Fedora Linux. It can be used to build, install, query, verify, update, and remove/erase individual software packages. A Package consists of an archive of files, and package information, including […]

19.05.2017

little experiment shows in what order the config files are loaded after login… login as non-root user uname -a; # tested with Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.43-2 (2017-04-30) i686 GNU/Linux Broadcast message from user@debian (pts/0) (Fri May 19 […]

16.05.2017

messing with text files cat e* >e.txt; # concatenate = combine all files starting with e… into one file e.txt cat -n e.txt; # output to screen, number lines 1999  find: ‘/etc/sudoers.d’: Keine Berechtigung 2000  find: ‘/etc/lvm/archive’: Keine Berechtigung 2001 […]

16.05.2017

Mac OS X Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages: brew install proctools # to install pgrep, pkill, etc. brew install pstree # to be able to use pstree brew install […]

16.05.2017

CentOS7 yum install psmisc # install pstree [root@centos user]# pstree systemd─┬─NetworkManager─┬─dhclient         │                └─2*[{NetworkManager}]         ├─agetty         ├─auditd───{auditd}         ├─chronyd   […]

14.05.2017

ps -eo size,pid,user,command –sort -size | awk ‚{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }’| head -10    1243.09 Mb /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib/mysql/plugin –user=mysql […]

05.05.2017

fallocate -l 1G 1GBybe.testfile; # with fallocate dd if=/dev/urandom of=1GBybe.testfile bs=64M count=16 iflag=fullblock; # generate 1GByte test file that contains random data https://www.cyberciti.biz/faq/howto-create-lage-files-with-dd-command/ https://superuser.com/questions/470949/how-do-i-create-a-1gb-random-file-in-linux

03.05.2017

alias = „virtual network card“ = you can have multiple ip-addresses per phyisical network card. under linux the naming is: eth0:0, eth0:1, eth0:2… those are basically „virtual network cards“ each having their own unique ip-address (may not conflict/collide, not possible […]

03.05.2017

tested and works accross the following systems: uname -a Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) i686 GNU/Linux uname -a Linux centos 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux uname -a Linux suse […]

03.05.2017

setterm -blength 0; # turns off nerve wrecking "BELL" echo ’setterm -blength 0; # turns off nerve wrecking "BELL"‘ >> /etc/bash.bashrc; # make the changes permanent/survive boot and for all users this does not work for X11 terminals such as […]