| Sudo 1.7.4 changes defaults 2010-10-26 |
As of sudo 1.7.4 (installed in Fedora 14), sudo -s does not keep the user's home and environment.
The fix is simple:
visudo
Defaults env_keep += HOME
| |
| Moving your saved passwords from firefox to a new .mozilla 2008-11-03 |
Exporting your saved passwords/bookmarks to a new machine or a new installation is simple:
Copy these files from your old installation:
.mozillaold/firefox/xyz12345.default/bookmarks.html
.mozillaold/firefox/xyz12345.default/key3.db
.mozillaold/firefox/xyz12345.default/signons2.txt
Where 'xyz12345' is different every time. Use 'ls' to find the correct directory name.
This works in firefox 2. In firefox 3 you need to use the export/import feature for exporting your bookmarks.
| |
| Easy configuration of sendmail on a home machine 2008-07-18 |
If you don't have any incoming mail on your machine, and only want to be able to send mail from it, the easy way to fix this is using a "smart" relay host in your sendmail.cf.
If you have a machine with a static IP, you can also get it working by fixing your /etc/hosts file - you need a line with IP, full hostname, and short name. Change the line that begins with 127.0.0.1 and remove any references to anything other than localhost and localhost.localdomain.
But the easiest fix is to edit your sendmail.cf:
Find the line beginning with DS.
Change this line to:
DShost.domain.com
Where host.domain.com is your (or your ISP's) outgoing SMTP server (the same one you use in yout email program).
| |
| Colourful and useful prompts 2008-05-29 |
I changed the look of my prompts in both bash and tcsh and was quite pleased with the result. Both useful and is easier on the eye. Suddenly, it got a lot easier to find where the last command was run, when I look through the output of some command.
if ( $term == xterm || $term == rxvt ) then
set prompt="\n%{\033]0;%m:%c3^G%}[%{\033[1;36m%} %P %{\033[0m%}|%{\033[1;33m%} %n@%m %{\033[0m%} ] (%{\033[1;35m%} %~ %{\033[0m%}) [%j]\n%# "
else
set prompt="\n[%{\033[1;36m%} %P %{\033[0m%}|%{\033[1;33m%} %n@%m %{\033[0m%} ] (%{\033[1;35m%} %~ %{\033[0m%}) [%j]\n%# "
endif
if [ $TERM = xterm ]; then
PS1='\n[ \[\e]0;\u@\h:\w\a\e[1;36m\]\t\[\e[0m\] | \[\e[1;33m\]\u@\h\[\e[0m\] ] ( \[\e[1;35m\]\w\[\e[0m\] ) [\j]\n\$ '
else
PS1='\n[ \[\033[1;36m\]\t\[\033[0m\] | \[\033[1;33m\]\u@\h\[\033[0m\] ] ( \[\033[1;35m\]\w\[\033[0m\] ) [\j]\n\$ '
fi
| |
| Pivotroot boot failure 2008-04-23 |
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2
Two solutions:
Either you have compiled a new kernel without support for ext3. Then you probably get the message "mount: error 2 mounting ext 3" as well.
The other possibility is that you've deleted the directory /initrd on your root disk.
The solution to this is to boot with a rescue CD, mount the root file system and run the command 'mkdir initrd'. After this, reboot your system.
| |
| Using xscreensaver with KDE 2008-03-01 |
KDE's screensaver-config is not as good as the one in xscreensaver. For example, you can't get it to show your favourite screensavers, and it seems to crash after viewing videos with mplayer or xine, etc.
Using xscreensaver instead:
Instructions
Also, to use KDE's screensavers in xscreensaver, add them to your .xscreensaver file like this:
>locate .kss
/usr/bin/kbanner.kss
/usr/bin/kblankscrn.kss
/usr/bin/kblob.kss
/usr/bin/kclock.kss
/usr/bin/keuphoria.kss
...
/usr/bin/kwave.kss
- GL: "KBanner" kbanner.kss --root \n\
- GL: "KBlankscrn " kblankscrn.kss --root \n\
- GL: "KBlob " kblob.kss --root \n\
- GL: "KClock " kclock.kss --root \n\
GL: "KEuphoria " keuphoria.kss --root \n\
...
- GL: "KWave " kwave.kss --root \n\
and so on.
Then run xscreensaver-demo to choose which of them you want to use.
| |
| Out of memory in Perl 2008-02-29 |
Get the "Out of memory!" error in perl while reading a large file?
Check that you are using while, and not foreach to read each line. Two examples:
foreach my $line (<FILE>)
{
process($line);
}
This reads the whole file into @_
while (my $line = <FILE>)
{
process($line);
}
This one only reads one line into memory at a time.
| |
| Installation of Fedora 2007-11-11 |
|
| Set the default displaymanager/windowmanager in Fedora 2007-11-11 |
Enter/change the following lines in: /etc/sysconfig/desktop
DESKTOP="KDE"
DISPLAYMANAGER="KDE"
| |
| Make x programs run when using sudo 2007-11-10 |
I had a problem with sudo. When I used su to become root, and then ran, for example system-config-securitylevel, it worked, but if I instead used sudo, it didn't. I got error messages like:
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
This can be solved in two ways (or actually even more). One way is to first become root, and then copy your .Xautority file to /root/.Xauthority. This is an easy way to quickly make it work, but not the method I recommend.
I recommend adding the following environment variable to your .zshenv (if you use zsh), or .bash_profile (if you use bash):
export XAUTHORITY=/home/INSERT_YOUR_USERNAME/.Xauthority
| |
| Make sudo use the same ticket for different terminal windows 2007-11-10 |
In the past, I became used to the fact that if I ran a sudo command in one terminal window, I didn't have to enter the password again for a few minutes - in the same or in any other terminal window.
Some time ago this stopped working (some Linux version I installed). I was quite annoyed for a long time, until I finally took the time to find out how this works.
In your /etc/sudoers file, add the following line:
Defaults !tty_tickets
Suddenly it works again! :-)
It's also possible to change how long it will remember the ticket (i.e. for how long it won't ask for your password again):
Defaults timestamp_timeout = 30
This sets the timeout to 30 minutes.
|
|
| Turn off blinking in shells 2007-08-26 |
Do you like the colors in the 'ls' output in terminals, but hate the blinking of orphaned and missing links?
The cure for this is to be found in the file /etc/DIR_COLORS.
Edit the file (as root), and find the lines that look like:
ORPHAN 01;05;37;41 # orphaned syminks
MISSING 01;05;37;41 # ... and the files they point to
Change to:
ORPHAN 01;37;41 # orphaned syminks
MISSING 01;37;41 # ... and the files they point to
05 is the code for blinking. All the codes are explained in the file.
| |
| Sibelius Scorch Music Viewer in Linux 2007-08-25 |
It's possible to read sheet music in Scorch format in Linux by installing the Windows version of Firefox in Wine. Then go to the sibelius site and install the version for Windows 2000.
It's also possible to install the windows version of flash player, but it's not that useful anymore, since the Linux version of flash is now working quite well.
| |
| Save View Changes per Folder in KDE 2007-08-09 |
If the option is greyed out and you can't change it, click the 'Refresh' icon and the option should become available again.
| |
| Turn colors off in terminal 2007-03-22 |
Vim colors:
Edit /etc/vimrc and add:
syntax off
" Turns syntaxing off - leave this on if you want underlining, etc.
set t_Co=0
" Turns the colors off
Color ls off:
edit /etc/DIR_COLORS and /etc/DIR_COLORS.xterm
change COLOR tty to COLOR none
Alternatively, you can edit the files:
/etc/profile.d/colorls.csh
/etc/profile.d/colorls.sh
There you'll find a few lines that assigns aliases for 'ls' and 'll'. Remove "--color=tty" and you won't have colors anymore.
I'd also recommend changing the lines to:
alias ls 'ls -CF'
and:
alias ls='ls -FC'
This way you will still easily recognise directories and links.
| |
| Using a remote instance of Firefox at the same time as a local instance 2007-03-01 |
Magic command:
setenv MOZ_NO_REMOTE 1
firefox&
| |
| Better fonts in Linux 2007-01-05 |
|
| Maximize vertically in KDE 2007-01-03 |
One thing I found myself missing when I switched from fvwm2 to KDE was my "maximize vertically" button.
I also had a "maximize horisontally", but that one I didn't use that often.
However, I suddenly found out that there is actually a function like that already built into KDE!
Just click the maximize button in the window border with the middle mouse button instead of the left.
So:
- Left MB - Maximize
- Middle MB - Maximize vertically
- Right MB - Maximize horisontally
| |
| Get xmodmap to work in KDE 2007-01-03 |
Make a script ~/.kde/Autostart/xmodmap like this:
#!/bin/sh
#xmodmap -e 'keycode 13 = 4 dollar dollar'
# For some reason, this is not enough on KDE and Fedora Core. Maybe something with UTF8?
# The following two lines fixes both non-dead tilde and circumflex (^)
# and dollar on shift-4 on FC6 and KDE 3.5
xmodmap -e 'keycode 35 = dead_diaeresis asciicircum asciitilde dead_caron asciitilde dead_caron'
xmodmap -e 'keycode 13 = 4 dollar dollar onequarter dollar onequarter'
| |
| ALSA Sound configuration - Recording 2006-08-29 |
The sound controls in ALSA are really incredibly strange, and it is not at all straightforward.
To record, you have to set "Capture on" for capture and the microphone. The volume control on "capture" won't make a difference. You use the volume control on the mic. You might also select "Mic boost" depending on what you record. Also, select "Mute" on the microphone to avoid playing the recorded sound via the speakers.
If you record something via line-in, you set "Capture on" for line-in instead of the mic. But in this case, the volume control for "capture" does have an effect on the recorded sound.
Not that intuitive.
To control the volume to my headphones, I have three controls. First, of course, is "headphone". This, however, is only a fine-tuning control. There are two other controls (on my MB), that are needed, and those are PCM and "VIA DXS". If either of those are muted, or turned down, you won't get any sound at all.
What of the rest of the controls?
Well, when listening via the headphones, and recording via the microphone, I can mute and turn down the controls of the following:
Master
Master Mono
3D Control - Center
3D Control - Depth
3D Control - Switch
Line Capture off
CD Capture off
Video Capture off
Phone Capture off
PC Speaker
Aux Capture off
Mix Capture off
Mix Mono Capture off
External Amplifier
VIA DXS
VIA DXS
VIA DXS Yes, there are four of these! Only the first one has any effect on the sound!
Edit: The other ones are usable if playing several things at once! You can control each sound independently of the others.
You'd also think that master would be needed.. But no, not when using headphones.
Really easy and intuitive? I'd say no, not by a loooong way.
| |
| My fwvm2 configuration. 2001-05-06 |
|
| Some things to add to your .profile, or .cshrc file. 1999-05-08 |
Configuring pico, the texteditor that comes with pine.
alias pico "pico -d -e -j -m -w -z"
-d enable delete key
-e enable filename completion
-j enable goto in filebrowser
-m enable mouse support in file browser
-w disable word wrap
-z enable ctrl-z suspension of pico
Configuring ls. These things makes the output a lot more readable.
alias ls "ls -CFh --color=tty"
-C List files in columns, sorted vertically.
-F Append a character to each file name indicating the file type.
For regular files that are executable, append a `*'. The file type
indicators are `/' for directories, `@' for symbolic links, `|' for
FIFOs, `=' for sockets, and nothing for regular files.
--color=tty Colorize the names of files depending on the type of file.
-h Display sizes in kb, Mb and Gb.
Configuring df and du. These things makes the output a lot more readable - by humans that is.
alias df="df -h"
alias du="du -h"
Makes df and du display sizes in kilobytes, megabytes and gigabytes. A lot more readable.
Configuring less to display scandinavian characters.
setenv LESSCHARSET latin1
Makes less display all characters betweed 161 and 255 as normal
characters. Ie, makes less display scandinavian characters.
Setting up a more useful prompt.
set prompt="%m:%~%#" (tcsh)
PROMPT="%m:%~%# " (zsh)
This makes the prompt display the current directory and the hostname.
Example: "tr3:/usr/doc/HOWTO>"
This only works if you use tcsh or zsh. It's possible to do similar
things in other shells too, I just don't know how, because I just use those two.
Setting up the Swedish keymap
Insert the following line into /etc/rc.d/rc.local :
/usr/bin/loadkeys fi-latin1 # Finnish latin1 keymap
or
/usr/bin/loadkeys se-latin1 # Swedish latin1 keymap
Which one to use doesn't really matter, they're both the same. The se-latin1 file
didn't exist in older versions of Slackware, and might not exist in other distributions
either.
| |
| Adding and removing SCSI devices on-the-fly 1999-05-08 |
These commands have to be run as root. The add command will make the
kernel probe and recognice a SCSI device that has been switched on after
booting last time. It can be useful if you forgot to turn the scanner on
when you booted.
To remove the SCSI device with id 5, run this command:
echo "scsi remove-single-device 0 0 5 0" > /proc/scsi/scsi
To add the SCSI device with id 4, run this command:
echo "scsi add-single-device 0 0 4 0" > /proc/scsi/scsi
| |
| Keymap problems in X 1999 |
To set up various things that aren't the default behaviour of XFree86. AcceleratedX uses some other
defaults, so some of these aren't neccesary.
Append the following lines to your .xinitrc file:
To get the tilde working as it should
xmodmap -e "keycode 35 = diaeresis asciicircum asciitilde"
To get the dollar sign on shift + 4, instead of the sun that's there normally
xmodmap -e "keycode 13 = 4 dollar dollar dollar"
Rebinding keys on Sun keyboards
When I work on Sun machines I add these lines to my .xinitrc file:
xmodmap -e 'keycode 40 = 4 dollar dollar'
xmodmap -e "clear mod4"
xmodmap -e "clear mod2"
xmodmap -e "remove mod1 = Meta_R" # Remove right Meta
xmodmap -e "keycode 20 = Control_R" # Rebind AltGraph to Control_R
xmodmap -e "keysym Meta_R = Mode_switch" # Rebind right Meta to Mode_switch
xmodmap -e "add control = Control_R" # The new Control_R now works as Control
xmodmap -e "add mod2 = Mode_switch" # The new Alt's now works as Alt
General keyboard changes
This one goes into .xinitrc on every machine I use. Rebinds CapsLock to /dev/null once and for all. =)
xmodmap -e "remove Lock = Caps_Lock"
xmodmap -e "keysym Caps_Lock = Control_L"
xmodmap -e "add Control = Control_L"
| |
| Getting an X-Term window to open on an alternative display 1998 |
For example, you want to work on a remote Linux machine, but want to get
the X windows shown as if you were working on your local computer. The thing
you need on the local computer is an X server.
Telnet to the remote computer and issue the command:
/usr/bin/X11/xterm -fn 6x13 -sb -ls -display 137.59.127.214:0 -name KALLE &
| |