Daily tip

How can I display where the backup superblock is?

Umount the file system (or boot in single user mode to do so) then run the command

/sbin/mke2fs -n /dev/sdX

Of course this is relative to ext2/ext3/ext4 file systems only.


Daily tip

Is there an alternative to sudo or setuid?

Yes: capabilities. Look at:
http://man7.org/linux/man-pages/man7/capabilities.7.html

Daily tip

How to generate a stack trace when an app or program crashes?

For a no threaded application

gdb -q my-program In batch mode gdb -q -batch -ex run -ex backtrace my-program With args gdb -q --args my-program gdb -q -batch -ex run -ex backtrace --args my-program

For a multithreaded app

% gdb -q \ -batch \ -ex 'set print thread-events off' \ -ex 'handle SIGALRM nostop pass' \ -ex 'handle SIGCHLD nostop pass' \ -ex 'run' \ -ex 'thread apply all backtrace' \ --args \ my-program \ arguments-to-my-program

Daily tip

Is there any program to report system temperatures from computer HW sensors?

Yes, install lm_sensors and then run the command sensors.

Note that on a virtual machine no sensors are detected for obvious reasons.

Daily tip

How do I downgrade a package in a Debian distribution?

To revert to the previous version of a Debian type package you follow these steps:

apt-cache show package_name

Then you specify the specific (previous) version you want to downgrade to

apt install packagename=version

Daily tip

How can I generate a random password in Linux?

There are several tools online and not of course, here i would suggest the utility pwmake. Usage is pwmake entropy_bits and it is recommended to use a value of at least 64. For more info man pwmake.

So you can use the command in this way:          

pwmake 64                                                                  

Daily tip

How can I display a dialog box in a shell?

Through the utility dialog which must be installed.

Then you can run it in your scripts, for instance the below code:


#!/bin/bash
dialog --infobox "Installation Wizard" 6 25
sleep 1
dialog --yesno "Would you like to continue?" 12 25
if [ $? -ne 0 ]; then
    echo "User cancelled the operation!"
    exit 1
fi


Daily tip

How do I mount a NFS FS which doesn’t support locking?

#mount -o nolock server:/mount/point

Daily tip

How can I verify a package (check for modified configuration files or binaries) in a Debian like distribution (Debian, Ubunut, Mint, etc.)?

#dpkg -V <package_name>