How to Zoom out Firefox bookmarks spacing

Firefox Update enlarges bookmark context menu spacing. Reduce menu spacing via userChrome.css

As we can easily see after the Mozilla Firefox Update 92, the bookmark context menu under the toolbar now appears much larger. A comparison to Chrome shows the menu spacing (padding) between the bookmark items now twice as large.

If we try the Firefox Toolbar settings by click the menu button    and choose More tools and open Customize toolbar with click the Density button and choose “Normal” does not really shows a reduction. If there are a large number of bookmark items in a folder, depending on the screen resolution, the menus can sometimes overlapping.

How to Customize Firefox Bookmark Toolbar

  As announced, in the current release of Firefox 92 the menu spacing can only be reduced via userChrome.css. In the next Firefox 93 release they have added support to reduce menu spacing via “Density: Compact” on the Customize page.

By creating the file userChrome.css the bookmark menu (menuitem) can be adjust using style sheets. Before that, however, Firefox 69 and later must set the default setting on the about:config-page from false to true to enable userChrome.css and userContent.css in the Chrome folder, to do it with pasting about:config in the firefox address bar and hit Enter

Firefox Advanced Preferences about:config

  Proceed with Caution. Click button Accept the Risk and Continue

Next in the search box type or paste the line below into “Search preference name” and hit Enter

toolkit.legacyUserProfileCustomizations.stylesheets

The option for Customize Style Sheets opens, click on the switch icon on the right to set it to true.

Next for the style sheet files create a folder chrome (if not already exist), this under the Firefox profile folder, this profile folder is easy find by click the Firefox menu button    choose Help and open More troubleshooting information, then scroll down a bit and click on the Open Folder button at Profile Folder, the profile folder just opens in File Explorer. Now create the chrome folder here.

Mozilla Firefox default pofile path to userChrome.css

  You’ll need to tell Windows to show you file extensions, if you haven’t already. Windows hides file extensions by default to simplify things. On Windows 8 or 10, you can simply click the View tab on the ribbon and check the File name extensions box to make them visible.

Windows File Explorer View File name extensions

userChrome.css is a style sheet with special importance to Firefox. The rules in userChrome.css under the profile folder are applied to the user interface, and can override nearly every built-in style rule.

This userChrome.css has nothing to do with Google Chrome. Chrome refers to the user interface of the web browser, which is what Google Chrome was named after.

menupopup > menuitem, menupopup > menu {
 padding-block: 2px !important; /*adjust: 0px-4px*/
 min-height: 22px !important; /*adjust: 21px-24px or unset*/
}

*|*:root {--arrowpanel-menuitem-padding: 2px 8px !important;}

Add the CSS code into Notepad Editor and save them with the file name userChrome.css. Copy the file under the Firefox profile folder to the chrome folder. The next time you open Firefox, the bookmarks under the toolbar appear smaller again.

Mozilla Firefox with using Customized userChrome.css

If you also want to change the font size, the default font-size can be adjust by inserting the CSS code line.

/*
 * Make all the default font sizes 8 pt:
 */
* {
font-size: 8pt !important
}

  Whenever you edit your userChrome.css file, you will have to close all open tabs and relaunch Firefox for your changes to take effect.

How to Search in Bash History

Using Bash History Reverse Search to find and re-execute command

Bourne-again shell is a free Unix shell under the GPL. Bash remembers the commands you enter and saves them to a history file. It is the default shell for terminal environments of most Linux distributions, on macOS the default shell can be set to Bash, the Bourne-again shell is also available for Windows 10 and can be installed with the WSL features.

BASH the Bourne-again terminal shell on Debian
Bash the Bourne-again shell on Debian

Most will know it, with the arrow up key you can scroll through the bash history to run a previously executed command again.

Reverse Search Bash History for a Command

What many do not know, it can be searched for a certain command in the history, so with Ctrl+R the reverse search can be called, here you enter the characters you remember.

Bash Reverse Search Ctrl+R

By repeatedly pressing Ctrl+R you scroll back step by step, to command lines that match to the search pattern in the history.

  • Ctrl+R: Search Bash History for a Command. Gets the last command that matches the characters you entered.
  • Ctrl+O: Run the found command, after Ctrl+R.
  • Ctrl+G: Exits history search mode without executing a command.

Bash History Common Scenario

A common scenario in which you find yourself is to enter part of a command and then find that you have run it before and could search the history for it.

The correct search method with what is already on the command line is to move the cursor to the beginning of the line with Ctrl+A to call the reverse history with Ctrl+R and to insert the current row into the search with Ctrl+Y and then search backwards again with Ctrl+R

Reviewing Previous Bash History

Each command is associated with a number for easy reference. The list of commands in the Bash history begins with an index number.

$ history

The command with the highest number is the last command executed.

495 vi /etc/bash.bashrc
496 cd /var/www/3w/dot/html/content
497 uname -promsvm
498 vi /etc/sysctl.conf
499 multitail -cS postfix /var/log/mail.log
500 multitail -cS apache /var/log/apache2/access.log
501 multitail -cS syslog /var/log/syslog
502 history

We can truncate the output by specifying a number after the command. For example, if we only want to see the last 5 commands entered, we can type the following.

$ history 5

Other possibilities are, for example, with forward to grep to filter the command history output.

$ history | grep hostname
365 hostname
369 hostnamectl status
484 hostnamectl set-hostname debian
486 cat /etc/hostname
516 history | grep hostname

Run Commands from Bash History

We can recall any of our previous command from history by its number preceded by an exclamation point (!). For instance, if the history looks like the above, we could run hostnamectl status quickly by typing !369.

$ !369
   Static hostname: debian
         Icon name: computer-vm
           Chassis: vm
        Machine ID: fc5cb9d7ace83e1c9c1fcbe4ec76d302
           Boot ID: 379bf41010125c63bbaa4f2b778ac54c
    Virtualization: vmware
  Operating System: Debian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.0-17-amd64
      Architecture: x86-64

This will immediately recall and execute the command associated with the history number 369.

We can also execute commands relative to our current position. We can do this by using the !-n syntax, where n is replaced by the number of commands ago we want to recall.

For instance, if we want to recall and execute a command that we typed before our most recent one, we could type !-5. So we will run again, our session might look like this.

$ !-5
hostname
debian

To re-execute the previous command, bash provides a shortcut that we can use. The shortcut is !! will re-execute the last recent command.

Delete Bash History

The command cleans up the history of the current user session.

$ history -c

Completely clear the saved bash history from the current user.

$ cat /dev/null > ~/.bash_history

The cat command clear the the content in file .bash_history of the currently logged on user.

Conclusion

This should now give a good idea of how the available follow-up operations can be used. Some of these will probably be more useful than others, but it’s good to know that bash has these skills in case you’re in a position where it would be helpful to dig them up.

Last but not least, the history command, the reverse search, and the simple history extensions should help speed up the workflow.

Synology DSM with SSH Terminal

How to deploy GateOne terminal emulator SSH client on Synology DSM

GateOne is a web-based HTML5 driven open-source terminal emulator with a powerful SSH client that can be used to run any terminal application from the browser and provide virtual terminal connections. GateOne can be used as a supplement to web-based management interfaces. This post shows how to deploy and use GateOne with Synology DSM.

GateOne for each browser they supports WebSocket, a browser plugin is not required

Run Synology DSM SSH Client ping

Synology DSM does not provide a way for diagnostic tasks such as ping or traceroute, with an embedded SSH client these functions comes available. The GateOne SSH client offers other useful applications, such as bypassing a proxy, or if there is no VPN to the NAS and the firewall only allows port 443 (HTTPS) for the browser.

GateOne is not provided or managed by Synology itself, but can be retrieved from the SynoCommunity repository. The SynoCommunity offers free packages for Synology NAS devices.

Note. GateOne version 0.9.3 for DSM 5/6, support for DSM 7 is currently not available (23.8.2021).

How to add the SynoCommunity repository

From DSM you open the main menu with the icon at the top left, there you will find the package center.

Synology Package Center

Click on the Icon Package Center to open it, then on button Settings.

Synology Packet Center Settings

In the General pane that opens, under Trust level, select Synology Inc. and Trusted Publishers.

Synology_Packet_Center_Settings_General

Then go to the Package Sources section.

Synology_Packet_Center_Packet_Source

Click the Add button and insert the package source, enter SynoCommunity as the name and paste the URL https://packages.synocommunity.com/ for location and click OK.

Synology_Packet_Center_Add_Package

Now packages can be installed from SynoCommunity, here you enter gateone in the search field at the top of the magnifying glass.

After GateOne appears from the community package source, the app is provided by clicking install.

There are now many possible applications with GateOne.

Note. In order to be able to access the NAS itself via SSH, the SSH service must be activated in the DSM control panel, how to do it can find here. The most commands require sudo permission, i.e. sudo ping.

What is Websocket ?

The WebSocket protocol is a TCP-based network protocol that was designed to establish a bidirectional connection between a web application and a WebSocket server or a web server that also supports WebSockets