Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Render web page using PyQt

Answer:

Qt bindings to WebKit have been added since 4.4, so you can use PyQt to script the browser (Webkit based).

Firstly, make sure you have installed the need packages:

# sudo apt-get install libqt4-core libqt4-webkit python-qt4

Then you can write a simple script to test, e.g.

#!/usr/bin/env python

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

app = QApplication(sys.argv)

web = QWebView()
web.load(QUrl("http://www.google.com"))
web.show()

sys.exit(app.exec_())

Remove downloaded archive files from apt-get

Answer:

To remove ownloaded archive files from apt-get to save spaces, try the following command:

# sudo apt-get clean

So all the unneeded archive files will be removed.

Compress and decompress file using 7zip

Answer:

7zip is a well known compression program if you need a very small file size, i.e. high compression ratio.

To install under Ubuntu/Debian:

# sudo apt-get install p7zip

To compress a file

# p7zip test.txt

To decompress a file

# p7zip -d test.txt.7z

How to completely uninstall a package in Ubuntu/Debian?

Answer:

To completely uninstall a package in Ubuntu/Debian, you can use the command below:

# sudo apt-get --purge remove PACKAGE

That's it.

Add a User in Linux

Answer:

Add a User in Linux, just use the useradd command:

# sudo useradd -d /home/john -m john

The above command will create the user john and create a home directory which is at /home/john