Tip #484 Encrypt a file with OpenSSL
Works on OS X, Linux, anywhere with OpenSSL installed:To encrypt a file:
Read more »
- TAGS:
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:
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:
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 »
- TAGS:
- bash
Tip #480 Diff Two Directories
A quick script to compare files from two directories (for example a backup and working directory).Read more »
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 »
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:
Tip #460 Random IP addresses
nmap -iR 20 -sL -n|awk '{print $2}'|grep '^[0-9]'|uniq Read more »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:
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs