Command line tricks
tuxradar.com
tuxradar.com
If you change the port of SSH, change it to still use a port under 1024. On most Unix systems these are privileged ports that require root to open. This ensures that if there is a process listening there that it was opened by root and not some intruder hoping to get your password to sudo to higher privileges.
Regarding removing reserved space:
Be careful doing this on some file systems. Some filesystems may need to write more data to a journal or are set up with copy-on write and will not be able to delete files if you have no space left on the disk. Reserving a little extra space for this can be necessary. A little extra space also lets you have some space to work with if you need to temporarily create or move files before you can free up the space.
Also, if you're going to use a non-standard port, set up your .ssh/config!
Host s
hostname server
port 666
That is a little more versatile than setting up an alias as it will work from any shell and you can specify any ssh daemon in there.See `man ssh_config` for more info.
A nearly-full disk is not "normal use" in the above sense.
http://www.commandlinefu.com/commands/browse/sort-by-votes
Being on a Mac, I didn't have the rename or prename command, but after a lot of searching, found it here:
http://www.perlmonks.org/?node_id=303814
(beware the '+' signs at the beginning of each line)
cat [one-file] | less
`less` takes a file as an argument. less [one-file]
only requires you to run one program, and I/O tends to be really slow. tail errors.log
or if you want, say, 50 lines of output (instead of 10): tail errors.log -n 50edit: Also, another useful thing is <command> | xargs -n1 -I{} <stuff>, which runs stuff once on every element of the output of command, replacing every occurrence of {} with the element. Then you can do something like "ls *.mp4 | xargs -n1 -I{} mv {} `basename {}`.mp3" .
for f in *.wma; do ffmpeg -i "$f" "${f/.wma/.mp3}"; done
Reduce, on the other hand, is a pain; a simple > $$.out or similar on the xargs commandline probably won't work, best to wrap it up in a standalone script that does the same thing to guarantee you've got a new pid.
Then you get something like:
$ cat batch.sh
#!/usr/bin/sh
do_something_expensive $1 > tmp_$$.out
$ find -print0 | xargs -n 1 -0 -I{} -P 4 bash ./batch.sh {} && cat tmp*out > batch.out && rm -rf tmp*out
Of course this is huge overkill for nearly all jobs unless you have a good number of CPUs and even then you should probably find a better way if you find yourself doing this twice. cat somefile | nc -q1 -l -p8081 nc -q1 -l -p8081 < somefileThe script under "crash test dummy" is hackish and full of race conditions, but that's perhaps acceptable in that case.
Leaving webmin and X open to all local users (in the case of webmin, by choosing a bad password) is not a good idea.