All Tips


5

Tip #484   Encrypt a file with OpenSSL

Works on OS X, Linux, anywhere with OpenSSL installed:

To encrypt a file:

Read more »
  • TAGS:

3

Tip #483   /dev/vcs and /dev/tty

Have you ever wanted to check the content of the first virtual console without switching to it with "Ctrl+Alt+F1"? Or the second console of a remote server? Or would you like to send something to the user working at the third virtual console (not via wall command)?

The GNU/Linux kernel provides two character devices for such tasks:

* /dev/ttyX - represents X. virtual console
* /dev/vcsX - represents X. virtual console text contents

So, to answer the questions use these commands:

1. cat /dev/vcs1
2. ssh root@server 'cat /dev/vcs2'
3. echo "something" > /dev/tty3 Read more »
  • TAGS:

12

Tip #482   Watch a command

If you want to repeat a command at set intervals, for example you are monitoring something, then you can use about the watch command. It will print the results of the command to screen every 2 seconds (you can change the interval with -n).

For example watching the disk space:

watch -n 10 df -h Read more »
  • TAGS:

6

Tip #481   ESC-g for glob expansion in bash

Like <TAB> expands a filename given a prefix you can also expand a file name given the middle part of a file name using escape and then 'g'.

Read more »

1

Tip #480   Diff Two Directories

A quick script to compare files from two directories (for example a backup and working directory).

Read more »

2

Tip #468   Moved Trac and Subversion repositories to another machine/direct

CASE: You've relocated Subversion and Trac repositories to another machine/directories. You don't want to edit n+1 trac.ini files.

You have for example:
/repos/svn-myprojects/my-first-project
/repos/trac-myprojects/my-first-project

/repos/svn-myprojects/my-second-project
/repos/trac-myprojects/my-second-project

...etc...

Change ALL trac.ini repository_dir settings:

trac-mass-repodir-edit.sh:
Read more »

4

Tip #464   List of numbers with equal width

How to generate list of numbers with equal width:
# seq -w 0 20

This command produces the following output:
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 Read more »
  • TAGS:

5

Tip #460   Random IP addresses

nmap -iR 20 -sL -n|awk '{print $2}'|grep '^[0-9]'|uniq Read more »

4

Tip #452   Command line stop watch

I wanted a simple (accurate to the second) stop watch when I was at the command line. So I did a quick one-liner.
Read more »
  • TAGS: