Posts

Showing posts with the label Ubuntu

Disable GRUB timeout

 Add “GRUB_RECORDFAIL_TIMEOUT=0” in /etc/default/grub Then update GRUB by running sudo update-grub Credit: https://techz.io/disable-grub-boot-menu

Speed up shutdown in Linux by reducing default stop timeout

Edit /etc/systemd/system.conf Uncomment and change the value at line DefaultTimeoutStopSec=90s Reboot for the change to take effect (it will not take effect yet after editing the file before reboot).

Turn off WiFi Power Setting in Ubuntu

  sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf   wifi.powersave = 2   Other value: 0: use the default value 1: don't touch existing setting 2: disable powersave 3: enable powersave

Mount windows share on ubuntu

Install the CIFS Utils pkg sudo apt-get install cifs-utils Create a mount point sudo mkdir /mnt/local_share Mount the volume sudo mount -t cifs -o user=<user on Windows> //<windows_ip_address>/<share_folder> /mnt/<local_share> You will be prompted for password   To mount at boot, add to /etc/fstab file: //<windows_ip_address>/<share_folder>cifs user=<user on Windows>,pass=<user passwd> 0 0  

Run MongoDB query form terminal

 mongo localhost:27017/db_name script_name.js > result

Add permanent alias

 Add at the end of file ~/.bashrc alias alias_command 'real command' To load newly created alias immediately: source ~/.bashrc

Move MongDB database

find mongodb config file sudo find / -name mongod.conf -print get dbPath from that file stop mongodb service mongod stop check mongodb is not running sudo systemctl status mongod copy all files from dbPath to new dbPath cp -r old_dbPath new_dbPath chown of new dbPath sudo chown -R mongodb:mongodb new_dbPath change dbPath in mongodb config file to new_dbPath start mongodb sudo systemctl start mongod

Show popup window

 https://wiki.gnome.org/Projects/Zenity

Dropbox not syncing

  sudo chattr -R -i "$HOME/Dropbox" sudo chown -R "$USER" "$HOME/Dropbox" chmod -R u+rw ~/Dropbox dropbox stop; rm -rf ~/Dropbox ~/.dropbox ~/.dropbox-dist; dropbox start -i   Note that Dropbox folder path point to default position. If you have changed this path, make appropriate corrections above

How to become root

sudo su

Mount HDD temporarily on Linux

sudo fdisk -l    mkdir /mnt/mount_name   sudo mount /dev/partition /mnt/mnt_name

Test speaker on Linux

speaker-test -t wav -c 6

Shortcut for app on PlayOnLinux

playonlinux --run appName

Force removal of broken package

sudo dpkg --remove --force-remove-reinstreq package_name

Enable double click to open item in KDE

System Settings, Workspace, Workspace Behavior, General Behavior, Click behavior

Delete all email from mail command

? delete * ? q

Stop Ubuntu from asking password

Run sudo visudo For certain command: username ALL = NOPASSWD: command 1 username ALL = NOPASSWD: command 1, command 2, command 3 Example hensem ALL = NOPASSWD: /bin/systemctl restart httpd.service, /bin/kill For everything: username ALL=(ALL) NOPASSWD:ALL For root: Find the line that says %admin ALL=(ALL) ALL and change it to %admin ALL=(ALL) NOPASSWD: ALL

Running GUI app in Cron

In ~/.profile add these 2 lines: xhost +local: xhost Add env DISPLAY=:0 before cron command 00 06 * * * env DISPLAY=:0 gui_appname To run cron as root or anacron, add this to ~/.bashrc xhost local:mpromber > /dev/null