All Tips


4

Tip #766   Migrate MySQL Database to a new Server

Tip 669 gave a command to copy a table between remote MySQL databases, but how about if you want to copy the whole DB to a new host?

The following command will copy the database 'old_db' from the local host to 'new_db' on the specified remote host.

Read more »

20

Tip #744   Close shell keeping all subprocess running

I often use 'screen' to run a command that I want to leave running when I logout but sometimes I forget and kick off a long job without screen. If you want to keep these things running, the following command will close the shell keeping all subprocess running

Read more »

10

Tip #743   Grep for word in directory

I've often seen people using the find command on a directory to get all the files, then using these with grep to find files containing a particular word. This can however, be done better just using grep:

Read more »

7

Tip #742   Sort the lines of a file by length

The command below can be used to sort the lines of a file by ascending order (shortest first). Change 'sort -n' to 'sort -nr' to sort in descending order (longest first).

Read more »

0

Tip #741   Find the longest line in a file

This is how we can find the length of the longest line in a file.

Read more »

3

Tip #740   Incremental backup with tar

The tar command can be used to make a quick incremental backup as follows:

Read more »

10

Tip #739   Display file permissions in octal

Tip 205 is an interesting way to show file permissions in octal using sed, but this can be done much easier using the Linux stat command.

From man page of Linux stat(1) command:
%A Access rights in human readable form
%a Access rights in octal
%n File name

Read more »

15

Tip #701   Stream YouTube videos directly to your media player

YouTube is great, but the embedded flash player doesn't offer a lot in the way of customizing your viewing experience. There are quite a few options for downloading flv video files from YouTube, but adding the following function to your bashrc will let you stream them directly to your choice of media player.

Read more »

3

Tip #680   Find and remove core files

Use this to find core files and remove them:

Read more »

4

Tip #676   The poor man's REPL

This is the general form; it will run 'mycommand' once for each line of text you enter with that line of text supplying the arguments to the command:

Read more »