tar: Archives cheatsheet

Create archive:

tar -czvf compressed_file.tar.gz original_file.sql

Extract files:

tar -xzvf compressed_file.tar.gz
| 13 Feb 2021

Keep running ssh command after disconnecting from the server

nohup database_migration.sh &
  • nohup will take care of running the command and forward command output to nohup.out
  • & will run the command in the background

Use tail -f nohup.out to get the output from the command

| 12 Feb 2021

Configure HP printer in fedora

Default Printer application in GNOME (fedora 33) is not able to successfully configure wireless printer, it needs to be done manually:

sudo dnf install hplip hplip-gui
sudo hp-setup

Select Network/Ethernet/Wireless network and your printer will appear in the list. Follow the instructions and add the printer.

| 29 Jan 2021

List files installed by a package

To list all files installed by dnf package:

rpm -ql dnf
| 29 Jan 2021

top-like application for intel GPU

Top-like application to monitor performance of intel GPU:

sudo dnf install igt-gpu-tools
sudo intel_gpu_top

Playing 4k video sample on youtube (intel i3-8100T):

intel-gpu-top: Intel Coffeelake (Gen9) @ /dev/dri/card0 - 1063/1083 MHz;    1% RC6;  7.35/19.18 W;      467 irqs/s

      IMC reads:     6889 MiB/s
     IMC writes:     3901 MiB/s

          ENGINE      BUSY                                      MI_SEMA MI_WAIT
     Render/3D/0   98.29% |██████████████████████████████████▍|      0%      0%
       Blitter/0    0.00% |                                   |      0%      0%
         Video/0    0.00% |                                   |      0%      0%
  VideoEnhance/0    0.00% |                                   |      0%      0%

Playing the same video in 1080p (intel i3-8100T)::

intel-gpu-top: Intel Coffeelake (Gen9) @ /dev/dri/card0 -  591/ 591 MHz;   30% RC6;  3.06/ 6.47 W;      474 irqs/s

      IMC reads:     4058 MiB/s
     IMC writes:     2654 MiB/s

          ENGINE      BUSY                                      MI_SEMA MI_WAIT
     Render/3D/0   55.64% |███████████████████▍               |      0%      0%
       Blitter/0    0.00% |                                   |      0%      0%
         Video/0    0.00% |                                   |      0%      0%
  VideoEnhance/0    0.00% |                                   |      0%      0%
| 18 Jan 2021

Install multimedia codecs in fedora

If you are experiencing high CPU usage when watching videos on youtube, verify that the following packages are installed (requires RPMFusion repository):

# RPMFuison repositories
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

# Codecs
sudo dnf install gstreamer1-plugins-{bad-\*,good-\*,base} gstreamer1-plugin-openh264 gstreamer1-libav --exclude=gstreamer1-plugins-bad-free-devel
sudo dnf install lame\* --exclude=lame-devel
sudo dnf group upgrade --with-optional Multimedia

CPU usage for i3-8100T is down from 80% to 50% with this video sample

| 16 Jan 2021

Monitor thread count

watch -n 0.5 "ps -eLf | grep traffic_server | wc -l"
| 15 Jan 2021

High CPU usage on youtube in fedora

I’ve started to experience quite high CPU usage when watching youtube videos on 1440p screen (video sample). By default, youtube loads videos in VP9 codec. Using this codec results in 80% CPU usage (i3-8100T). By installing this extension enhanced-h264ify and by blocking VP8, VP9 and AV1, youtube will load videos in avc1(h.264) codec. The CPU usage is down to about 30%.

Unfortunately, this will disable all 4k videos - they are available only in VP9.

| 14 Jan 2021

Add exit code to the command line

Some examples to add exit code to command line prompt in bash (put it into ~/.bashrc):

export PS1="\[\033[01;31m\]\$([ \$? == 0 ] || echo \"!\$? \" )\[\033[00m\]\[\033[01;32m\]\t \[\033[01;34m\]\w\[\033[00m\]\[\033[1;32m\]\n\$ \[\033[m\]"

Add to the default PS1 in CentOS:

export PS1="\[\033[01;31m\]\${?##0}\[\033[00m\][\u@\h \W]\\$"
| 11 Jan 2021

Disable touchpad in Microsoft All-in-one media keyboard

List all available input devices:

$ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech M185                           	id=10	[slave  pointer  (2)]
⎜   ↳ Microsoft Microsoft® Nano Transceiver v2.0 Consumer Control	id=14	[slave  pointer  (2)]
⎜   ↳ Microsoft Bluetooth Mouse               	id=20	[slave  pointer  (2)]
⎜   ↳ Microsoft Microsoft® Nano Transceiver v2.0 Consumer Control	id=13	[slave  pointer  (2)]
⎜   ↳ Microsoft Microsoft® Nano Transceiver v2.0 Mouse	id=12	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=9	[slave  keyboard (3)]
    ↳ Microsoft Microsoft® Nano Transceiver v2.0	id=11	[slave  keyboard (3)]
    ↳ Microsoft Microsoft® Nano Transceiver v2.0 System Control	id=15	[slave  keyboard (3)]
    ↳ Dell WMI hotkeys                        	id=16	[slave  keyboard (3)]
    ↳ Logitech M185                           	id=17	[slave  keyboard (3)]
    ↳ Microsoft Microsoft® Nano Transceiver v2.0 Consumer Control	id=18	[slave  keyboard (3)]
    ↳ Microsoft Microsoft® Nano Transceiver v2.0 Consumer Control	id=19	[slave  keyboard (3)]
    ↳ Microsoft Bluetooth Mouse Keyboard      	id=21	[slave  keyboard (3)]

The touchpad device is known as Microsoft Microsoft® Nano Transceiver v2.0 in the system. Disable it with this command:

xinput disable 12

And enable it again with this command:

xinput enable 12

Or one-liner:

xinput enable `xinput list | grep "Microsoft Microsoft® Nano Transceiver v2.0 Mouse" | grep -oP "id=[0-9]*" | grep -oP "[0-9]*"`
| 4 Jan 2021