Results 1 through
20
of the
Linux - general
discussion
board
How to use script and scriptreplay
# Record
script -t 2> sample.timing sample.log
do stuff...
exit
# Playback
scriptreplay sample.timing sample.log
# Also consider the following programs:
ttyrec
http://www.rockfloat.com/board/post/?id=621
October 20, 2012 @08:28
(Replies: 0)
RE: How do you quickly delete certain files by extension?
Lately I've been using a bash script, rather than a bash alias:
#!/bin/bash
# Simple script to recursively delete unwanted files
find . -regextype posix-egrep \
-regex '.*swo|.*swp|.*pyc|.*pyo|.*~' -exec rm {} \;
http://www.rockfloat.com/board/post/?id=593
June 09, 2008 @06:43
(Replies: 0)
Vim tips and tricks
In command mode
* zb puts the line which the cursor is on at the bottom of the screen.
* zt puts the line which the cursor is on at the top of the screen.
http://www.rockfloat.com/board/post/?id=613
December 12, 2009 @09:57
(Replies: 0)
Re: How do you create an encrypted tunnel over ssh using the cli ssh client?
Here's an alternate way of doing it that's slightly more readable:
user# ssh -L 5985:localhost:5984 remote-host
This would let you connect to couchdb on remote-host via: http://localhost:5985/_utils/index.html
http://www.rockfloat.com/board/post/?id=610
November 05, 2009 @18:48
(Replies: 0)
How do you look at the currently running linux kernel config?
See if you have this file:
ls /proc/config.gz
If so, copy and unpack it :)
http://www.rockfloat.com/board/post/?id=609
August 20, 2009 @18:18
(Replies: 0)
How do you fix dhclient so dns resolution works properly?
If you're running RedHat, Ubuntu, or anything else that uses dhclient, you should make sure it's configured properly. Make sure in this file:
Redhat/Centos:
/etc/dhcp3/dhclient-script
Ubuntu/Debian:
/etc/dhcp3/dhclient.conf
you have this
[...]
http://www.rockfloat.com/board/post/?id=601
November 11, 2008 @02:19
(Replies: 0)
How do you change the passphrase of an existing ssh key?
It's very easy actually:
user# ssh-keygen -f ~/.ssh/id_dsa -p
http://www.rockfloat.com/board/post/?id=598
August 25, 2008 @17:46
(Replies: 0)
How do you add something to the default runlevel on Ubuntu?
Try something like:
# See what's there now (there is a better way I'm sure)
user# tree -fi /etc | grep -E 'rc[0-9]+.d' | grep postgres
# Remove from the default runlevels
user# sudo update-rc.d -f postgresql-8.3 remove
# Put it back to the
[...]
http://www.rockfloat.com/board/post/?id=596
July 26, 2008 @00:23
(Replies: 0)
How do you add something to the default runlevel on RedHat (rhel)?
I really dislike how rhel organizes init scripts. This is what you want:
root# chkconfig --list nfs
root# chkconfig nfs on
root# chkconfig --list nfs
John M.
http://www.rockfloat.com/board/post/?id=594
June 27, 2008 @18:27
(Replies: 0)
How do you install ssl enabled apache on Ubuntu?
Here's one way:
root# apt-get install apache2 ssl-cert
root# a2enmod ssl
root# mkdir /etc/apache2/ssl
root# make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
root# cat <<EOF > /etc/apache2/sites-available/ssl
NameVirtua
[...]
http://www.rockfloat.com/board/post/?id=592
June 06, 2008 @02:15
(Replies: 0)
Postfix mailhub configuration
Here's an example Postfix main.cf that's usefull for a simple mailhub configuration:
# Add this to the end of /etc/postfix/main.cf
myhostname = smtp.foo.com
mydomain = foo.com
mynetworks = 127.0.0.0/8, 10.0.0.0/24
alias_maps = hash:/etc/mail/a
[...]
http://www.rockfloat.com/board/post/?id=591
April 15, 2008 @04:50
(Replies: 0)
how to tar gzip a directory for backup?
make a simple tarball: root# tar pzcvf etc.tar.gz /etc
p = preserve permissions
z = use gzip compression
c = create new tarball
v = verbose
f = file to create as the tarball
to list the contents of a tarbal: root# tar pztvf etc.tar.gz
p = pr
[...]
http://www.rockfloat.com/board/post/?id=334
May 01, 2002 @18:52
(Replies: 1)
How do you extract a single file from a tarball?
You can extract a single file from a tarball like this:
user# tar xzvf foo.tar.gz dir_in_tarball/foo_file
If you want to print the file to stdout, you an do:
user# tar xzvf foo.tar.gz dir_in_tarball/foo_file -O
John M.
http://www.rockfloat.com/board/post/?id=590
April 04, 2008 @20:36
(Replies: 0)
How do you join a new group without having to log out and back in again?
Try this:
user# sudo gpasswd -a foouser foogroup
user# newgrp
or
user# newgrp foogroup
http://www.rockfloat.com/board/post/?id=589
January 15, 2008 @21:52
(Replies: 0)
How do you use ssh-agent manually, without keychain?
Try:
user# ssh-agent
user# eval `ssh-agent`
user# ssh-add
You will be prompted for your passphrase which will then be remembered
http://www.rockfloat.com/board/post/?id=588
January 15, 2008 @15:24
(Replies: 0)
How do you expand a file path in bash?
Try:
user# readlink -f ~/Desktop
http://www.rockfloat.com/board/post/?id=587
January 10, 2008 @23:07
(Replies: 0)
How do you remove newlines from a string, or file?
Try this to put join the lines with no spaces:
user# cat file | tr -d '\n'
Try this to join them with spaces between:
user# cat file | tr '\n' ' '
John M.
http://www.rockfloat.com/board/post/?id=586
January 10, 2008 @23:00
(Replies: 0)
How do you perform string replacements on a file using sed?
Here's an example of how to do replacements on a bunch of files:
user# for f in $(tree -i -f | grep -E '[a-z]\.xml$'); do sed -i $f -e 's/howtosrc/Docs/g'; done;
Here's an example to do a really simple replacement:
user# sed -i test.txt -e '
[...]
http://www.rockfloat.com/board/post/?id=585
January 07, 2008 @03:19
(Replies: 0)
How do I add networking support to chroot?
You'll need to mount a few additional things to make this happen.
mkdir /mnt/my_chroot
mount -t auto -o acl /dev/my_partition /mnt/my_chroot
mount --bind /dev /mnt/my_chroot/dev
mount --bind /tmp /mnt/my_chroot/tmp
mount --bind /proc /mnt/my_
[...]
http://www.rockfloat.com/board/post/?id=584
October 19, 2007 @15:11
(Replies: 0)
how do you chroot into an lvm volume?
First you need to "activate" the available lvm volumes:
root# vgchange -a y
Then you can scan to see which ones are available
root# lvscan
Then you can mount it, and chroot into it
root# mount /dev/VolumeName/VolumePartition0
root# chroot /
[...]
http://www.rockfloat.com/board/post/?id=583
September 26, 2007 @22:33
(Replies: 0)