Categories
Linux Red Hat Ubuntu

Vi (or Vim) session no longer responding?

If your Vi or Vim session is hanging and is not responding to anything, then it might be because you pressed CTRL+S accidentally (out of habbit). To fix this, just press CTRL+Q to unblock the session.

Categories
Dell XPS15 Laptop Linux Ubuntu

No wifi or no external monitor on Dell XPS-15

If your wifi card is not available after booting your Dell XPS-15 laptop (with Ubuntu 20.04 or 22.04), or your external monitor refuses to display anything, please try the following:

start up your laptop without your power supply plugged in, connect with wifi, and/or your external monitor and only then plug in your power supply.

This fix works everytime for me.

Categories
Linux

Ubuntu: reset monitor settings to default

If you want to reset your monitor settings to default through the terminal (your second screen is broken and the settings are ‘shown’ there and you don’t want to restart your laptop), you can use the following command:

xrandr -s 0
Categories
Linux Ubuntu

Ubuntu Server – CTRL-ALT-DEL

If you press CTRL-ALT-DEL on a Ubuntu Server the server will be shut down without asking any confirmation or password. This is of course not a good idea.

To disable this, enter the following commands as root:

systemctl mask ctrl-alt-del.target
systemctl daemon-reload
Categories
Linux

Linux: removing commands from history

If you want to remove some commands from your bash history use the following command:

history -d 1001

where 1001 is the number of the history line. Of course this might add another problem: the command ‘history -d 1001’ is now added to your history.

How to avoid a command getting in your bash history?

If you want to execute a command and don’t want it to get in your history list (because it contains sensitive data, or you just don’t want to clutter your history), start the command with a space.

For this to work the environment variable $HISTCONTROL has to be set to ‘ignorespace’ or ‘ignoreboth’.

export HISTCONTROL=ignorespace
Categories
Linux

Ubuntu 20.04: annoying popup ‘Authentication is required to run gvfsd-admin daemon’

If you get the above popup, and it is impossible to get it to go away (cancel does nothing, authenticate hangs…), here is a quick solution to get rid of it:

Press ALT+F2, enter ‘r’ (without the quotes) in the command box and press enter. This will restart Gnome and the window will be gone. Your running apps keep running!

Categories
Linux

Ubuntu: external screen goes black, but ubuntu is still using 2 screens

Today I had the problem that my external screen was only showing a nice shade of black. However, several programs were running on that screen, and I could not just reboot the laptop without losing much work.

To fix this (it did fix it for me, your mileage may vary), open a terminal window (Ctrl + Alt + t) and type the following command:

xrandr

After this, I had my second screen back.

Categories
Linux Zentyal

Zentyal: how to change password expiry options

Zentyal is a great replacement for Windows domains, but in the webinterface there is currently (version 6) no option to change the password expiry settings.

To change them anyway, open a linux terminal on the Zentyal server and use the samba-tool utility


samba-tool domain passwordsettings set --max-pwd-age=0

This will turn off password aging. Change the 0 to the number of days you want to set it to expire to anything else than the default 365 days. Have look at the help page or manpage for samba-tool to see more options. If the command executes successfully, you will see the following text:

Maximum password age changed!
All changes applied successfully!

and you are done!
Categories
Linux

Linux: using tmux to start server processes

If you want to start a process or command on a linux server and want to return later to check if it ran ok, or if it is still running, then the tmux tool is very handy.

Tmux can do many more things (like split a terminal window in multiple panes), but that is outside the scope of this article.

To start a new session on your server (once you are connected to the server with ssh), type:

tmux new -s mysession

where ‘mysession’ is the name you want to use

Now start whatever command you want.

If you want to leave your session, but keep everything running so you can check back at a later time, press Ctrl-b d.

To list all detached sessions, use the following command:

tmux ls

No you can reattach to a session using the following command:

tmux attach -t mysession

Categories
Backup Linux MySQL

MySQL: backup your databases

I have put an interesting bash script to backup your database on my git page. You can find it here on https://github.com/afeys/backupmysql/.

Feel free to use and modify it however you please. If you add interesting functionality, or find any annoying bugs, then some feedback through github would be nice.

You can use this script interactively by just typing ./backupmysql.sh in the scripts folder, or you can find out about all the parameters it accepts by using the -h switch.

The script also allows you to create config files with all necessary info to backup a database and then run or schedule it with

/home/backupadmin/scripts/backupmysql.sh -c /home/backupadmin/configs/mycompanydatabase.config > /var/log/backupdatabase.log

Where mycompanydatabase.config is a textfile containing something like this:

databasehost = 10.10.10.1
databaseuser = backupuser
databasepassword = myverysecretdatabasepassword
backupmode = DATA
targetdirectory = /mnt/backupserver/backups/databases
tempdirectory = /tmp
comment = daily backup