Red Hat Subscripion Manager - Registering
Registering your RHEL instance with Red Hat is straightforward assuming that you already have an account:
# subscription-manager register --username <your-rh-user> --password <password>
List the available repos or just go with a default:
# subscription-manager list --available# subscription-manager attach --auto
Then you can do your update:
# yum update
RHEL QCOW Image Password
Did you know that although you can install RHEL from an ISO, you can also download a QCOW2 image from Red Hat. However, when you try to start it up under virt-manager you’ll see that it boots to a root prompt and you don’t know what the password is. This can be fixed by running the following from the host’s terminal:
# virt-customize -a <qcow2-image-file-name> --root-password password:<password>
Find System Hogs and Child Processes
There are a lot of tools out there that can help you to do this that are both GUI or command line-based but sometimes you’re on a production server that may have limited tools and sometimes the simplest tools are best in cases like this.
List the processes that are not owned by you that are using a lot of CPU:
$ ps aux --sort=-%cpu | grep -m 8 -vwhoami
How to List Installed Packages in Fedora, RHEL, CentOS
Listing installed packages with YUM:
$ sudo yum list installed
To display details about a package:
$ yum info nginx
You can cat all installed packages to a file, copy the file to another machine and duplicate the system:
$ sudo yum list installed > installed-packages.txt$ sudo yum -y install $(cat installed-packages.txt)
List installed packages with RPM:
Git: Deleting Multiple Commits
Let’s say that you want to delete the last 3 commits that you’ve already pushed to the remote repository. In this example, you want 566dab6 to be the new HEAD revision.
$ git log --pretty=oneline --abbrev-commit57bc36b (HEAD -> master, origin/master, origin/HEAD) 3nd set of bad entries on 6th commitdfb4bd3 2nd set of bad entries on 5th commit0fd1e16 First set of bad entries on 4th commit566dab6 Yet more good entries on third commitd50370a More good entries on second commitb5fbc6d Good entries on first commit2cad4c7 Initial commit
Solus OS: Prevent Laptop from Sleeping When Closing the Lid
If you’re using a laptop with an external monitor and you’ve recently installed Solus OS you might have noticed that the laptop goes to sleep when you close the lid and there is no way to adjust for this in the power settings. You can get around this by manually editing /etc/systemd/logind.conf, then uncommenting and changing the line:
#HandleLidSwitch=suspend
to
HandleLidSwitch=ignore
Note: The ‘#’ (comment) at the beginning of the line needs to be removed and the value needs to be changed from suspend to ignore.
Speed Up Firefox
If you are experiencing tearing while using Firefox you may want to see if graphics accelleration is enabled on the browser. You can try this tip to force hardware accelleration on in the browser.
First, check to make sure that your Linux desktop installation supports it by running the following command and making sure that direct rendering returns Yes:
$ glxinfo | grep renderdirect rendering: Yes
Deleting Blank Lines Using Grep
If you have a file (or a stream) that has blank lines you want to remove, you can use this command:
$ grep -v "^ *$" file-with-blanks.txt > output-file.txt
where file-with-blanks.txt is the input file and has blank lines and output-file.txt will
be the output file without the blank lines.
You have to keep the space between the ^ and the *$ otherwise blank lines which include
spaces will not be removed.
Convert webm to mp4
You can use ffmpeg to convert webm to mp4 on the command line very easily:
$ ffmpeg -i file.webm -c copy file.mp4
This will stream copy (re-mux) and avoid re-encoding.
Install KDbg - A KDE gdb GUI on Slackware 15.0
What is KDbg?
From the homepage:
KDbg is a graphical user interface to gdb, the GNU debugger. It provides an intuitive interface for setting breakpoints, inspecting variables, and stepping through code.
KDbg requires KDE, the K Desktop Environment, but you can of course debug any program.
Here’s how to install it on Slackware 15 but this should work on any system that has KDE:
$ git clone -b maint https://github.com/j6t/kdbg.git$ cd kdbg/$ cmake .$ make$ su -c "make install"