Found this really nice quick reference guide for Python 2.4 via Digg. You can have all the basics and necessary information about the language(my favourite) into a nicer and compact form. I think I got to get a printout of this one and keep it handy.
locate — Quick search for files
Locate provides a secure way to index and quickly search for files on your system. The index database to make searching faster and file permissions and ownership info will give the security.
$ locate myfile — Locate myfile in the DB and Print the path.
$ locate -i MyFile — Same as above. But Case insensitive.
$ locate -q myfile — Run in Quiet Mode.
$ locate -n 10 myfile — Limit the no. of results shown to 10.
# locate -U mydir -o myDB — Create index DB starting at path mydir and store the index file in myDB.
Read: man locate
Ubuntu Breezy 5.10 users search for installing Firefox 1.5 on their boxes. So, I thought of writing a tutorial. I am writing this using the information in the Ubuntu Wiki. There are a few points to note before installing Firefox 1.5.
- Don’t remove the Ubuntu version of Firefox, otherwise, you will break a few packages
- You will no longer get automatic updates through repositories, but the auto-updater built in firefox is enough
- The Totem video plugin doesn’t work. I don’t use this particular plugin. Anyway you can install the package mozilla-mplayer.
- You need package libstdc++5 installed.
sudo apt-get install libstdc++5
- There is a bug in Firefox which causes an error dialog to be displayed, each time FF starts up saying Firefox could not install this item because of a failure in Chrome Registration. Do this for a work around:
sudo mkdir -p /opt/firefox/extensions/[email protected] sudo touch /opt/firefox/extensions/[email protected]/chrome.manifest
- I would suggest you backup your bookmarks and settings by
cd ~/.mozilla/firefox/*.default mkdir ~/Desktop/ffsettingscp bookmarks.html cert8.db cookies.txt formhistory.dat key3.db signons.txt history.dat mimeTypes.rdf ~/Desktop/ffsettings
- Download firefox-1.5.tar.gz and change to the directory you downloaded.
- Extract it to
sudo tar -C /opt -xvzf firefox-1.5.tar.gz
- Link to your plugins and remove totem-mozilla as it doesn’t work with FF 1.5
cd /opt/firefox/plugins/sudo ln -s /usr/lib/mozilla-firefox/plugins/* sudo rm libtotem_mozilla.*
- Change to your home directory and rename your old profile(just as backup)
cd ~mv .mozilla .mozilla.ubuntu
- To ensure it is used as the default version, modify the symbolic link in /usr/bin
sudo dpkg-divert --divert /usr/bin/firefox.ubuntu --rename /usr/bin/firefoxsudo ln -s /opt/firefox/firefox /usr/bin/firefox
dpkg-divertcommand will move the original system-wide
/usr/bin/firefoxto a new name. The
lncommand will place a symbolic link to the newly installed firefox in
- Try the new firefox by typing
- Restore your old data
cd ~/Desktop/ffsettingsmv * ~/.mozilla/firefox/*.default
- Restore your search plugins
sudo cp -i --reply=no /usr/lib/mozilla-firefox/searchplugins/* /opt/firefox/searchplugins/ sudo cp -i --reply=no ~/.mozilla/firefox/*.default/search/* /opt/firefox/searchplugins/
- To ensure that other programs use the 1.5 version and not the older 1.0.7 version, goto Preferences>Preferred Applications in the System Menu. Under the Web Browser tab, choose custom and enter
I hope this tutorial would really help many in installing Firefox and thereby enabling them to view the web in a totally different view. If anyone got any problem in installing Firefox or has got a better way, please discuss here.
showkey — Examine the codes sent by the keyboard
showkey prints to standard output either the scan codes or the keycode or the `ascii’ code of each key pressed. It can be used to check the keyboard driver and key mappings.
$ showkey — Show the interpreted keycode.
$ showkey -k — Same as above (Default Option).
$ showkey -s — Show the raw scan-codes of the keys.
$ showkey -a — Show the Decimal/Octal/Hex values of the keys.
If Showkey is in keycode/scancode mode, then you have to wait 10 second to exit. In ASCII mode, Press Ctrl+D to exit.
Read: man showkey
PyPy is a Python implementation written in Python. Of late people have started to implement a language in itself to demonstrate the versatility of the language and to show its applicability for large projects. Writing operating systems and compiler/interpreters for languages are the most complex things in software development. Since PyPy is implemented in Python, it provides the high level of abstraction and compactness of the language. This makes the implementation easy to understand than in C. Currently it is not well optimised, but in future they may be optimisations to allow prorgams to run faster than CPython.
arp — Manipulate the Address Resolution Protocol cache
It is used to view/add/del kernel’s ARP cache table entries.
$ arp — Show ARP Cache table.
$ arp -v — For detailed output.
$ arp -n — Show Address in numeric. Don’t try to resolve the names.
$ arp wify — Show the ARP entry for wify host.
$ arp -a wify — Same as above.
$ arp -t ether — Only show ether HW class entries.
$ arp -i eth0 — Show ARP entries of eth0 interface.
# arp -d 192.168.1.100 — Delete the ARP entry for this IP.
# arp -s 192.168.1.200 00:0B:22:33:44:55 — Add a new entry.
# arp -f arps.txt — Same as above. Here data will be taken from the arps.txt file.
Read: man arp
ifconfig – CONFIGure a `network’ InterFace
ifconfig is used to display/configure the kernel-resident network interfaces. It is used at boot time to set up interfaces.
$ ifconfig — Show info abt the active network interfaces like IP Address, MAC address, Subnet mask, and status.
$ ifconfig -a — Show the status of active and inactive interfaces.
# ifconfig eth0 down — Deactivate/Shutdown the eth0 interface.
# ifconfig eth0 up — Activate the eth0 interface.
# ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up — Activate an interface with specific IP address.
# ifconfig eth0:0 192.168.1.101 netmask 255.255.255.0 broadcast 192.168.1.255
# ifconfig eth0:1 192.168.1.102 netmask 255.255.255.0 — Creating alias for eth0, ie Assign more than one IP address to eth0.
# ifconfig eth0 arp — Enable the use of the ARP protocol on eth0.
# ifconfig eth0 -arp — Disable the use of the ARP protocol on eth0.
# ifconfig eth0 promisc — Enable the promiscuous mode on eth0.
# ifconfig eth0 hw ether 09:08:07:06:05:04 — Change eth0 MAC address.
# ifconfig eth0 mtu 1412 — Change Max Transfer Unit of eth0.
- Deactivate the interface before changing the IP/MAC.
- Note down the original MAC, Otherwise Reboot needed to get the original MAC Address.
- Some command sequence needs super user permission.
Read : man ifconfig
id – Print real & effective UIDs and GIDs
It prints the user’s info like user id, group id, user name, etc.,
$ id — Print UID, GID, Groups.
$ id -r — Print only the real user ID.
$ id -u — print only the effective user ID
$ id -nu — Print only user name.
$ id -g — print only the effective group ID.
$ id -ng — Print only group name.
$ id -G — Print all group IDs
$ id -nG — Print all groups name.
$ id user1 — Print info abt user1.
Real UID is the UID of the user, who created. Effective UID is used to evaluate privileges of the process to perform a particular action.
Read : man id
rdate — Get the time from Remote machine.
It connects to an Remote Time Server over a TCP/IP network, printing the returned time and/or setting the system clock. The time in remote server is maintained properly. So that all machines can get the time from that server.
$ rdate -p 192.168.1.5 — Print the time returned by the remote machine.
$ rdate -s remote.pc.com — Set the system time to the time returned by the remote machine (Need Root permission).
$ rdate -u myserver — Use UDP instead of TCP as the transport.
$ rdate -l myserver — Use syslog to log errors and output (Useful when it is used in cron jobs).
- Remote server should run the time service in port 37.
- Firewall should not block port 37.
Read : man rdate
uniq — Remove duplicate lines from a SORTED file.
It prints the unique lines in a sorted file. If input is not sorted then, only adjacent duplicate lines are discarded.
$ uniq myfile — Print only unique lines.
$ uniq -i myfile — Ignore case when comparing.
$ uniq -u myfile — Print only lines, Which is not duplicated.
$ uniq -c myfile — Print all unique lines with no .of occurrence.
$ uniq -d myfile — Print only duplicate lines. If a line duplicated then, only one line will be printed.
$ uniq -D myfile — Print all duplicate lines.
$ uniq -w5 myfile — Use only first 5 Chars for checking the uniqueness of the line.
$ uniq -f2 myfile — Don’t compare up-to 2nd field.
$ uniq -s2 myfile — Don’t compare up-to 2nd char.
$ sort myfile | uniq > output — Sort myfile & store the uniq output.
Read : man uniq