All Tips


5

Tip #673   Backup all files in directory

The command below can be used to backup all files in a directory

Read more »
  • TAGS:
  • cp

6

Tip #672   Concatenate pairs of lines

The following command will concatenate pairs of lines from a file, with a comma separating each line.

Read more »

6

Tip #670   Clean a string for a filename

The command below can be used to convert a string into a valid filename. Uppercase letters are converted to lowercase, all difficult characters are removed and spaces are changed to underscores.

Read more »
  • TAGS:
  • tr

5

Tip #669   Copy MySQL tables between hosts

The following command will allow you to copy a table from the MySQL database on a remote host, to a different MySQL database on your local host.

Read more »

1

Tip #668   Split a long URL

Ever wanted to look at a long HTML URL more easily, say to investigate a parameter. Here is a search from MapQuest.

http://www.mapquest.com/maps/map.adp?formtype=address&addtohistory=&address=10%20Market%20St&city=San%20Francisco&state=CA&zipcode=94111

We can split this using:

Read more »
  • TAGS:
  • tr

7

Tip #666   Scripting Lynx for automated web actions

If you have a series of actions that you perform with the command line web browser lynx, it is possible to record these and then run them all again later. This can be used to record downloading a file, logging in and checking details or pretty much anything else you can do in lynx.

To record your session do the following:

Read more »

2

Tip #633   Saving commands for later

To push a command onto a stack for later retrieval, add this to your shell config.

bindkey '^J' push-line

This will push your command down and allow you to run something else, and after that command is completed your original one will return to the prompt.

Tested on zsh. Read more »
  • TAGS:

5

Tip #632   Debian device driver check and report

The command below uses the debian device driver check and report service at http://kmuto.jp/debian/hcl/index.cgi to give a report on your PCI devices.

As it mentions on the site:
* This database uses the PCI map of Debian kernel 2.6.29-1-686.
* The result does NOT guarantee your hardware works perfectly.
* This database only verifies the PCI devices at this time. X drivers, ISA, USB, IEEE1394 or any other devices are out of the focus.

Read more »

25

Tip #630   Sudo from vim to write file

I often open a file and start editing only to realize later that I don't have write permissions when I get the old "E212: Can't open file for writing" error.

The vim command below can be user to save the file without the need to save it to a temp file and then copy it back again.

Read more »

10

Tip #629   Scan Range of IP Addresses

On my home network I often need to know which IP addresses have devices connected to them. The following one-liner will scan a given range and let you know whether each IP can be pinged.

Read more »